@react-navigation/native-stack 7.1.4 → 7.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -275,123 +275,125 @@ const SceneView = ({
275
275
  });
276
276
 
277
277
  return (
278
- <ScreenStackItem
279
- key={route.key}
280
- screenId={route.key}
281
- activityState={isPreloaded ? 0 : 2}
282
- style={StyleSheet.absoluteFill}
283
- accessibilityElementsHidden={!focused}
284
- importantForAccessibility={focused ? 'auto' : 'no-hide-descendants'}
285
- customAnimationOnSwipe={animationMatchesGesture}
286
- fullScreenSwipeEnabled={fullScreenGestureEnabled}
287
- fullScreenSwipeShadowEnabled={fullScreenGestureShadowEnabled}
288
- freezeOnBlur={freezeOnBlur}
289
- gestureEnabled={
290
- Platform.OS === 'android'
291
- ? // This prop enables handling of system back gestures on Android
292
- // Since we handle them in JS side, we disable this
293
- false
294
- : gestureEnabled
295
- }
296
- homeIndicatorHidden={autoHideHomeIndicator}
297
- hideKeyboardOnSwipe={keyboardHandlingEnabled}
298
- navigationBarColor={navigationBarColor}
299
- navigationBarTranslucent={navigationBarTranslucent}
300
- navigationBarHidden={navigationBarHidden}
301
- replaceAnimation={animationTypeForReplace}
302
- stackPresentation={presentation === 'card' ? 'push' : presentation}
303
- stackAnimation={animation}
304
- screenOrientation={orientation}
305
- sheetAllowedDetents={sheetAllowedDetents}
306
- sheetLargestUndimmedDetentIndex={sheetLargestUndimmedDetentIndex}
307
- sheetGrabberVisible={sheetGrabberVisible}
308
- sheetInitialDetentIndex={sheetInitialDetentIndex}
309
- sheetCornerRadius={sheetCornerRadius}
310
- sheetElevation={sheetElevation}
311
- sheetExpandsWhenScrolledToEdge={sheetExpandsWhenScrolledToEdge}
312
- statusBarAnimation={statusBarAnimation}
313
- statusBarHidden={statusBarHidden}
314
- statusBarStyle={statusBarStyle}
315
- statusBarColor={statusBarBackgroundColor}
316
- statusBarTranslucent={statusBarTranslucent}
317
- swipeDirection={gestureDirectionOverride}
318
- transitionDuration={animationDuration}
319
- onWillAppear={onWillAppear}
320
- onWillDisappear={onWillDisappear}
321
- onAppear={onAppear}
322
- onDisappear={onDisappear}
323
- onDismissed={onDismissed}
324
- onGestureCancel={onGestureCancel}
325
- onSheetDetentChanged={onSheetDetentChanged}
326
- gestureResponseDistance={gestureResponseDistance}
327
- nativeBackButtonDismissalEnabled={false} // on Android
328
- onHeaderBackButtonClicked={onHeaderBackButtonClicked}
329
- preventNativeDismiss={isRemovePrevented} // on iOS
330
- onNativeDismissCancelled={onNativeDismissCancelled}
331
- // Unfortunately, because of the bug that exists on Fabric, where native event drivers
332
- // for Animated objects are being created after the first notifications about the header height
333
- // from the native side, `onHeaderHeightChange` event does not notify
334
- // `animatedHeaderHeight` about initial values on appearing screens at the moment.
335
- onHeaderHeightChange={Animated.event(
336
- [
337
- {
338
- nativeEvent: {
339
- headerHeight: rawAnimatedHeaderHeight,
340
- },
341
- },
342
- ],
343
- {
344
- useNativeDriver,
345
- listener: (e) => {
346
- if (
347
- Platform.OS === 'android' &&
348
- (options.headerBackground != null || options.headerTransparent)
349
- ) {
350
- // FIXME: On Android, we get 0 if the header is translucent
351
- // So we set a default height in that case
352
- setHeaderHeight(ANDROID_DEFAULT_HEADER_HEIGHT + topInset);
353
- return;
354
- }
355
-
356
- if (
357
- e.nativeEvent &&
358
- typeof e.nativeEvent === 'object' &&
359
- 'headerHeight' in e.nativeEvent &&
360
- typeof e.nativeEvent.headerHeight === 'number'
361
- ) {
362
- const headerHeight =
363
- e.nativeEvent.headerHeight + headerHeightCorrectionOffset;
364
-
365
- // Only debounce if header has large title or search bar
366
- // As it's the only case where the header height can change frequently
367
- const doesHeaderAnimate =
368
- Platform.OS === 'ios' &&
369
- (options.headerLargeTitle || options.headerSearchBarOptions);
370
-
371
- if (doesHeaderAnimate) {
372
- setHeaderHeightDebounced(headerHeight);
373
- } else {
374
- setHeaderHeight(headerHeight);
375
- }
278
+ <NavigationContext.Provider value={navigation}>
279
+ <NavigationRouteContext.Provider value={route}>
280
+ <ScreenStackItem
281
+ key={route.key}
282
+ screenId={route.key}
283
+ activityState={isPreloaded ? 0 : 2}
284
+ style={StyleSheet.absoluteFill}
285
+ accessibilityElementsHidden={!focused}
286
+ importantForAccessibility={focused ? 'auto' : 'no-hide-descendants'}
287
+ customAnimationOnSwipe={animationMatchesGesture}
288
+ fullScreenSwipeEnabled={fullScreenGestureEnabled}
289
+ fullScreenSwipeShadowEnabled={fullScreenGestureShadowEnabled}
290
+ freezeOnBlur={freezeOnBlur}
291
+ gestureEnabled={
292
+ Platform.OS === 'android'
293
+ ? // This prop enables handling of system back gestures on Android
294
+ // Since we handle them in JS side, we disable this
295
+ false
296
+ : gestureEnabled
297
+ }
298
+ homeIndicatorHidden={autoHideHomeIndicator}
299
+ hideKeyboardOnSwipe={keyboardHandlingEnabled}
300
+ navigationBarColor={navigationBarColor}
301
+ navigationBarTranslucent={navigationBarTranslucent}
302
+ navigationBarHidden={navigationBarHidden}
303
+ replaceAnimation={animationTypeForReplace}
304
+ stackPresentation={presentation === 'card' ? 'push' : presentation}
305
+ stackAnimation={animation}
306
+ screenOrientation={orientation}
307
+ sheetAllowedDetents={sheetAllowedDetents}
308
+ sheetLargestUndimmedDetentIndex={sheetLargestUndimmedDetentIndex}
309
+ sheetGrabberVisible={sheetGrabberVisible}
310
+ sheetInitialDetentIndex={sheetInitialDetentIndex}
311
+ sheetCornerRadius={sheetCornerRadius}
312
+ sheetElevation={sheetElevation}
313
+ sheetExpandsWhenScrolledToEdge={sheetExpandsWhenScrolledToEdge}
314
+ statusBarAnimation={statusBarAnimation}
315
+ statusBarHidden={statusBarHidden}
316
+ statusBarStyle={statusBarStyle}
317
+ statusBarColor={statusBarBackgroundColor}
318
+ statusBarTranslucent={statusBarTranslucent}
319
+ swipeDirection={gestureDirectionOverride}
320
+ transitionDuration={animationDuration}
321
+ onWillAppear={onWillAppear}
322
+ onWillDisappear={onWillDisappear}
323
+ onAppear={onAppear}
324
+ onDisappear={onDisappear}
325
+ onDismissed={onDismissed}
326
+ onGestureCancel={onGestureCancel}
327
+ onSheetDetentChanged={onSheetDetentChanged}
328
+ gestureResponseDistance={gestureResponseDistance}
329
+ nativeBackButtonDismissalEnabled={false} // on Android
330
+ onHeaderBackButtonClicked={onHeaderBackButtonClicked}
331
+ preventNativeDismiss={isRemovePrevented} // on iOS
332
+ onNativeDismissCancelled={onNativeDismissCancelled}
333
+ // Unfortunately, because of the bug that exists on Fabric, where native event drivers
334
+ // for Animated objects are being created after the first notifications about the header height
335
+ // from the native side, `onHeaderHeightChange` event does not notify
336
+ // `animatedHeaderHeight` about initial values on appearing screens at the moment.
337
+ onHeaderHeightChange={Animated.event(
338
+ [
339
+ {
340
+ nativeEvent: {
341
+ headerHeight: rawAnimatedHeaderHeight,
342
+ },
343
+ },
344
+ ],
345
+ {
346
+ useNativeDriver,
347
+ listener: (e) => {
348
+ if (
349
+ Platform.OS === 'android' &&
350
+ (options.headerBackground != null ||
351
+ options.headerTransparent)
352
+ ) {
353
+ // FIXME: On Android, we get 0 if the header is translucent
354
+ // So we set a default height in that case
355
+ setHeaderHeight(ANDROID_DEFAULT_HEADER_HEIGHT + topInset);
356
+ return;
357
+ }
358
+
359
+ if (
360
+ e.nativeEvent &&
361
+ typeof e.nativeEvent === 'object' &&
362
+ 'headerHeight' in e.nativeEvent &&
363
+ typeof e.nativeEvent.headerHeight === 'number'
364
+ ) {
365
+ const headerHeight =
366
+ e.nativeEvent.headerHeight + headerHeightCorrectionOffset;
367
+
368
+ // Only debounce if header has large title or search bar
369
+ // As it's the only case where the header height can change frequently
370
+ const doesHeaderAnimate =
371
+ Platform.OS === 'ios' &&
372
+ (options.headerLargeTitle ||
373
+ options.headerSearchBarOptions);
374
+
375
+ if (doesHeaderAnimate) {
376
+ setHeaderHeightDebounced(headerHeight);
377
+ } else {
378
+ setHeaderHeight(headerHeight);
379
+ }
380
+ }
381
+ },
376
382
  }
377
- },
378
- }
379
- )}
380
- contentStyle={[
381
- presentation !== 'transparentModal' &&
382
- presentation !== 'containedTransparentModal' && {
383
- backgroundColor: colors.background,
384
- },
385
- contentStyle,
386
- ]}
387
- headerConfig={headerConfig}
388
- unstable_sheetFooter={unstable_sheetFooter}
389
- // When ts-expect-error is added, it affects all the props below it
390
- // So we keep any props that need it at the end
391
- // Otherwise invalid props may not be caught by TypeScript
392
- >
393
- <NavigationContext.Provider value={navigation}>
394
- <NavigationRouteContext.Provider value={route}>
383
+ )}
384
+ contentStyle={[
385
+ presentation !== 'transparentModal' &&
386
+ presentation !== 'containedTransparentModal' && {
387
+ backgroundColor: colors.background,
388
+ },
389
+ contentStyle,
390
+ ]}
391
+ headerConfig={headerConfig}
392
+ unstable_sheetFooter={unstable_sheetFooter}
393
+ // When ts-expect-error is added, it affects all the props below it
394
+ // So we keep any props that need it at the end
395
+ // Otherwise invalid props may not be caught by TypeScript
396
+ >
395
397
  <AnimatedHeaderHeightContext.Provider value={animatedHeaderHeight}>
396
398
  <HeaderHeightContext.Provider
397
399
  value={
@@ -443,9 +445,9 @@ const SceneView = ({
443
445
  </HeaderShownContext.Provider>
444
446
  </HeaderHeightContext.Provider>
445
447
  </AnimatedHeaderHeightContext.Provider>
446
- </NavigationRouteContext.Provider>
447
- </NavigationContext.Provider>
448
- </ScreenStackItem>
448
+ </ScreenStackItem>
449
+ </NavigationRouteContext.Provider>
450
+ </NavigationContext.Provider>
449
451
  );
450
452
  };
451
453