@react-navigation/stack 6.3.3 → 6.3.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.
Files changed (88) hide show
  1. package/lib/commonjs/TransitionConfigs/CardStyleInterpolators.js +1 -1
  2. package/lib/commonjs/TransitionConfigs/CardStyleInterpolators.js.map +1 -1
  3. package/lib/commonjs/TransitionConfigs/HeaderStyleInterpolators.js.map +1 -1
  4. package/lib/commonjs/TransitionConfigs/TransitionPresets.js.map +1 -1
  5. package/lib/commonjs/TransitionConfigs/TransitionSpecs.js.map +1 -1
  6. package/lib/commonjs/index.js.map +1 -1
  7. package/lib/commonjs/navigators/createStackNavigator.js +1 -1
  8. package/lib/commonjs/navigators/createStackNavigator.js.map +1 -1
  9. package/lib/commonjs/types.js.map +1 -1
  10. package/lib/commonjs/utils/CardAnimationContext.js.map +1 -1
  11. package/lib/commonjs/utils/GestureHandlerRefContext.js.map +1 -1
  12. package/lib/commonjs/utils/ModalPresentationContext.js.map +1 -1
  13. package/lib/commonjs/utils/conditional.js.map +1 -1
  14. package/lib/commonjs/utils/debounce.js.map +1 -1
  15. package/lib/commonjs/utils/getDistanceForDirection.js.map +1 -1
  16. package/lib/commonjs/utils/getInvertedMultiplier.js.map +1 -1
  17. package/lib/commonjs/utils/memoize.js.map +1 -1
  18. package/lib/commonjs/utils/useCardAnimation.js.map +1 -1
  19. package/lib/commonjs/utils/useGestureHandlerRef.js.map +1 -1
  20. package/lib/commonjs/utils/useKeyboardManager.js.map +1 -1
  21. package/lib/commonjs/views/GestureHandler.android.js.map +1 -1
  22. package/lib/commonjs/views/GestureHandler.ios.js.map +1 -1
  23. package/lib/commonjs/views/GestureHandler.js.map +1 -1
  24. package/lib/commonjs/views/GestureHandlerNative.js +1 -1
  25. package/lib/commonjs/views/GestureHandlerNative.js.map +1 -1
  26. package/lib/commonjs/views/Header/Header.js +1 -1
  27. package/lib/commonjs/views/Header/Header.js.map +1 -1
  28. package/lib/commonjs/views/Header/HeaderContainer.js.map +1 -1
  29. package/lib/commonjs/views/Header/HeaderSegment.js +1 -1
  30. package/lib/commonjs/views/Header/HeaderSegment.js.map +1 -1
  31. package/lib/commonjs/views/ModalStatusBarManager.js.map +1 -1
  32. package/lib/commonjs/views/Screens.js +1 -1
  33. package/lib/commonjs/views/Screens.js.map +1 -1
  34. package/lib/commonjs/views/Stack/Card.js +5 -7
  35. package/lib/commonjs/views/Stack/Card.js.map +1 -1
  36. package/lib/commonjs/views/Stack/CardContainer.js.map +1 -1
  37. package/lib/commonjs/views/Stack/CardSheet.js +11 -3
  38. package/lib/commonjs/views/Stack/CardSheet.js.map +1 -1
  39. package/lib/commonjs/views/Stack/CardStack.js.map +1 -1
  40. package/lib/commonjs/views/Stack/StackView.js +1 -1
  41. package/lib/commonjs/views/Stack/StackView.js.map +1 -1
  42. package/lib/module/TransitionConfigs/CardStyleInterpolators.js +1 -1
  43. package/lib/module/TransitionConfigs/CardStyleInterpolators.js.map +1 -1
  44. package/lib/module/TransitionConfigs/HeaderStyleInterpolators.js.map +1 -1
  45. package/lib/module/TransitionConfigs/TransitionPresets.js.map +1 -1
  46. package/lib/module/TransitionConfigs/TransitionSpecs.js.map +1 -1
  47. package/lib/module/index.js.map +1 -1
  48. package/lib/module/navigators/createStackNavigator.js +1 -1
  49. package/lib/module/navigators/createStackNavigator.js.map +1 -1
  50. package/lib/module/types.js.map +1 -1
  51. package/lib/module/utils/CardAnimationContext.js.map +1 -1
  52. package/lib/module/utils/GestureHandlerRefContext.js.map +1 -1
  53. package/lib/module/utils/ModalPresentationContext.js.map +1 -1
  54. package/lib/module/utils/conditional.js.map +1 -1
  55. package/lib/module/utils/debounce.js.map +1 -1
  56. package/lib/module/utils/getDistanceForDirection.js.map +1 -1
  57. package/lib/module/utils/getInvertedMultiplier.js.map +1 -1
  58. package/lib/module/utils/memoize.js.map +1 -1
  59. package/lib/module/utils/useCardAnimation.js.map +1 -1
  60. package/lib/module/utils/useGestureHandlerRef.js.map +1 -1
  61. package/lib/module/utils/useKeyboardManager.js.map +1 -1
  62. package/lib/module/views/GestureHandler.android.js.map +1 -1
  63. package/lib/module/views/GestureHandler.ios.js.map +1 -1
  64. package/lib/module/views/GestureHandler.js.map +1 -1
  65. package/lib/module/views/GestureHandlerNative.js +1 -1
  66. package/lib/module/views/GestureHandlerNative.js.map +1 -1
  67. package/lib/module/views/Header/Header.js +1 -1
  68. package/lib/module/views/Header/Header.js.map +1 -1
  69. package/lib/module/views/Header/HeaderContainer.js.map +1 -1
  70. package/lib/module/views/Header/HeaderSegment.js +1 -1
  71. package/lib/module/views/Header/HeaderSegment.js.map +1 -1
  72. package/lib/module/views/ModalStatusBarManager.js.map +1 -1
  73. package/lib/module/views/Screens.js +1 -1
  74. package/lib/module/views/Screens.js.map +1 -1
  75. package/lib/module/views/Stack/Card.js +5 -7
  76. package/lib/module/views/Stack/Card.js.map +1 -1
  77. package/lib/module/views/Stack/CardContainer.js.map +1 -1
  78. package/lib/module/views/Stack/CardSheet.js +11 -3
  79. package/lib/module/views/Stack/CardSheet.js.map +1 -1
  80. package/lib/module/views/Stack/CardStack.js.map +1 -1
  81. package/lib/module/views/Stack/StackView.js +1 -1
  82. package/lib/module/views/Stack/StackView.js.map +1 -1
  83. package/lib/typescript/src/views/Stack/Card.d.ts +1 -1
  84. package/lib/typescript/src/views/Stack/CardSheet.d.ts +5 -2
  85. package/package.json +5 -5
  86. package/src/TransitionConfigs/CardStyleInterpolators.tsx +1 -1
  87. package/src/views/Stack/Card.tsx +4 -4
  88. package/src/views/Stack/CardSheet.tsx +14 -2
