Skip to content

Commit 9f58b30

Browse files
authored
Feat/ prioritize backgroundColor prop over bg modifiers (#2286)
1 parent 29e571c commit 9f58b30

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

src/components/view/index.tsx

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,18 @@ function View(props: ViewProps, ref: any) {
7373
animated,
7474
reanimated,
7575
children,
76+
backgroundColor: backgroundColorProps,
7677
...others
7778
} = themeProps;
78-
const {backgroundColor, borderRadius, paddings, margins, alignments, flexStyle, positionStyle} = useModifiers(themeProps,
79-
modifiersOptions);
79+
const {
80+
backgroundColor: backgroundColorModifiers,
81+
borderRadius,
82+
paddings,
83+
margins,
84+
alignments,
85+
flexStyle,
86+
positionStyle
87+
} = useModifiers(themeProps, modifiersOptions);
8088
const [ready, setReady] = useState(!renderDelay);
8189

8290
useEffect(() => {
@@ -101,6 +109,7 @@ function View(props: ViewProps, ref: any) {
101109
}, [useSafeArea, animated, reanimated]);
102110

103111
const _style = useMemo(() => {
112+
const backgroundColor = backgroundColorProps || backgroundColorModifiers;
104113
return [
105114
backgroundColor && {
106115
backgroundColor
@@ -115,7 +124,17 @@ function View(props: ViewProps, ref: any) {
115124
alignments,
116125
style
117126
];
118-
}, [backgroundColor, borderRadius, flexStyle, positionStyle, paddings, margins, alignments, style]);
127+
}, [
128+
backgroundColorProps,
129+
backgroundColorModifiers,
130+
borderRadius,
131+
flexStyle,
132+
positionStyle,
133+
paddings,
134+
margins,
135+
alignments,
136+
style
137+
]);
119138

120139
if (!ready) {
121140
return null;

0 commit comments

Comments
 (0)