Skip to content

Commit 63a4ace

Browse files
committed
map ::backdrop backgroundColor to RN modal backdropColor
1 parent fb67b50 commit 63a4ace

3 files changed

Lines changed: 22 additions & 1 deletion

File tree

packages/react-strict-dom/src/native/css/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,8 @@ export function props(
452452
// '::placeholder' polyfill
453453
else if (styleProp === 'placeholderTextColor') {
454454
nativeProps.placeholderTextColor = styleValue;
455+
} else if (styleProp === 'backdropColor') {
456+
nativeProps.backdropColor = styleValue;
455457
}
456458
// visibility polyfill
457459
// Note: we can't polyfill nested visibility changes

packages/react-strict-dom/src/native/css/processStyle.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ export function processStyle(
7979
}
8080
continue;
8181
}
82-
8382
// Object values
8483
else if (typeof styleValue === 'object' && styleValue != null) {
8584
if (propName === '::placeholder') {
@@ -97,6 +96,21 @@ export function processStyle(
9796
}
9897
}
9998
continue;
99+
} else if (propName === '::backdrop') {
100+
const backdropStyleProps = Object.keys(styleValue);
101+
for (let i = 0; i < backdropStyleProps.length; i++) {
102+
const prop = backdropStyleProps[i];
103+
if (prop === 'backgroundColor') {
104+
result['backdropColor'] = processStyle({
105+
backgroundColor: styleValue.backgroundColor
106+
}).backgroundColor;
107+
} else {
108+
if (__DEV__) {
109+
warnMsg(`unsupported "::backdrop" style property "${prop}"`);
110+
}
111+
}
112+
}
113+
continue;
100114
} else if (Object.hasOwn(styleValue, 'default')) {
101115
result[propName] = processStyle(styleValue);
102116
continue;

packages/react-strict-dom/src/types/renderer.native.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ import type {
3131
// $FlowFixMe(nonstrict-import)
3232
ViewProps
3333
} from 'react-native/Libraries/Components/View/ViewPropTypes';
34+
import type {
35+
// $FlowFixMe(nonstrict-import)
36+
ModalProps
37+
} from 'react-native/Libraries/Modal/Modal';
3438

3539
type ReactNativeProps = {
3640
accessible?: ViewProps['accessible'],
@@ -105,6 +109,7 @@ type ReactNativeProps = {
105109
onTouchMove?: ViewProps['onTouchMove'],
106110
placeholder?: TextInputProps['placeholder'],
107111
placeholderTextColor?: TextInputProps['placeholderTextColor'],
112+
backdropColor?: ModalProps['backdropColor'],
108113
pointerEvents?: ViewProps['pointerEvents'],
109114
ref?: $FlowFixMe,
110115
referrerPolicy?: ImageProps['referrerPolicy'],

0 commit comments

Comments
 (0)