@@ -1 +1 @@
1
- {"version":3,"sources":["StackView.tsx"],"names":["HeaderShownContext","SafeAreaProviderCompat","StackActions","React","StyleSheet","View","SafeAreaInsetsContext","ModalPresentationContext","GestureHandlerRootView","HeaderContainer","CardStack","GestureHandlerWrapper","isArrayEqual","a","b","length","every","it","index","StackView","Component","routes","previousRoutes","previousDescriptors","openingRouteKeys","closingRouteKeys","replacingRouteKeys","descriptors","route","state","filter","r","key","includes","findIndex","descriptor","props","render","navigation","some","routeNames","name","navigate","setState","dispatch","pop","source","target","closing","emit","type","data","getDerivedStateFromProps","map","reduce","acc","slice","previousFocusedRoute","nextFocusedRoute","isAnimationEnabled","options","animationEnabled","getAnimationTypeForReplace","animationTypeForReplace","splice","Error","_","rest","styles","container","insets","isParentModal","isParentHeaderShown","getPreviousRoute","handleOpenRoute","handleCloseRoute","handleTransitionStart","handleTransitionEnd","renderHeader","renderScene","handleGestureStart","handleGestureEnd","handleGestureCancel","create","flex"],"mappings":";;;;AAAA,SACEA,kBADF,EAEEC,sBAFF,QAGO,4BAHP;AAIA,SAGEC,YAHF,QAKO,0BALP;AAMA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAASC,UAAT,EAAqBC,IAArB,QAAiC,cAAjC;AACA,SAEEC,qBAFF,QAGO,gCAHP;AAUA,OAAOC,wBAAP,MAAqC,sCAArC;AACA,SAASC,sBAAT,QAAuC,mBAAvC;AACA,OAAOC,eAAP,MAEO,2BAFP;AAGA,OAAOC,SAAP,MAAsB,aAAtB;AA0BA,MAAMC,qBAAqB,GAAGH,sBAAH,aAAGA,sBAAH,cAAGA,sBAAH,GAA6BH,IAAxD;AAEA;AACA;AACA;AACA;;AACA,MAAMO,YAAY,GAAG,CAACC,CAAD,EAAWC,CAAX,KACnBD,CAAC,CAACE,MAAF,KAAaD,CAAC,CAACC,MAAf,IAAyBF,CAAC,CAACG,KAAF,CAAQ,CAACC,EAAD,EAAKC,KAAL,KAAeD,EAAE,KAAKH,CAAC,CAACI,KAAD,CAA/B,CAD3B;;AAGA,eAAe,MAAMC,SAAN,SAAwBhB,KAAK,CAACiB,SAA9B,CAAsD;AAAA;AAAA;;AAAA,mCAyNpD;AACbC,MAAAA,MAAM,EAAE,EADK;AAEbC,MAAAA,cAAc,EAAE,EAFH;AAGbC,MAAAA,mBAAmB,EAAE,EAHR;AAIbC,MAAAA,gBAAgB,EAAE,EAJL;AAKbC,M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":["import {\n HeaderShownContext,\n SafeAreaProviderCompat,\n} from '@react-navigation/elements';\nimport {\n ParamListBase,\n Route,\n StackActions,\n StackNavigationState,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport { StyleSheet, View } from 'react-native';\nimport {\n EdgeInsets,\n SafeAreaInsetsContext,\n} from 'react-native-safe-area-context';\n\nimport type {\n StackDescriptorMap,\n StackNavigationConfig,\n StackNavigationHelpers,\n} from '../../types';\nimport ModalPresentationContext from '../../utils/ModalPresentationContext';\nimport { GestureHandlerRootView } from '../GestureHandler';\nimport HeaderContainer, {\n Props as HeaderContainerProps,\n} from '../Header/HeaderContainer';\nimport CardStack from './CardStack';\n\ntype Props = StackNavigationConfig & {\n state: StackNavigationState<ParamListBase>;\n navigation: StackNavigationHelpers;\n descriptors: StackDescriptorMap;\n};\n\ntype State = {\n // Local copy of the routes which are actually rendered\n routes: Route<string>[];\n // Previous routes, to compare whether routes have changed or not\n previousRoutes: Route<string>[];\n // Previous descriptors, to compare whether descriptors have changed or not\n previousDescriptors: StackDescriptorMap;\n // List of routes being opened, we need to animate pushing of these new routes\n openingRouteKeys: string[];\n // List of routes being closed, we need to animate popping of these routes\n closingRouteKeys: string[];\n // List of routes being replaced, we need to keep a copy until the new route animates in\n replacingRouteKeys: string[];\n // Since the local routes can vary from the routes from props, we need to keep the descriptors for old routes\n // Otherwise we won't be able to access the options for routes that were removed\n descriptors: StackDescriptorMap;\n};\n\nconst GestureHandlerWrapper = GestureHandlerRootView ?? View;\n\n/**\n * Compare two arrays with primitive values as the content.\n * We need to make sure that both values and order match.\n */\nconst isArrayEqual = (a: any[], b: any[]) =>\n a.length === b.length && a.every((it, index) => it === b[index]);\n\nexport default class StackView extends React.Component<Props, State> {\n static getDerivedStateFromProps(\n props: Readonly<Props>,\n state: Readonly<State>\n ) {\n // If there was no change in routes, we don't need to compute anything\n if (\n (props.state.routes === state.previousRoutes ||\n isArrayEqual(\n props.state.routes.map((r) => r.key),\n state.previousRoutes.map((r) => r.key)\n )) &&\n state.routes.length\n ) {\n let routes = state.routes;\n let previousRoutes = state.previousRoutes;\n let descriptors = props.descriptors;\n let previousDescriptors = state.previousDescriptors;\n\n if (props.descriptors !== state.previousDescriptors) {\n descriptors = state.routes.reduce<StackDescriptorMap>((acc, route) => {\n acc[route.key] =\n props.descriptors[route.key] || state.descriptors[route.key];\n\n return acc;\n }, {});\n\n previousDescriptors = props.descriptors;\n }\n\n if (props.state.routes !== state.previousRoutes) {\n // if any route objects have changed, we should update them\n const map = props.state.routes.reduce<Record<string, Route<string>>>(\n (acc, route) => {\n acc[route.key] = route;\n return acc;\n },\n {}\n );\n\n routes = state.routes.map((route) => map[route.key] || route);\n previousRoutes = props.state.routes;\n }\n\n return {\n routes,\n previousRoutes,\n descriptors,\n previousDescriptors,\n };\n }\n\n // Here we determine which routes were added or removed to animate them\n // We keep a copy of the route being removed in local state to be able to animate it\n\n let routes =\n props.state.index < props.state.routes.length - 1\n ? // Remove any extra routes from the state\n // The last visible route should be the focused route, i.e. at current index\n props.state.routes.slice(0, props.state.index + 1)\n : props.state.routes;\n\n // Now we need to determine which routes were added and removed\n let {\n openingRouteKeys,\n closingRouteKeys,\n replacingRouteKeys,\n previousRoutes,\n } = state;\n\n const previousFocusedRoute = previousRoutes[previousRoutes.length - 1] as\n | Route<string>\n | undefined;\n const nextFocusedRoute = routes[routes.length - 1];\n\n const isAnimationEnabled = (key: string) => {\n const descriptor = props.descriptors[key] || state.descriptors[key];\n\n return descriptor ? descriptor.options.animationEnabled !== false : true;\n };\n\n const getAnimationTypeForReplace = (key: string) => {\n const descriptor = props.descriptors[key] || state.descriptors[key];\n\n return descriptor.options.animationTypeForReplace ?? 'push';\n };\n\n if (\n previousFocusedRoute &&\n previousFocusedRoute.key !== nextFocusedRoute.key\n ) {\n // We only need to animate routes if the focused route changed\n // Animating previous routes won't be visible coz the focused route is on top of everything\n\n if (!previousRoutes.some((r) => r.key === nextFocusedRoute.key)) {\n // A new route has come to the focus, we treat this as a push\n // A replace can also trigger this, the animation should look like push\n\n if (\n isAnimationEnabled(nextFocusedRoute.key) &&\n !openingRouteKeys.includes(nextFocusedRoute.key)\n ) {\n // In this case, we need to animate pushing the focused route\n // We don't care about animating any other added routes because they won't be visible\n openingRouteKeys = [...openingRouteKeys, nextFocusedRoute.key];\n\n closingRouteKeys = closingRouteKeys.filter(\n (key) => key !== nextFocusedRoute.key\n );\n replacingRouteKeys = replacingRouteKeys.filter(\n (key) => key !== nextFocusedRoute.key\n );\n\n if (!routes.some((r) => r.key === previousFocusedRoute.key)) {\n // The previous focused route isn't present in state, we treat this as a replace\n\n openingRouteKeys = openingRouteKeys.filter(\n (key) => key !== previousFocusedRoute.key\n );\n\n if (getAnimationTypeForReplace(nextFocusedRoute.key) === 'pop') {\n closingRouteKeys = [\n ...closingRouteKeys,\n previousFocusedRoute.key,\n ];\n\n // By default, new routes have a push animation, so we add it to `openingRouteKeys` before\n // But since user configured it to animate the old screen like a pop, we need to add this without animation\n // So remove it from `openingRouteKeys` which will remove the animation\n openingRouteKeys = openingRouteKeys.filter(\n (key) => key !== nextFocusedRoute.key\n );\n\n // Keep the route being removed at the end to animate it out\n routes = [...routes, previousFocusedRoute];\n } else {\n replacingRouteKeys = [\n ...replacingRouteKeys,\n previousFocusedRoute.key,\n ];\n\n closingRouteKeys = closingRouteKeys.filter(\n (key) => key !== previousFocusedRoute.key\n );\n\n // Keep the old route in the state because it's visible under the new route, and removing it will feel abrupt\n // We need to insert it just before the focused one (the route being pushed)\n // After the push animation is completed, routes being replaced will be removed completely\n routes = routes.slice();\n routes.splice(routes.length - 1, 0, previousFocusedRoute);\n }\n }\n }\n } else if (!routes.some((r) => r.key === previousFocusedRoute.key)) {\n // The previously focused route was removed, we treat this as a pop\n\n if (\n isAnimationEnabled(previousFocusedRoute.key) &&\n !closingRouteKeys.includes(previousFocusedRoute.key)\n ) {\n closingRouteKeys = [...closingRouteKeys, previousFocusedRoute.key];\n\n // Sometimes a route can be closed before the opening animation finishes\n // So we also need to remove it from the opening list\n openingRouteKeys = openingRouteKeys.filter(\n (key) => key !== previousFocusedRoute.key\n );\n replacingRouteKeys = replacingRouteKeys.filter(\n (key) => key !== previousFocusedRoute.key\n );\n\n // Keep a copy of route being removed in the state to be able to animate it\n routes = [...routes, previousFocusedRoute];\n }\n } else {\n // Looks like some routes were re-arranged and no focused routes were added/removed\n // i.e. the currently focused route already existed and the previously focused route still exists\n // We don't know how to animate this\n }\n } else if (replacingRouteKeys.length || closingRouteKeys.length) {\n // Keep the routes we are closing or replacing if animation is enabled for them\n routes = routes.slice();\n routes.splice(\n routes.length - 1,\n 0,\n ...state.routes.filter(({ key }) =>\n isAnimationEnabled(key)\n ? replacingRouteKeys.includes(key) || closingRouteKeys.includes(key)\n : false\n )\n );\n }\n\n if (!routes.length) {\n throw new Error(\n 'There should always be at least one route in the navigation state.'\n );\n }\n\n const descriptors = routes.reduce<StackDescriptorMap>((acc, route) => {\n acc[route.key] =\n props.descriptors[route.key] || state.descriptors[route.key];\n\n return acc;\n }, {});\n\n return {\n routes,\n previousRoutes: props.state.routes,\n previousDescriptors: props.descriptors,\n openingRouteKeys,\n closingRouteKeys,\n replacingRouteKeys,\n descriptors,\n };\n }\n\n state: State = {\n routes: [],\n previousRoutes: [],\n previousDescriptors: {},\n openingRouteKeys: [],\n closingRouteKeys: [],\n replacingRouteKeys: [],\n descriptors: {},\n };\n\n private getPreviousRoute = ({ route }: { route: Route<string> }) => {\n const { closingRouteKeys, replacingRouteKeys } = this.state;\n const routes = this.state.routes.filter(\n (r) =>\n r.key === route.key ||\n (!closingRouteKeys.includes(r.key) &&\n !replacingRouteKeys.includes(r.key))\n );\n\n const index = routes.findIndex((r) => r.key === route.key);\n\n return routes[index - 1];\n };\n\n private renderScene = ({ route }: { route: Route<string> }) => {\n const descriptor =\n this.state.descriptors[route.key] || this.props.descriptors[route.key];\n\n if (!descriptor) {\n return null;\n }\n\n return descriptor.render();\n };\n\n private renderHeader = (props: HeaderContainerProps) => {\n return <HeaderContainer {...props} />;\n };\n\n private handleOpenRoute = ({ route }: { route: Route<string> }) => {\n const { state, navigation } = this.props;\n const { closingRouteKeys, replacingRouteKeys } = this.state;\n\n if (\n closingRouteKeys.some((key) => key === route.key) &&\n replacingRouteKeys.every((key) => key !== route.key) &&\n state.routeNames.includes(route.name) &&\n !state.routes.some((r) => r.key === route.key)\n ) {\n // If route isn't present in current state, but was closing, assume that a close animation was cancelled\n // So we need to add this route back to the state\n navigation.navigate(route);\n } else {\n this.setState((state) => ({\n routes: state.replacingRouteKeys.length\n ? state.routes.filter(\n (r) => !state.replacingRouteKeys.includes(r.key)\n )\n : state.routes,\n openingRouteKeys: state.openingRouteKeys.filter(\n (key) => key !== route.key\n ),\n closingRouteKeys: state.closingRouteKeys.filter(\n (key) => key !== route.key\n ),\n replacingRouteKeys: [],\n }));\n }\n };\n\n private handleCloseRoute = ({ route }: { route: Route<string> }) => {\n const { state, navigation } = this.props;\n\n if (state.routes.some((r) => r.key === route.key)) {\n // If a route exists in state, trigger a pop\n // This will happen in when the route was closed from the card component\n // e.g. When the close animation triggered from a gesture ends\n navigation.dispatch({\n ...StackActions.pop(),\n source: route.key,\n target: state.key,\n });\n } else {\n // We need to clean up any state tracking the route and pop it immediately\n this.setState((state) => ({\n routes: state.routes.filter((r) => r.key !== route.key),\n openingRouteKeys: state.openingRouteKeys.filter(\n (key) => key !== route.key\n ),\n closingRouteKeys: state.closingRouteKeys.filter(\n (key) => key !== route.key\n ),\n }));\n }\n };\n\n private handleTransitionStart = (\n { route }: { route: Route<string> },\n closing: boolean\n ) =>\n this.props.navigation.emit({\n type: 'transitionStart',\n data: { closing },\n target: route.key,\n });\n\n private handleTransitionEnd = (\n { route }: { route: Route<string> },\n closing: boolean\n ) =>\n this.props.navigation.emit({\n type: 'transitionEnd',\n data: { closing },\n target: route.key,\n });\n\n private handleGestureStart = ({ route }: { route: Route<string> }) => {\n this.props.navigation.emit({\n type: 'gestureStart',\n target: route.key,\n });\n };\n\n private handleGestureEnd = ({ route }: { route: Route<string> }) => {\n this.props.navigation.emit({\n type: 'gestureEnd',\n target: route.key,\n });\n };\n\n private handleGestureCancel = ({ route }: { route: Route<string> }) => {\n this.props.navigation.emit({\n type: 'gestureCancel',\n target: route.key,\n });\n };\n\n render() {\n const {\n state,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n descriptors: _,\n ...rest\n } = this.props;\n\n const { routes, descriptors, openingRouteKeys, closingRouteKeys } =\n this.state;\n\n return (\n <GestureHandlerWrapper style={styles.container}>\n <SafeAreaProviderCompat>\n <SafeAreaInsetsContext.Consumer>\n {(insets) => (\n <ModalPresentationContext.Consumer>\n {(isParentModal) => (\n <HeaderShownContext.Consumer>\n {(isParentHeaderShown) => (\n <CardStack\n insets={insets as EdgeInsets}\n isParentHeaderShown={isParentHeaderShown}\n isParentModal={isParentModal}\n getPreviousRoute={this.getPreviousRoute}\n routes={routes}\n openingRouteKeys={openingRouteKeys}\n closingRouteKeys={closingRouteKeys}\n onOpenRoute={this.handleOpenRoute}\n onCloseRoute={this.handleCloseRoute}\n onTransitionStart={this.handleTransitionStart}\n onTransitionEnd={this.handleTransitionEnd}\n renderHeader={this.renderHeader}\n renderScene={this.renderScene}\n state={state}\n descriptors={descriptors}\n onGestureStart={this.handleGestureStart}\n onGestureEnd={this.handleGestureEnd}\n onGestureCancel={this.handleGestureCancel}\n {...rest}\n />\n )}\n </HeaderShownContext.Consumer>\n )}\n </ModalPresentationContext.Consumer>\n )}\n </SafeAreaInsetsContext.Consumer>\n </SafeAreaProviderCompat>\n </GestureHandlerWrapper>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n});\n"]}
1
+ {"version":3,"names":["HeaderShownContext","SafeAreaProviderCompat","StackActions","React","StyleSheet","View","SafeAreaInsetsContext","ModalPresentationContext","GestureHandlerRootView","HeaderContainer","CardStack","GestureHandlerWrapper","isArrayEqual","a","b","length","every","it","index","StackView","Component","routes","previousRoutes","previousDescriptors","openingRouteKeys","closingRouteKeys","replacingRouteKeys","descriptors","route","state","filter","r","key","includes","findIndex","descriptor","props","render","navigation","some","routeNames","name","navigate","setState","dispatch","pop","source","target","closing","emit","type","data","getDerivedStateFromProps","map","reduce","acc","slice","previousFocusedRoute","nextFocusedRoute","isAnimationEnabled","options","animationEnabled","getAnimationTypeForReplace","animationTypeForReplace","splice","Error","_","rest","styles","container","insets","isParentModal","isParentHeaderShown","getPreviousRoute","handleOpenRoute","handleCloseRoute","handleTransitionStart","handleTransitionEnd","renderHeader","renderScene","handleGestureStart","handleGestureEnd","handleGestureCancel","create","flex"],"sources":["StackView.tsx"],"sourcesContent":["import {\n HeaderShownContext,\n SafeAreaProviderCompat,\n} from '@react-navigation/elements';\nimport {\n ParamListBase,\n Route,\n StackActions,\n StackNavigationState,\n} from '@react-navigation/native';\nimport * as React from 'react';\nimport { StyleSheet, View } from 'react-native';\nimport {\n EdgeInsets,\n SafeAreaInsetsContext,\n} from 'react-native-safe-area-context';\n\nimport type {\n StackDescriptorMap,\n StackNavigationConfig,\n StackNavigationHelpers,\n} from '../../types';\nimport ModalPresentationContext from '../../utils/ModalPresentationContext';\nimport { GestureHandlerRootView } from '../GestureHandler';\nimport HeaderContainer, {\n Props as HeaderContainerProps,\n} from '../Header/HeaderContainer';\nimport CardStack from './CardStack';\n\ntype Props = StackNavigationConfig & {\n state: StackNavigationState<ParamListBase>;\n navigation: StackNavigationHelpers;\n descriptors: StackDescriptorMap;\n};\n\ntype State = {\n // Local copy of the routes which are actually rendered\n routes: Route<string>[];\n // Previous routes, to compare whether routes have changed or not\n previousRoutes: Route<string>[];\n // Previous descriptors, to compare whether descriptors have changed or not\n previousDescriptors: StackDescriptorMap;\n // List of routes being opened, we need to animate pushing of these new routes\n openingRouteKeys: string[];\n // List of routes being closed, we need to animate popping of these routes\n closingRouteKeys: string[];\n // List of routes being replaced, we need to keep a copy until the new route animates in\n replacingRouteKeys: string[];\n // Since the local routes can vary from the routes from props, we need to keep the descriptors for old routes\n // Otherwise we won't be able to access the options for routes that were removed\n descriptors: StackDescriptorMap;\n};\n\nconst GestureHandlerWrapper = GestureHandlerRootView ?? View;\n\n/**\n * Compare two arrays with primitive values as the content.\n * We need to make sure that both values and order match.\n */\nconst isArrayEqual = (a: any[], b: any[]) =>\n a.length === b.length && a.every((it, index) => it === b[index]);\n\nexport default class StackView extends React.Component<Props, State> {\n static getDerivedStateFromProps(\n props: Readonly<Props>,\n state: Readonly<State>\n ) {\n // If there was no change in routes, we don't need to compute anything\n if (\n (props.state.routes === state.previousRoutes ||\n isArrayEqual(\n props.state.routes.map((r) => r.key),\n state.previousRoutes.map((r) => r.key)\n )) &&\n state.routes.length\n ) {\n let routes = state.routes;\n let previousRoutes = state.previousRoutes;\n let descriptors = props.descriptors;\n let previousDescriptors = state.previousDescriptors;\n\n if (props.descriptors !== state.previousDescriptors) {\n descriptors = state.routes.reduce<StackDescriptorMap>((acc, route) => {\n acc[route.key] =\n props.descriptors[route.key] || state.descriptors[route.key];\n\n return acc;\n }, {});\n\n previousDescriptors = props.descriptors;\n }\n\n if (props.state.routes !== state.previousRoutes) {\n // if any route objects have changed, we should update them\n const map = props.state.routes.reduce<Record<string, Route<string>>>(\n (acc, route) => {\n acc[route.key] = route;\n return acc;\n },\n {}\n );\n\n routes = state.routes.map((route) => map[route.key] || route);\n previousRoutes = props.state.routes;\n }\n\n return {\n routes,\n previousRoutes,\n descriptors,\n previousDescriptors,\n };\n }\n\n // Here we determine which routes were added or removed to animate them\n // We keep a copy of the route being removed in local state to be able to animate it\n\n let routes =\n props.state.index < props.state.routes.length - 1\n ? // Remove any extra routes from the state\n // The last visible route should be the focused route, i.e. at current index\n props.state.routes.slice(0, props.state.index + 1)\n : props.state.routes;\n\n // Now we need to determine which routes were added and removed\n let {\n openingRouteKeys,\n closingRouteKeys,\n replacingRouteKeys,\n previousRoutes,\n } = state;\n\n const previousFocusedRoute = previousRoutes[previousRoutes.length - 1] as\n | Route<string>\n | undefined;\n const nextFocusedRoute = routes[routes.length - 1];\n\n const isAnimationEnabled = (key: string) => {\n const descriptor = props.descriptors[key] || state.descriptors[key];\n\n return descriptor ? descriptor.options.animationEnabled !== false : true;\n };\n\n const getAnimationTypeForReplace = (key: string) => {\n const descriptor = props.descriptors[key] || state.descriptors[key];\n\n return descriptor.options.animationTypeForReplace ?? 'push';\n };\n\n if (\n previousFocusedRoute &&\n previousFocusedRoute.key !== nextFocusedRoute.key\n ) {\n // We only need to animate routes if the focused route changed\n // Animating previous routes won't be visible coz the focused route is on top of everything\n\n if (!previousRoutes.some((r) => r.key === nextFocusedRoute.key)) {\n // A new route has come to the focus, we treat this as a push\n // A replace can also trigger this, the animation should look like push\n\n if (\n isAnimationEnabled(nextFocusedRoute.key) &&\n !openingRouteKeys.includes(nextFocusedRoute.key)\n ) {\n // In this case, we need to animate pushing the focused route\n // We don't care about animating any other added routes because they won't be visible\n openingRouteKeys = [...openingRouteKeys, nextFocusedRoute.key];\n\n closingRouteKeys = closingRouteKeys.filter(\n (key) => key !== nextFocusedRoute.key\n );\n replacingRouteKeys = replacingRouteKeys.filter(\n (key) => key !== nextFocusedRoute.key\n );\n\n if (!routes.some((r) => r.key === previousFocusedRoute.key)) {\n // The previous focused route isn't present in state, we treat this as a replace\n\n openingRouteKeys = openingRouteKeys.filter(\n (key) => key !== previousFocusedRoute.key\n );\n\n if (getAnimationTypeForReplace(nextFocusedRoute.key) === 'pop') {\n closingRouteKeys = [\n ...closingRouteKeys,\n previousFocusedRoute.key,\n ];\n\n // By default, new routes have a push animation, so we add it to `openingRouteKeys` before\n // But since user configured it to animate the old screen like a pop, we need to add this without animation\n // So remove it from `openingRouteKeys` which will remove the animation\n openingRouteKeys = openingRouteKeys.filter(\n (key) => key !== nextFocusedRoute.key\n );\n\n // Keep the route being removed at the end to animate it out\n routes = [...routes, previousFocusedRoute];\n } else {\n replacingRouteKeys = [\n ...replacingRouteKeys,\n previousFocusedRoute.key,\n ];\n\n closingRouteKeys = closingRouteKeys.filter(\n (key) => key !== previousFocusedRoute.key\n );\n\n // Keep the old route in the state because it's visible under the new route, and removing it will feel abrupt\n // We need to insert it just before the focused one (the route being pushed)\n // After the push animation is completed, routes being replaced will be removed completely\n routes = routes.slice();\n routes.splice(routes.length - 1, 0, previousFocusedRoute);\n }\n }\n }\n } else if (!routes.some((r) => r.key === previousFocusedRoute.key)) {\n // The previously focused route was removed, we treat this as a pop\n\n if (\n isAnimationEnabled(previousFocusedRoute.key) &&\n !closingRouteKeys.includes(previousFocusedRoute.key)\n ) {\n closingRouteKeys = [...closingRouteKeys, previousFocusedRoute.key];\n\n // Sometimes a route can be closed before the opening animation finishes\n // So we also need to remove it from the opening list\n openingRouteKeys = openingRouteKeys.filter(\n (key) => key !== previousFocusedRoute.key\n );\n replacingRouteKeys = replacingRouteKeys.filter(\n (key) => key !== previousFocusedRoute.key\n );\n\n // Keep a copy of route being removed in the state to be able to animate it\n routes = [...routes, previousFocusedRoute];\n }\n } else {\n // Looks like some routes were re-arranged and no focused routes were added/removed\n // i.e. the currently focused route already existed and the previously focused route still exists\n // We don't know how to animate this\n }\n } else if (replacingRouteKeys.length || closingRouteKeys.length) {\n // Keep the routes we are closing or replacing if animation is enabled for them\n routes = routes.slice();\n routes.splice(\n routes.length - 1,\n 0,\n ...state.routes.filter(({ key }) =>\n isAnimationEnabled(key)\n ? replacingRouteKeys.includes(key) || closingRouteKeys.includes(key)\n : false\n )\n );\n }\n\n if (!routes.length) {\n throw new Error(\n 'There should always be at least one route in the navigation state.'\n );\n }\n\n const descriptors = routes.reduce<StackDescriptorMap>((acc, route) => {\n acc[route.key] =\n props.descriptors[route.key] || state.descriptors[route.key];\n\n return acc;\n }, {});\n\n return {\n routes,\n previousRoutes: props.state.routes,\n previousDescriptors: props.descriptors,\n openingRouteKeys,\n closingRouteKeys,\n replacingRouteKeys,\n descriptors,\n };\n }\n\n state: State = {\n routes: [],\n previousRoutes: [],\n previousDescriptors: {},\n openingRouteKeys: [],\n closingRouteKeys: [],\n replacingRouteKeys: [],\n descriptors: {},\n };\n\n private getPreviousRoute = ({ route }: { route: Route<string> }) => {\n const { closingRouteKeys, replacingRouteKeys } = this.state;\n const routes = this.state.routes.filter(\n (r) =>\n r.key === route.key ||\n (!closingRouteKeys.includes(r.key) &&\n !replacingRouteKeys.includes(r.key))\n );\n\n const index = routes.findIndex((r) => r.key === route.key);\n\n return routes[index - 1];\n };\n\n private renderScene = ({ route }: { route: Route<string> }) => {\n const descriptor =\n this.state.descriptors[route.key] || this.props.descriptors[route.key];\n\n if (!descriptor) {\n return null;\n }\n\n return descriptor.render();\n };\n\n private renderHeader = (props: HeaderContainerProps) => {\n return <HeaderContainer {...props} />;\n };\n\n private handleOpenRoute = ({ route }: { route: Route<string> }) => {\n const { state, navigation } = this.props;\n const { closingRouteKeys, replacingRouteKeys } = this.state;\n\n if (\n closingRouteKeys.some((key) => key === route.key) &&\n replacingRouteKeys.every((key) => key !== route.key) &&\n state.routeNames.includes(route.name) &&\n !state.routes.some((r) => r.key === route.key)\n ) {\n // If route isn't present in current state, but was closing, assume that a close animation was cancelled\n // So we need to add this route back to the state\n navigation.navigate(route);\n } else {\n this.setState((state) => ({\n routes: state.replacingRouteKeys.length\n ? state.routes.filter(\n (r) => !state.replacingRouteKeys.includes(r.key)\n )\n : state.routes,\n openingRouteKeys: state.openingRouteKeys.filter(\n (key) => key !== route.key\n ),\n closingRouteKeys: state.closingRouteKeys.filter(\n (key) => key !== route.key\n ),\n replacingRouteKeys: [],\n }));\n }\n };\n\n private handleCloseRoute = ({ route }: { route: Route<string> }) => {\n const { state, navigation } = this.props;\n\n if (state.routes.some((r) => r.key === route.key)) {\n // If a route exists in state, trigger a pop\n // This will happen in when the route was closed from the card component\n // e.g. When the close animation triggered from a gesture ends\n navigation.dispatch({\n ...StackActions.pop(),\n source: route.key,\n target: state.key,\n });\n } else {\n // We need to clean up any state tracking the route and pop it immediately\n this.setState((state) => ({\n routes: state.routes.filter((r) => r.key !== route.key),\n openingRouteKeys: state.openingRouteKeys.filter(\n (key) => key !== route.key\n ),\n closingRouteKeys: state.closingRouteKeys.filter(\n (key) => key !== route.key\n ),\n }));\n }\n };\n\n private handleTransitionStart = (\n { route }: { route: Route<string> },\n closing: boolean\n ) =>\n this.props.navigation.emit({\n type: 'transitionStart',\n data: { closing },\n target: route.key,\n });\n\n private handleTransitionEnd = (\n { route }: { route: Route<string> },\n closing: boolean\n ) =>\n this.props.navigation.emit({\n type: 'transitionEnd',\n data: { closing },\n target: route.key,\n });\n\n private handleGestureStart = ({ route }: { route: Route<string> }) => {\n this.props.navigation.emit({\n type: 'gestureStart',\n target: route.key,\n });\n };\n\n private handleGestureEnd = ({ route }: { route: Route<string> }) => {\n this.props.navigation.emit({\n type: 'gestureEnd',\n target: route.key,\n });\n };\n\n private handleGestureCancel = ({ route }: { route: Route<string> }) => {\n this.props.navigation.emit({\n type: 'gestureCancel',\n target: route.key,\n });\n };\n\n render() {\n const {\n state,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n descriptors: _,\n ...rest\n } = this.props;\n\n const { routes, descriptors, openingRouteKeys, closingRouteKeys } =\n this.state;\n\n return (\n <GestureHandlerWrapper style={styles.container}>\n <SafeAreaProviderCompat>\n <SafeAreaInsetsContext.Consumer>\n {(insets) => (\n <ModalPresentationContext.Consumer>\n {(isParentModal) => (\n <HeaderShownContext.Consumer>\n {(isParentHeaderShown) => (\n <CardStack\n insets={insets as EdgeInsets}\n isParentHeaderShown={isParentHeaderShown}\n isParentModal={isParentModal}\n getPreviousRoute={this.getPreviousRoute}\n routes={routes}\n openingRouteKeys={openingRouteKeys}\n closingRouteKeys={closingRouteKeys}\n onOpenRoute={this.handleOpenRoute}\n onCloseRoute={this.handleCloseRoute}\n onTransitionStart={this.handleTransitionStart}\n onTransitionEnd={this.handleTransitionEnd}\n renderHeader={this.renderHeader}\n renderScene={this.renderScene}\n state={state}\n descriptors={descriptors}\n onGestureStart={this.handleGestureStart}\n onGestureEnd={this.handleGestureEnd}\n onGestureCancel={this.handleGestureCancel}\n {...rest}\n />\n )}\n </HeaderShownContext.Consumer>\n )}\n </ModalPresentationContext.Consumer>\n )}\n </SafeAreaInsetsContext.Consumer>\n </SafeAreaProviderCompat>\n </GestureHandlerWrapper>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n});\n"],"mappings":";;;;AAAA,SACEA,kBADF,EAEEC,sBAFF,QAGO,4BAHP;AAIA,SAGEC,YAHF,QAKO,0BALP;AAMA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAASC,UAAT,EAAqBC,IAArB,QAAiC,cAAjC;AACA,SAEEC,qBAFF,QAGO,gCAHP;AAUA,OAAOC,wBAAP,MAAqC,sCAArC;AACA,SAASC,sBAAT,QAAuC,mBAAvC;AACA,OAAOC,eAAP,MAEO,2BAFP;AAGA,OAAOC,SAAP,MAAsB,aAAtB;AA0BA,MAAMC,qBAAqB,GAAGH,sBAAH,aAAGA,sBAAH,cAAGA,sBAAH,GAA6BH,IAAxD;AAEA;AACA;AACA;AACA;;AACA,MAAMO,YAAY,GAAG,CAACC,CAAD,EAAWC,CAAX,KACnBD,CAAC,CAACE,MAAF,KAAaD,CAAC,CAACC,MAAf,IAAyBF,CAAC,CAACG,KAAF,CAAQ,CAACC,EAAD,EAAKC,KAAL,KAAeD,EAAE,KAAKH,CAAC,CAACI,KAAD,CAA/B,CAD3B;;AAGA,eAAe,MAAMC,SAAN,SAAwBhB,KAAK,CAACiB,SAA9B,CAAsD;EAAA;IAAA;;IAAA,+BAyNpD;MACbC,MAAM,EAAE,EADK;MAEbC,cAAc,EAAE,EAFH;MAGbC,mBAAmB,EAAE,EAHR;MAIbC,gBAAgB,EAAE,EAJL;MAKbC,gBAAgB,EAAE,EALL;MAMbC,kBAAkB,EAAE,EANP;MAObC,WAAW,EAAE;IAPA,CAzNoD;;IAAA,0CAmOxC,QAAyC;MAAA,IAAxC;QAAEC;MAAF,CAAwC;MAClE,MAAM;QAAEH,gBAAF;QAAoBC;MAApB,IAA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,KAAKC,gBAjBrB;MAkBE,eAAe,EAAE,KAAKC;IAlBxB,GAmBMf,IAnBN,EAFJ,CAFJ,CAFJ,CADF,CADF,CADF;EAuCD;;AApZkE;AAuZrE,MAAMC,MAAM,GAAGhE,UAAU,CAAC+E,MAAX,CAAkB;EAC/Bd,SAAS,EAAE;IACTe,IAAI,EAAE;EADG;AADoB,CAAlB,CAAf"}
@@ -68,7 +68,7 @@ export default class Card extends React.Component<Props> {
68
68
  private getInterpolatedStyle;
69
69
  private getCardAnimation;
70
70
  private gestureActivationCriteria;
71
- private contentRef;
71
+ private ref;
72
72
  render(): JSX.Element;
73
73
  }
