@@ -157,6 +157,32 @@ function resolveSheetInitialDetentIndex(
157
157
return index ;
158
158
}
159
159
160
+ function transformEdgeToEdgeProps ( props : ScreenProps ) : ScreenProps {
161
+ const {
162
+ // Filter out edge-to-edge related props
163
+ statusBarColor,
164
+ statusBarTranslucent,
165
+ navigationBarColor,
166
+ navigationBarTranslucent,
167
+ ...rest
168
+ } = props ;
169
+
170
+ if ( __DEV__ ) {
171
+ controlEdgeToEdgeValues ( {
172
+ statusBarColor,
173
+ statusBarTranslucent,
174
+ navigationBarColor,
175
+ navigationBarTranslucent,
176
+ } ) ;
177
+ }
178
+
179
+ return {
180
+ ...rest ,
181
+ statusBarTranslucent : true ,
182
+ navigationBarTranslucent : true ,
183
+ } ;
184
+ }
185
+
160
186
function isIndexInClosedRange (
161
187
value : number ,
162
188
lowerBound : number ,
@@ -184,13 +210,6 @@ export const InnerScreen = React.forwardRef<View, ScreenProps>(
184
210
enabled = screensEnabled ( ) ,
185
211
freezeOnBlur = freezeEnabled ( ) ,
186
212
shouldFreeze,
187
-
188
- // edge-to-edge related props
189
- navigationBarColor,
190
- navigationBarTranslucent,
191
- statusBarColor,
192
- statusBarTranslucent,
193
-
194
213
...rest
195
214
} = props ;
196
215
@@ -250,24 +269,6 @@ export const InnerScreen = React.forwardRef<View, ScreenProps>(
250
269
...props
251
270
} = rest ;
252
271
253
- const {
254
- // Filter out edge-to-edge related props
255
- navigationBarColor,
256
- navigationBarTranslucent,
257
- statusBarColor,
258
- statusBarTranslucent,
259
- ...edgeToEdgeFriendlyProps
260
- } = props ;
261
-
262
- if ( __DEV__ ) {
263
- controlEdgeToEdgeValues ( {
264
- navigationBarColor,
265
- navigationBarTranslucent,
266
- statusBarColor,
267
- statusBarTranslucent,
268
- } ) ;
269
- }
270
-
271
272
if ( active !== undefined && activityState === undefined ) {
272
273
console . warn (
273
274
'It appears that you are using old version of react-navigation library. Please update @react-navigation/bottom-tabs, @react-navigation/stack and @react-navigation/drawer to version 5.10.0 or above to take full advantage of new functionality added to react-native-screens' ,
@@ -310,13 +311,7 @@ export const InnerScreen = React.forwardRef<View, ScreenProps>(
310
311
return (
311
312
< DelayedFreeze freeze = { freeze } >
312
313
< AnimatedScreen
313
- { ...( EDGE_TO_EDGE
314
- ? {
315
- ...edgeToEdgeFriendlyProps ,
316
- navigationBarTranslucent : true ,
317
- statusBarTranslucent : true ,
318
- }
319
- : props ) }
314
+ { ...props }
320
315
/**
321
316
* This messy override is to conform NativeProps used by codegen and
322
317
* our Public API. To see reasoning go to this PR:
@@ -418,7 +413,12 @@ export const ScreenContext = React.createContext(InnerScreen);
418
413
const Screen = React . forwardRef < View , ScreenProps > ( ( props , ref ) => {
419
414
const ScreenWrapper = React . useContext ( ScreenContext ) || InnerScreen ;
420
415
421
- return < ScreenWrapper { ...props } ref = { ref } /> ;
416
+ return (
417
+ < ScreenWrapper
418
+ { ...( EDGE_TO_EDGE ? transformEdgeToEdgeProps ( props ) : props ) }
419
+ ref = { ref }
420
+ />
421
+ ) ;
422
422
} ) ;
423
423
424
424
Screen . displayName = 'Screen' ;
0 commit comments