Skip to content

Commit d1182b3

Browse files
committed
🐞 Bugfix: previewConfig.backgroundColor
Summary: use custom UIColor extension instead of `processColor` + `RCTConvert`
1 parent 4610a30 commit d1182b3

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

ios/src_library/React Native/RCTContextMenu/RCTMenuPreviewConfig.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ extension PreviewConfig {
6969
self.isResizeAnimated = isResizeAnimated;
7070
};
7171

72-
if let value = dictionary["backgroundColor"],
73-
let bgColor = RCTConvert.uiColor(value) {
72+
if let string = dictionary["backgroundColor"] as? String,
73+
let bgColor = UIColor(cssColor: string) {
7474

7575
self.backgroundColor = bgColor;
7676
};

src/ContextMenuView.ios.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { StyleSheet, Platform, requireNativeComponent, UIManager, View, TouchableOpacity, processColor, findNodeHandle } from 'react-native';
2+
import { StyleSheet, Platform, requireNativeComponent, UIManager, View, TouchableOpacity, findNodeHandle } from 'react-native';
33
import Proptypes from 'prop-types';
44

55
import { PreviewType } from './Enums';
@@ -86,20 +86,6 @@ export class ContextMenuView extends React.PureComponent {
8686
delete otherProps[key];
8787
};
8888

89-
const previewConfig =
90-
nativeProps[NATIVE_PROP_KEYS.previewConfig];
91-
92-
// process previewConfig.backgroundColor prop
93-
if(previewConfig?.backgroundColor){
94-
nativeProps = {
95-
...nativeProps,
96-
[NATIVE_PROP_KEYS.previewConfig]: {
97-
...previewConfig,
98-
backgroundColor: processColor(previewConfig.backgroundColor)
99-
},
100-
};
101-
};
102-
10389
return { nativeProps, ...otherProps };
10490
};
10591

0 commit comments

Comments
 (0)