74
74
  export declare const getIsModalPresentation: (cardStyleInterpolator: StackCardStyleInterpolator) => boolean;
@@ -1,5 +1,8 @@
1
1
  import * as React from 'react';
2
- import { View, ViewProps } from 'react-native';
2
+ import { ViewProps } from 'react-native';
3
+ export declare type CardSheetRef = {
4
+ setPointerEvents: React.Dispatch<ViewProps['pointerEvents']>;
5
+ };
3
6
  declare const _default: React.ForwardRefExoticComponent<ViewProps & {
4
7
  enabled: boolean;
5
8
  layout: {
@@ -7,5 +10,5 @@ declare const _default: React.ForwardRefExoticComponent<ViewProps & {
7
10
  height: number;
8
11
  };
9
12
  children: React.ReactNode;
10
- } & React.RefAttributes<View>>;
13
+ } & React.RefAttributes<CardSheetRef>>;
11
14
  export default _default;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@react-navigation/stack",
3
3
  "description": "Stack navigator component for iOS and Android with animated transitions and gestures",
4
- "version": "6.3.3",
4
+ "version": "6.3.5",
5
5
  "keywords": [
6
6
  "react-native-component",
7
7
  "react-component",
@@ -40,13 +40,13 @@
40
40
  "clean": "del lib"
41
41
  },
42
42
  "dependencies": {
43
- "@react-navigation/elements": "^1.3.6",
43
+ "@react-navigation/elements": "^1.3.7",
44
44
  "color": "^4.2.3",
45
45
  "warn-once": "^0.1.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@react-navigation/native": "^6.0.13",
49
- "@testing-library/react-native": "^7.2.0",
48
+ "@react-navigation/native": "^6.0.14",
49
+ "@testing-library/react-native": "^11.5.0",
50
50
  "@types/color": "^3.0.1",
51
51
  "@types/react": "~18.0.0",
52
52
  "@types/react-native": "~0.69.1",
@@ -81,5 +81,5 @@
81
81
  ]
82
82
  ]
83
83
  },
84
- "gitHead": "d7032ba8bb6ae24030a47f0724b61b561132fca6"
84
+ "gitHead": "92f9f265d2627a3ef5b3890042d59405ff38401e"
85
85
  }
@@ -101,7 +101,7 @@ export function forModalPresentationIOS({
101
101
  const hasNotchIos =
102
102
  Platform.OS === 'ios' &&
103
103
  !Platform.isPad &&
104
- !Platform.isTVOS &&
104
+ !Platform.isTV &&
105
105
  insets.top > 20;
106
106
  const isLandscape = screen.width > screen.height;
107
107
  const topOffset = isLandscape ? 0 : 10;
@@ -30,7 +30,7 @@ import {
30
30
  PanGestureHandlerGestureEvent,
31
31
  } from '../GestureHandler';
32
32
  import ModalStatusBarManager from '../ModalStatusBarManager';
33
- import CardSheet from './CardSheet';
33
+ import CardSheet, { CardSheetRef } from './CardSheet';
34
34
 
35
35
  type Props = ViewProps & {
36
36
  interpolationIndex: number;
@@ -242,7 +242,7 @@ export default class Card extends React.Component<Props> {
242
242
  private setPointerEventsEnabled = (enabled: boolean) => {
243
243
  const pointerEvents = enabled ? 'box-none' : 'none';
244
244
 
245
- this.contentRef.current?.setNativeProps({ pointerEvents });
245
+ this.ref.current?.setPointerEvents(pointerEvents);
246
246
  };
247
247
 
248
248
  private handleStartInteraction = () => {
@@ -425,7 +425,7 @@ export default class Card extends React.Component<Props> {
425
425
  }
426
426
  }
427
427
 
428
- private contentRef = React.createRef<View>();
428
+ private ref = React.createRef<CardSheetRef>();
429
429
 
430
430
  render() {
431
431
  const {
@@ -555,7 +555,7 @@ export default class Card extends React.Component<Props> {
555
555
  />
556
556
  ) : null}
557
557
  <CardSheet
558
- ref={this.contentRef}
558
+ ref={this.ref}
559
559
  enabled={pageOverflowEnabled}
560
560
  layout={layout}
561
561
  style={contentStyle}
@@ -7,15 +7,27 @@ type Props = ViewProps & {
7
7
  children: React.ReactNode;
8
8
  };
9
9
 
10
+ export type CardSheetRef = {
11
+ setPointerEvents: React.Dispatch<ViewProps['pointerEvents']>;
12
+ };
13
+
10
14
  // This component will render a page which overflows the screen
11
15
  // if the container fills the body by comparing the size
12
16
  // This lets the document.body handle scrolling of the content
13
17
  // It's necessary for mobile browsers to be able to hide address bar on scroll
14
- export default React.forwardRef<View, Props>(function CardSheet(
18
+ export default React.forwardRef<CardSheetRef, Props>(function CardSheet(
15
19
  { enabled, layout, style, ...rest },
16
20
  ref
17
21
  ) {
18
22
  const [fill, setFill] = React.useState(false);
23
+ // To avoid triggering a rerender in Card during animation we had to move
24
+ // the state to CardSheet. The `setPointerEvents` is then hoisted back to the Card.
25
+ const [pointerEvents, setPointerEvents] =
26
+ React.useState<ViewProps['pointerEvents']>('auto');
27
+
28
+ React.useImperativeHandle(ref, () => {
29
+ return { setPointerEvents };
30
+ });
19
31
 
20
32
  React.useEffect(() => {
21
33
  if (typeof document === 'undefined' || !document.body) {
@@ -32,7 +44,7 @@ export default React.forwardRef<View, Props>(function CardSheet(
32
44
  return (
33
45
  <View
34
46
  {...rest}
35
- ref={ref}
47
+ pointerEvents={pointerEvents}
36
48
  style={[enabled && fill ? styles.page : styles.card, style]}
37
49
  />
38
50
  );