@react-navigation/stack 6.0.8 → 6.1.0

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 (79) hide show
  1. package/lib/commonjs/TransitionConfigs/CardStyleInterpolators.js +72 -64
  2. package/lib/commonjs/TransitionConfigs/CardStyleInterpolators.js.map +1 -1
  3. package/lib/commonjs/TransitionConfigs/HeaderStyleInterpolators.js +37 -32
  4. package/lib/commonjs/TransitionConfigs/HeaderStyleInterpolators.js.map +1 -1
  5. package/lib/commonjs/TransitionConfigs/TransitionPresets.js +1 -1
  6. package/lib/commonjs/TransitionConfigs/TransitionSpecs.js +1 -1
  7. package/lib/commonjs/index.js +13 -11
  8. package/lib/commonjs/index.js.map +1 -1
  9. package/lib/commonjs/navigators/createStackNavigator.js +8 -7
  10. package/lib/commonjs/navigators/createStackNavigator.js.map +1 -1
  11. package/lib/commonjs/utils/debounce.js +5 -1
  12. package/lib/commonjs/utils/debounce.js.map +1 -1
  13. package/lib/commonjs/utils/memoize.js +5 -1
  14. package/lib/commonjs/utils/memoize.js.map +1 -1
  15. package/lib/commonjs/views/GestureHandler.js +7 -4
  16. package/lib/commonjs/views/GestureHandler.js.map +1 -1
  17. package/lib/commonjs/views/GestureHandlerNative.js +1 -1
  18. package/lib/commonjs/views/Header/Header.js +10 -9
  19. package/lib/commonjs/views/Header/Header.js.map +1 -1
  20. package/lib/commonjs/views/Header/HeaderContainer.js +10 -9
  21. package/lib/commonjs/views/Header/HeaderContainer.js.map +1 -1
  22. package/lib/commonjs/views/Header/HeaderSegment.js +5 -0
  23. package/lib/commonjs/views/Header/HeaderSegment.js.map +1 -1
  24. package/lib/commonjs/views/ModalStatusBarManager.js +11 -9
  25. package/lib/commonjs/views/ModalStatusBarManager.js.map +1 -1
  26. package/lib/commonjs/views/Screens.js +14 -10
  27. package/lib/commonjs/views/Screens.js.map +1 -1
  28. package/lib/commonjs/views/Stack/Card.js +32 -24
  29. package/lib/commonjs/views/Stack/Card.js.map +1 -1
  30. package/lib/commonjs/views/Stack/CardContainer.js +43 -40
  31. package/lib/commonjs/views/Stack/CardContainer.js.map +1 -1
  32. package/lib/commonjs/views/Stack/CardSheet.js +7 -6
  33. package/lib/commonjs/views/Stack/CardSheet.js.map +1 -1
  34. package/lib/commonjs/views/Stack/CardStack.js +19 -11
  35. package/lib/commonjs/views/Stack/CardStack.js.map +1 -1
  36. package/lib/commonjs/views/Stack/StackView.js +62 -46
  37. package/lib/commonjs/views/Stack/StackView.js.map +1 -1
  38. package/lib/module/TransitionConfigs/CardStyleInterpolators.js +67 -59
  39. package/lib/module/TransitionConfigs/CardStyleInterpolators.js.map +1 -1
  40. package/lib/module/TransitionConfigs/HeaderStyleInterpolators.js +35 -30
  41. package/lib/module/TransitionConfigs/HeaderStyleInterpolators.js.map +1 -1
  42. package/lib/module/index.js.map +1 -1
  43. package/lib/module/navigators/createStackNavigator.js +8 -7
  44. package/lib/module/navigators/createStackNavigator.js.map +1 -1
  45. package/lib/module/utils/debounce.js +5 -1
  46. package/lib/module/utils/debounce.js.map +1 -1
  47. package/lib/module/utils/memoize.js +5 -1
  48. package/lib/module/utils/memoize.js.map +1 -1
  49. package/lib/module/views/GestureHandler.js +6 -3
  50. package/lib/module/views/GestureHandler.js.map +1 -1
  51. package/lib/module/views/Header/Header.js +10 -9
  52. package/lib/module/views/Header/Header.js.map +1 -1
  53. package/lib/module/views/Header/HeaderContainer.js +10 -9
  54. package/lib/module/views/Header/HeaderContainer.js.map +1 -1
  55. package/lib/module/views/Header/HeaderSegment.js +5 -0
  56. package/lib/module/views/Header/HeaderSegment.js.map +1 -1
  57. package/lib/module/views/ModalStatusBarManager.js +11 -9
  58. package/lib/module/views/ModalStatusBarManager.js.map +1 -1
  59. package/lib/module/views/Screens.js +13 -9
  60. package/lib/module/views/Screens.js.map +1 -1
  61. package/lib/module/views/Stack/Card.js +32 -24
  62. package/lib/module/views/Stack/Card.js.map +1 -1
  63. package/lib/module/views/Stack/CardContainer.js +43 -40
  64. package/lib/module/views/Stack/CardContainer.js.map +1 -1
  65. package/lib/module/views/Stack/CardSheet.js +7 -6
  66. package/lib/module/views/Stack/CardSheet.js.map +1 -1
  67. package/lib/module/views/Stack/CardStack.js +19 -11
  68. package/lib/module/views/Stack/CardStack.js.map +1 -1
  69. package/lib/module/views/Stack/StackView.js +62 -46
  70. package/lib/module/views/Stack/StackView.js.map +1 -1
  71. package/lib/typescript/src/index.d.ts +1 -1
  72. package/lib/typescript/src/types.d.ts +6 -2
  73. package/package.json +9 -9
  74. package/src/index.tsx +1 -0
  75. package/src/types.tsx +6 -1
  76. package/src/views/Header/HeaderSegment.tsx +16 -4
  77. package/src/views/Stack/Card.tsx +1 -1
  78. package/src/views/Stack/CardContainer.tsx +3 -2
  79. package/src/views/Stack/CardStack.tsx +6 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["CardStack.tsx"],"names":["EPSILON","STATE_INACTIVE","STATE_TRANSITIONING_OR_BELOW_TOP","STATE_ON_TOP","FALLBACK_DESCRIPTOR","Object","freeze","options","getInterpolationIndex","scenes","index","cardStyleInterpolator","descriptor","interpolationIndex","i","cardStyleInterpolatorCurrent","getIsModal","scene","isParentModal","isModalPresentation","isModal","getHeaderHeights","insets","isParentHeaderShown","layout","previous","reduce","acc","curr","headerStatusBarHeight","top","headerStyle","style","StyleSheet","flatten","height","route","key","getDistanceFromOptions","presentation","gestureDirection","ModalTransition","DefaultTransition","getProgressFromGesture","gesture","distance","width","Math","max","interpolate","inputRange","outputRange","CardStack","React","Component","getDerivedStateFromProps","props","state","routes","descriptors","gestures","animationEnabled","Animated","Value","openingRouteKeys","includes","map","self","previousRoute","nextRoute","oldScene","currentGesture","previousGesture","undefined","nextGesture","nextDescriptor","previousDescriptor","optionsForTransitionConfig","length","defaultTransitionPreset","ModalFadeTransition","Platform","OS","gestureEnabled","transitionSpec","forNoAnimationCard","headerStyleInterpolator","cardOverlayEnabled","headerMode","header","progress","current","next","__memo","every","it","headerHeights","constructor","e","nativeEvent","setState","previousHeight","getPreviousRoute","previousScene","find","SafeAreaProviderCompat","initialMetrics","frame","render","closingRouteKeys","onOpenRoute","onCloseRoute","renderHeader","renderScene","onTransitionStart","onTransitionEnd","onGestureStart","onGestureEnd","onGestureCancel","detachInactiveScreens","focusedRoute","focusedHeaderHeight","isFloatHeaderAbsolute","slice","some","headerTransparent","headerShown","activeScreensLimit","detachPreviousScreen","lastIndexOf","forModalPresentationIOS","floatingHeader","mode","getPreviousScene","getFocusedRoute","onContentHeightChange","handleHeaderLayout","styles","floating","absolute","container","handleLayout","focused","isScreenActive","sceneForActivity","outputValue","extrapolate","headerTintColor","safeAreaInsetTop","safeAreaInsetRight","right","safeAreaInsetBottom","bottom","safeAreaInsetLeft","left","headerHeight","backgroundColor","headerBackgroundColor","headerDarkContent","isDark","isNextScreenTransparent","detachCurrentScreen","absoluteFill","create","flex","position","zIndex"],"mappings":";;;;;;;AAAA;;AAUA;;AACA;;AACA;;AAQA;;AAIA;;AAaA;;AAEA;;AACA;;AACA;;;;;;;;;;AA0CA,MAAMA,OAAO,GAAG,IAAhB;AAEA,MAAMC,cAAc,GAAG,CAAvB;AACA,MAAMC,gCAAgC,GAAG,CAAzC;AACA,MAAMC,YAAY,GAAG,CAArB;AAEA,MAAMC,mBAAmB,GAAGC,MAAM,CAACC,MAAP,CAAc;AAAEC,EAAAA,OAAO,EAAE;AAAX,CAAd,CAA5B;;AAEA,MAAMC,qBAAqB,GAAG,CAACC,MAAD,EAAkBC,KAAlB,KAAoC;AAChE,QAAM;AAAEC,IAAAA;AAAF,MAA4BF,MAAM,CAACC,KAAD,CAAN,CAAcE,UAAd,CAAyBL,OAA3D,CADgE,CAGhE;;AACA,MAAIM,kBAAkB,GAAG,CAAzB;;AAEA,OAAK,IAAIC,CAAC,GAAGJ,KAAK,GAAG,CAArB,EAAwBI,CAAC,IAAI,CAA7B,EAAgCA,CAAC,EAAjC,EAAqC;AAAA;;AACnC,UAAMC,4BAA4B,gBAChCN,MA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AAE,KAAKH,gBApBzB;AAqBE,QAAA,eAAe,EAAE,KAAKC,eArBxB;AAsBE,QAAA,iBAAiB,EAAEwB,iBAtBrB;AAuBE,QAAA,sBAAsB,EACpBpC,qBAAqB,IAAI,CAACG,iBAxB9B;AA0BE,QAAA,YAAY,EAAEb,YA1BhB;AA2BE,QAAA,WAAW,EAAEC,WA3Bf;AA4BE,QAAA,WAAW,EAAEH,WA5Bf;AA6BE,QAAA,YAAY,EAAEC,YA7BhB;AA8BE,QAAA,iBAAiB,EAAEG,iBA9BrB;AA+BE,QAAA,eAAe,EAAEC,eA/BnB;AAgCE,QAAA,uBAAuB,EAAE6C,uBAhC3B;AAiCE,QAAA,mBAAmB,EAAEC;AAjCvB,QAPF,CADF;AA6CD,KAxHA,CALH,CAFF,EAiIGvC,qBAAqB,GAAGS,cAAH,GAAoB,IAjI5C,CADF;AAqID;;AAxekE;;;;AA2erE,MAAMM,MAAM,GAAGxG,wBAAWkI,MAAX,CAAkB;AAC/BvB,EAAAA,SAAS,EAAE;AACTwB,IAAAA,IAAI,EAAE;AADG,GADoB;AAI/BzB,EAAAA,QAAQ,EAAE;AACR0B,IAAAA,QAAQ,EAAE,UADF;AAERvI,IAAAA,GAAG,EAAE,CAFG;AAGR4H,IAAAA,IAAI,EAAE,CAHE;AAIRJ,IAAAA,KAAK,EAAE;AAJC,GAJqB;AAU/BZ,EAAAA,QAAQ,EAAE;AACR4B,IAAAA,MAAM,EAAE;AADA;AAVqB,CAAlB,CAAf","sourcesContent":["import {\n Background,\n getDefaultHeaderHeight,\n SafeAreaProviderCompat,\n} from '@react-navigation/elements';\nimport type {\n ParamListBase,\n Route,\n StackNavigationState,\n} from '@react-navigation/native';\nimport Color from 'color';\nimport * as React from 'react';\nimport {\n Animated,\n LayoutChangeEvent,\n Platform,\n StyleSheet,\n} from 'react-native';\nimport type { EdgeInsets } from 'react-native-safe-area-context';\n\nimport {\n forModalPresentationIOS,\n forNoAnimation as forNoAnimationCard,\n} from '../../TransitionConfigs/CardStyleInterpolators';\nimport {\n DefaultTransition,\n ModalFadeTransition,\n ModalTransition,\n} from '../../TransitionConfigs/TransitionPresets';\nimport type {\n Layout,\n Scene,\n StackDescriptor,\n StackDescriptorMap,\n StackHeaderMode,\n StackNavigationOptions,\n} from '../../types';\nimport getDistanceForDirection from '../../utils/getDistanceForDirection';\nimport type { Props as HeaderContainerProps } from '../Header/HeaderContainer';\nimport { MaybeScreen, MaybeScreenContainer } from '../Screens';\nimport { getIsModalPresentation } from './Card';\nimport CardContainer from './CardContainer';\n\ntype GestureValues = {\n [key: string]: Animated.Value;\n};\n\ntype Props = {\n insets: EdgeInsets;\n state: StackNavigationState<ParamListBase>;\n descriptors: StackDescriptorMap;\n routes: Route<string>[];\n openingRouteKeys: string[];\n closingRouteKeys: string[];\n onOpenRoute: (props: { route: Route<string> }) => void;\n onCloseRoute: (props: { route: Route<string> }) => void;\n getPreviousRoute: (props: {\n route: Route<string>;\n }) => Route<string> | undefined;\n renderHeader: (props: HeaderContainerProps) => React.ReactNode;\n renderScene: (props: { route: Route<string> }) => React.ReactNode;\n isParentHeaderShown: boolean;\n isParentModal: boolean;\n onTransitionStart: (\n props: { route: Route<string> },\n closing: boolean\n ) => void;\n onTransitionEnd: (props: { route: Route<string> }, closing: boolean) => void;\n onGestureStart: (props: { route: Route<string> }) => void;\n onGestureEnd: (props: { route: Route<string> }) => void;\n onGestureCancel: (props: { route: Route<string> }) => void;\n detachInactiveScreens?: boolean;\n};\n\ntype State = {\n routes: Route<string>[];\n descriptors: StackDescriptorMap;\n scenes: Scene[];\n gestures: GestureValues;\n layout: Layout;\n headerHeights: Record<string, number>;\n};\n\nconst EPSILON = 0.01;\n\nconst STATE_INACTIVE = 0;\nconst STATE_TRANSITIONING_OR_BELOW_TOP = 1;\nconst STATE_ON_TOP = 2;\n\nconst FALLBACK_DESCRIPTOR = Object.freeze({ options: {} });\n\nconst getInterpolationIndex = (scenes: Scene[], index: number) => {\n const { cardStyleInterpolator } = scenes[index].descriptor.options;\n\n // Start from current card and count backwards the number of cards with same interpolation\n let interpolationIndex = 0;\n\n for (let i = index - 1; i >= 0; i--) {\n const cardStyleInterpolatorCurrent =\n scenes[i]?.descriptor.options.cardStyleInterpolator;\n\n if (cardStyleInterpolatorCurrent !== cardStyleInterpolator) {\n break;\n }\n\n interpolationIndex++;\n }\n\n return interpolationIndex;\n};\n\nconst getIsModal = (\n scene: Scene,\n interpolationIndex: number,\n isParentModal: boolean\n) => {\n if (isParentModal) {\n return true;\n }\n\n const { cardStyleInterpolator } = scene.descriptor.options;\n const isModalPresentation = getIsModalPresentation(cardStyleInterpolator);\n const isModal = isModalPresentation && interpolationIndex !== 0;\n\n return isModal;\n};\n\nconst getHeaderHeights = (\n scenes: Scene[],\n insets: EdgeInsets,\n isParentHeaderShown: boolean,\n isParentModal: boolean,\n layout: Layout,\n previous: Record<string, number>\n) => {\n return scenes.reduce<Record<string, number>>((acc, curr, index) => {\n const {\n headerStatusBarHeight = isParentHeaderShown ? 0 : insets.top,\n headerStyle,\n } = curr.descriptor.options;\n\n const style = StyleSheet.flatten(headerStyle || {});\n\n const height =\n typeof style.height === 'number'\n ? style.height\n : previous[curr.route.key];\n\n const interpolationIndex = getInterpolationIndex(scenes, index);\n const isModal = getIsModal(curr, interpolationIndex, isParentModal);\n\n acc[curr.route.key] =\n typeof height === 'number'\n ? height\n : getDefaultHeaderHeight(layout, isModal, headerStatusBarHeight);\n\n return acc;\n }, {});\n};\n\nconst getDistanceFromOptions = (\n layout: Layout,\n descriptor?: StackDescriptor\n) => {\n const {\n presentation,\n gestureDirection = presentation === 'modal'\n ? ModalTransition.gestureDirection\n : DefaultTransition.gestureDirection,\n } = (descriptor?.options || {}) as StackNavigationOptions;\n\n return getDistanceForDirection(layout, gestureDirection);\n};\n\nconst getProgressFromGesture = (\n gesture: Animated.Value,\n layout: Layout,\n descriptor?: StackDescriptor\n) => {\n const distance = getDistanceFromOptions(\n {\n // Make sure that we have a non-zero distance, otherwise there will be incorrect progress\n // This causes blank screen on web if it was previously inside container with display: none\n width: Math.max(1, layout.width),\n height: Math.max(1, layout.height),\n },\n descriptor\n );\n\n if (distance > 0) {\n return gesture.interpolate({\n inputRange: [0, distance],\n outputRange: [1, 0],\n });\n }\n\n return gesture.interpolate({\n inputRange: [distance, 0],\n outputRange: [0, 1],\n });\n};\n\nexport default class CardStack extends React.Component<Props, State> {\n static getDerivedStateFromProps(\n props: Props,\n state: State\n ): Partial<State> | null {\n if (\n props.routes === state.routes &&\n props.descriptors === state.descriptors\n ) {\n return null;\n }\n\n const gestures = props.routes.reduce<GestureValues>((acc, curr) => {\n const descriptor = props.descriptors[curr.key];\n const { animationEnabled } = descriptor?.options || {};\n\n acc[curr.key] =\n state.gestures[curr.key] ||\n new Animated.Value(\n props.openingRouteKeys.includes(curr.key) &&\n animationEnabled !== false\n ? getDistanceFromOptions(state.layout, descriptor)\n : 0\n );\n\n return acc;\n }, {});\n\n const scenes = props.routes.map((route, index, self) => {\n const previousRoute = self[index - 1];\n const nextRoute = self[index + 1];\n\n const oldScene = state.scenes[index];\n\n const currentGesture = gestures[route.key];\n const previousGesture = previousRoute\n ? gestures[previousRoute.key]\n : undefined;\n const nextGesture = nextRoute ? gestures[nextRoute.key] : undefined;\n\n const descriptor =\n props.descriptors[route.key] ||\n state.descriptors[route.key] ||\n (oldScene ? oldScene.descriptor : FALLBACK_DESCRIPTOR);\n\n const nextDescriptor =\n props.descriptors[nextRoute?.key] || state.descriptors[nextRoute?.key];\n\n const previousDescriptor =\n props.descriptors[previousRoute?.key] ||\n state.descriptors[previousRoute?.key];\n\n // When a screen is not the last, it should use next screen's transition config\n // Many transitions also animate the previous screen, so using 2 different transitions doesn't look right\n // For example combining a slide and a modal transition would look wrong otherwise\n // With this approach, combining different transition styles in the same navigator mostly looks right\n // This will still be broken when 2 transitions have different idle state (e.g. modal presentation),\n // but majority of the transitions look alright\n const optionsForTransitionConfig =\n index !== self.length - 1 &&\n nextDescriptor &&\n nextDescriptor.options.presentation !== 'transparentModal'\n ? nextDescriptor.options\n : descriptor.options;\n\n let defaultTransitionPreset =\n optionsForTransitionConfig.presentation === 'modal'\n ? ModalTransition\n : optionsForTransitionConfig.presentation === 'transparentModal'\n ? ModalFadeTransition\n : DefaultTransition;\n\n const {\n animationEnabled = Platform.OS !== 'web' &&\n Platform.OS !== 'windows' &&\n Platform.OS !== 'macos',\n gestureEnabled = Platform.OS === 'ios' && animationEnabled,\n gestureDirection = defaultTransitionPreset.gestureDirection,\n transitionSpec = defaultTransitionPreset.transitionSpec,\n cardStyleInterpolator = animationEnabled === false\n ? forNoAnimationCard\n : defaultTransitionPreset.cardStyleInterpolator,\n headerStyleInterpolator = defaultTransitionPreset.headerStyleInterpolator,\n cardOverlayEnabled = (Platform.OS !== 'ios' &&\n optionsForTransitionConfig.presentation !== 'transparentModal') ||\n getIsModalPresentation(cardStyleInterpolator),\n } = optionsForTransitionConfig;\n\n const headerMode: StackHeaderMode =\n descriptor.options.headerMode ??\n (!(\n optionsForTransitionConfig.presentation === 'modal' ||\n optionsForTransitionConfig.presentation === 'transparentModal' ||\n nextDescriptor?.options.presentation === 'modal' ||\n nextDescriptor?.options.presentation === 'transparentModal' ||\n getIsModalPresentation(cardStyleInterpolator)\n ) &&\n Platform.OS === 'ios' &&\n descriptor.options.header === undefined\n ? 'float'\n : 'screen');\n\n const scene = {\n route,\n descriptor: {\n ...descriptor,\n options: {\n ...descriptor.options,\n animationEnabled,\n cardOverlayEnabled,\n cardStyleInterpolator,\n gestureDirection,\n gestureEnabled,\n headerStyleInterpolator,\n transitionSpec,\n headerMode,\n },\n },\n progress: {\n current: getProgressFromGesture(\n currentGesture,\n state.layout,\n descriptor\n ),\n next:\n nextGesture &&\n nextDescriptor?.options.presentation !== 'transparentModal'\n ? getProgressFromGesture(\n nextGesture,\n state.layout,\n nextDescriptor\n )\n : undefined,\n previous: previousGesture\n ? getProgressFromGesture(\n previousGesture,\n state.layout,\n previousDescriptor\n )\n : undefined,\n },\n __memo: [\n state.layout,\n descriptor,\n nextDescriptor,\n previousDescriptor,\n currentGesture,\n nextGesture,\n previousGesture,\n ],\n };\n\n if (\n oldScene &&\n scene.__memo.every((it, i) => {\n // @ts-expect-error: we haven't added __memo to the annotation to prevent usage elsewhere\n return oldScene.__memo[i] === it;\n })\n ) {\n return oldScene;\n }\n\n return scene;\n });\n\n return {\n routes: props.routes,\n scenes,\n gestures,\n descriptors: props.descriptors,\n headerHeights: getHeaderHeights(\n scenes,\n props.insets,\n props.isParentHeaderShown,\n props.isParentModal,\n state.layout,\n state.headerHeights\n ),\n };\n }\n\n constructor(props: Props) {\n super(props);\n\n this.state = {\n routes: [],\n scenes: [],\n gestures: {},\n layout: SafeAreaProviderCompat.initialMetrics.frame,\n descriptors: this.props.descriptors,\n // Used when card's header is null and mode is float to make transition\n // between screens with headers and those without headers smooth.\n // This is not a great heuristic here. We don't know synchronously\n // on mount what the header height is so we have just used the most\n // common cases here.\n headerHeights: {},\n };\n }\n\n private handleLayout = (e: LayoutChangeEvent) => {\n const { height, width } = e.nativeEvent.layout;\n\n const layout = { width, height };\n\n this.setState((state, props) => {\n if (height === state.layout.height && width === state.layout.width) {\n return null;\n }\n\n return {\n layout,\n headerHeights: getHeaderHeights(\n state.scenes,\n props.insets,\n props.isParentHeaderShown,\n props.isParentModal,\n layout,\n state.headerHeights\n ),\n };\n });\n };\n\n private handleHeaderLayout = ({\n route,\n height,\n }: {\n route: Route<string>;\n height: number;\n }) => {\n this.setState(({ headerHeights }) => {\n const previousHeight = headerHeights[route.key];\n\n if (previousHeight === height) {\n return null;\n }\n\n return {\n headerHeights: {\n ...headerHeights,\n [route.key]: height,\n },\n };\n });\n };\n\n private getFocusedRoute = () => {\n const { state } = this.props;\n\n return state.routes[state.index];\n };\n\n private getPreviousScene = ({ route }: { route: Route<string> }) => {\n const { getPreviousRoute } = this.props;\n const { scenes } = this.state;\n\n const previousRoute = getPreviousRoute({ route });\n\n if (previousRoute) {\n const previousScene = scenes.find(\n (scene) => scene.descriptor.route.key === previousRoute.key\n );\n\n return previousScene;\n }\n\n return undefined;\n };\n\n render() {\n const {\n insets,\n state,\n routes,\n closingRouteKeys,\n onOpenRoute,\n onCloseRoute,\n renderHeader,\n renderScene,\n isParentHeaderShown,\n isParentModal,\n onTransitionStart,\n onTransitionEnd,\n onGestureStart,\n onGestureEnd,\n onGestureCancel,\n detachInactiveScreens = Platform.OS === 'web' ||\n Platform.OS === 'android' ||\n Platform.OS === 'ios',\n } = this.props;\n\n const { scenes, layout, gestures, headerHeights } = this.state;\n\n const focusedRoute = state.routes[state.index];\n const focusedHeaderHeight = headerHeights[focusedRoute.key];\n\n const isFloatHeaderAbsolute = this.state.scenes.slice(-2).some((scene) => {\n const options = scene.descriptor.options ?? {};\n const { headerMode, headerTransparent, headerShown = true } = options;\n\n if (\n headerTransparent ||\n headerShown === false ||\n headerMode === 'screen'\n ) {\n return true;\n }\n\n return false;\n });\n\n let activeScreensLimit = 1;\n\n for (let i = scenes.length - 1; i >= 0; i--) {\n const { options } = scenes[i].descriptor;\n const {\n // By default, we don't want to detach the previous screen of the active one for modals\n detachPreviousScreen = options.presentation === 'transparentModal'\n ? false\n : getIsModalPresentation(options.cardStyleInterpolator)\n ? i !==\n scenes\n .map((scene) => scene.descriptor.options.cardStyleInterpolator)\n .lastIndexOf(forModalPresentationIOS)\n : true,\n } = options;\n\n if (detachPreviousScreen === false) {\n activeScreensLimit++;\n } else {\n break;\n }\n }\n\n const floatingHeader = (\n <React.Fragment key=\"header\">\n {renderHeader({\n mode: 'float',\n layout,\n scenes,\n getPreviousScene: this.getPreviousScene,\n getFocusedRoute: this.getFocusedRoute,\n onContentHeightChange: this.handleHeaderLayout,\n style: [\n styles.floating,\n isFloatHeaderAbsolute && [\n // Without this, the header buttons won't be touchable on Android when headerTransparent: true\n { height: focusedHeaderHeight },\n styles.absolute,\n ],\n ],\n })}\n </React.Fragment>\n );\n\n return (\n <Background>\n {isFloatHeaderAbsolute ? null : floatingHeader}\n <MaybeScreenContainer\n enabled={detachInactiveScreens}\n style={styles.container}\n onLayout={this.handleLayout}\n >\n {routes.map((route, index, self) => {\n const focused = focusedRoute.key === route.key;\n const gesture = gestures[route.key];\n const scene = scenes[index];\n\n // For the screens that shouldn't be active, the value is 0\n // For those that should be active, but are not the top screen, the value is 1\n // For those on top of the stack and with interaction enabled, the value is 2\n // For the old implementation, it stays the same it was\n let isScreenActive: Animated.AnimatedInterpolation | 2 | 1 | 0 = 1;\n\n if (index < self.length - activeScreensLimit - 1) {\n // screen should be inactive because it is too deep in the stack\n isScreenActive = STATE_INACTIVE;\n } else {\n const sceneForActivity = scenes[self.length - 1];\n const outputValue =\n index === self.length - 1\n ? STATE_ON_TOP // the screen is on top after the transition\n : index >= self.length - activeScreensLimit\n ? STATE_TRANSITIONING_OR_BELOW_TOP // the screen should stay active after the transition, it is not on top but is in activeLimit\n : STATE_INACTIVE; // the screen should be active only during the transition, it is at the edge of activeLimit\n isScreenActive = sceneForActivity\n ? sceneForActivity.progress.current.interpolate({\n inputRange: [0, 1 - EPSILON, 1],\n outputRange: [1, 1, outputValue],\n extrapolate: 'clamp',\n })\n : STATE_TRANSITIONING_OR_BELOW_TOP;\n }\n\n const {\n headerShown = true,\n headerTransparent,\n headerStyle,\n headerTintColor,\n } = scene.descriptor.options;\n\n const safeAreaInsetTop = insets.top;\n const safeAreaInsetRight = insets.right;\n const safeAreaInsetBottom = insets.bottom;\n const safeAreaInsetLeft = insets.left;\n\n const headerHeight =\n headerShown !== false ? headerHeights[route.key] : 0;\n\n const { backgroundColor: headerBackgroundColor } =\n StyleSheet.flatten(headerStyle) || {};\n\n let headerDarkContent: boolean | undefined;\n\n if (headerShown) {\n if (typeof headerTintColor === 'string') {\n headerDarkContent = Color(headerTintColor).isDark();\n } else if (typeof headerBackgroundColor === 'string') {\n headerDarkContent = !Color(headerBackgroundColor).isDark();\n }\n }\n\n // Start from current card and count backwards the number of cards with same interpolation\n const interpolationIndex = getInterpolationIndex(scenes, index);\n const isModal = getIsModal(\n scene,\n interpolationIndex,\n isParentModal\n );\n\n const isNextScreenTransparent =\n scenes[index + 1]?.descriptor.options.presentation ===\n 'transparentModal';\n\n const detachCurrentScreen =\n scenes[index + 1]?.descriptor.options.detachPreviousScreen !==\n false;\n\n return (\n <MaybeScreen\n key={route.key}\n style={StyleSheet.absoluteFill}\n enabled={detachInactiveScreens}\n active={isScreenActive}\n pointerEvents=\"box-none\"\n >\n <CardContainer\n index={index}\n interpolationIndex={interpolationIndex}\n modal={isModal}\n active={index === self.length - 1}\n focused={focused}\n closing={closingRouteKeys.includes(route.key)}\n layout={layout}\n gesture={gesture}\n scene={scene}\n safeAreaInsetTop={safeAreaInsetTop}\n safeAreaInsetRight={safeAreaInsetRight}\n safeAreaInsetBottom={safeAreaInsetBottom}\n safeAreaInsetLeft={safeAreaInsetLeft}\n onGestureStart={onGestureStart}\n onGestureCancel={onGestureCancel}\n onGestureEnd={onGestureEnd}\n headerHeight={headerHeight}\n isParentHeaderShown={isParentHeaderShown}\n onHeaderHeightChange={this.handleHeaderLayout}\n getPreviousScene={this.getPreviousScene}\n getFocusedRoute={this.getFocusedRoute}\n headerDarkContent={headerDarkContent}\n hasAbsoluteFloatHeader={\n isFloatHeaderAbsolute && !headerTransparent\n }\n renderHeader={renderHeader}\n renderScene={renderScene}\n onOpenRoute={onOpenRoute}\n onCloseRoute={onCloseRoute}\n onTransitionStart={onTransitionStart}\n onTransitionEnd={onTransitionEnd}\n isNextScreenTransparent={isNextScreenTransparent}\n detachCurrentScreen={detachCurrentScreen}\n />\n </MaybeScreen>\n );\n })}\n </MaybeScreenContainer>\n {isFloatHeaderAbsolute ? floatingHeader : null}\n </Background>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n absolute: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n },\n floating: {\n zIndex: 1,\n },\n});\n"]}
1
+ {"version":3,"sources":["CardStack.tsx"],"names":["EPSILON","STATE_INACTIVE","STATE_TRANSITIONING_OR_BELOW_TOP","STATE_ON_TOP","FALLBACK_DESCRIPTOR","Object","freeze","options","getInterpolationIndex","scenes","index","cardStyleInterpolator","descriptor","interpolationIndex","i","cardStyleInterpolatorCurrent","getIsModal","scene","isParentModal","isModalPresentation","isModal","getHeaderHeights","insets","isParentHeaderShown","layout","previous","reduce","acc","curr","headerStatusBarHeight","top","headerStyle","style","StyleSheet","flatten","height","route","key","getDistanceFromOptions","presentation","gestureDirection","ModalTransition","DefaultTransition","getProgressFromGesture","gesture","distance","width","Math","max","interpolate","inputRange","outputRange","CardStack","React","Component","getDerivedStateFromProps","props","state","routes","descriptors","gestures","animationEnabled","Animated","Value","openingRouteKeys","includes","map","self","previousRoute","nextRoute","oldScene","currentGesture","previousGesture","undefined","nextGesture","nextDescriptor","previousDescriptor","optionsForTransitionConfig","length","defaultTransitionPreset","ModalFadeTransition","Platform","OS","gestureEnabled","transitionSpec","forNoAnimationCard","headerStyleInterpolator","cardOverlayEnabled","headerMode","header","progress","current","next","__memo","every","it","headerHeights","constructor","e","nativeEvent","setState","previousHeight","getPreviousRoute","previousScene","find","SafeAreaProviderCompat","initialMetrics","frame","render","closingRouteKeys","onOpenRoute","onCloseRoute","renderHeader","renderScene","onTransitionStart","onTransitionEnd","onGestureStart","onGestureEnd","onGestureCancel","detachInactiveScreens","focusedRoute","focusedHeaderHeight","isFloatHeaderAbsolute","slice","some","headerTransparent","headerShown","activeScreensLimit","detachPreviousScreen","lastIndexOf","forModalPresentationIOS","floatingHeader","mode","getPreviousScene","getFocusedRoute","onContentHeightChange","handleHeaderLayout","styles","floating","absolute","container","handleLayout","focused","isScreenActive","sceneForActivity","outputValue","extrapolate","headerTintColor","safeAreaInsetTop","safeAreaInsetRight","right","safeAreaInsetBottom","bottom","safeAreaInsetLeft","left","headerHeight","backgroundColor","headerBackgroundColor","headerDarkContent","isDark","isNextScreenTransparent","detachCurrentScreen","absoluteFill","create","flex","position","zIndex"],"mappings":";;;;;;;AAAA;;AAUA;;AACA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CALH,CAFF,EAiIGvC,qBAAqB,GAAGS,cAAH,GAAoB,IAjI5C,CADF;AAqID;;AA7ekE;;;;AAgfrE,MAAMM,MAAM,GAAGxG,wBAAWkI,MAAX,CAAkB;AAC/BvB,EAAAA,SAAS,EAAE;AACTwB,IAAAA,IAAI,EAAE;AADG,GADoB;AAI/BzB,EAAAA,QAAQ,EAAE;AACR0B,IAAAA,QAAQ,EAAE,UADF;AAERvI,IAAAA,GAAG,EAAE,CAFG;AAGR4H,IAAAA,IAAI,EAAE,CAHE;AAIRJ,IAAAA,KAAK,EAAE;AAJC,GAJqB;AAU/BZ,EAAAA,QAAQ,EAAE;AACR4B,IAAAA,MAAM,EAAE;AADA;AAVqB,CAAlB,CAAf","sourcesContent":["import {\n Background,\n getDefaultHeaderHeight,\n SafeAreaProviderCompat,\n} from '@react-navigation/elements';\nimport type {\n ParamListBase,\n Route,\n StackNavigationState,\n} from '@react-navigation/native';\nimport Color from 'color';\nimport * as React from 'react';\nimport {\n Animated,\n LayoutChangeEvent,\n Platform,\n StyleSheet,\n} from 'react-native';\nimport type { EdgeInsets } from 'react-native-safe-area-context';\n\nimport {\n forModalPresentationIOS,\n forNoAnimation as forNoAnimationCard,\n} from '../../TransitionConfigs/CardStyleInterpolators';\nimport {\n DefaultTransition,\n ModalFadeTransition,\n ModalTransition,\n} from '../../TransitionConfigs/TransitionPresets';\nimport type {\n Layout,\n Scene,\n StackDescriptor,\n StackDescriptorMap,\n StackHeaderMode,\n StackNavigationOptions,\n} from '../../types';\nimport getDistanceForDirection from '../../utils/getDistanceForDirection';\nimport type { Props as HeaderContainerProps } from '../Header/HeaderContainer';\nimport { MaybeScreen, MaybeScreenContainer } from '../Screens';\nimport { getIsModalPresentation } from './Card';\nimport CardContainer from './CardContainer';\n\ntype GestureValues = {\n [key: string]: Animated.Value;\n};\n\ntype Props = {\n insets: EdgeInsets;\n state: StackNavigationState<ParamListBase>;\n descriptors: StackDescriptorMap;\n routes: Route<string>[];\n openingRouteKeys: string[];\n closingRouteKeys: string[];\n onOpenRoute: (props: { route: Route<string> }) => void;\n onCloseRoute: (props: { route: Route<string> }) => void;\n getPreviousRoute: (props: {\n route: Route<string>;\n }) => Route<string> | undefined;\n renderHeader: (props: HeaderContainerProps) => React.ReactNode;\n renderScene: (props: { route: Route<string> }) => React.ReactNode;\n isParentHeaderShown: boolean;\n isParentModal: boolean;\n onTransitionStart: (\n props: { route: Route<string> },\n closing: boolean\n ) => void;\n onTransitionEnd: (props: { route: Route<string> }, closing: boolean) => void;\n onGestureStart: (props: { route: Route<string> }) => void;\n onGestureEnd: (props: { route: Route<string> }) => void;\n onGestureCancel: (props: { route: Route<string> }) => void;\n detachInactiveScreens?: boolean;\n};\n\ntype State = {\n routes: Route<string>[];\n descriptors: StackDescriptorMap;\n scenes: Scene[];\n gestures: GestureValues;\n layout: Layout;\n headerHeights: Record<string, number>;\n};\n\nconst EPSILON = 0.01;\n\nconst STATE_INACTIVE = 0;\nconst STATE_TRANSITIONING_OR_BELOW_TOP = 1;\nconst STATE_ON_TOP = 2;\n\nconst FALLBACK_DESCRIPTOR = Object.freeze({ options: {} });\n\nconst getInterpolationIndex = (scenes: Scene[], index: number) => {\n const { cardStyleInterpolator } = scenes[index].descriptor.options;\n\n // Start from current card and count backwards the number of cards with same interpolation\n let interpolationIndex = 0;\n\n for (let i = index - 1; i >= 0; i--) {\n const cardStyleInterpolatorCurrent =\n scenes[i]?.descriptor.options.cardStyleInterpolator;\n\n if (cardStyleInterpolatorCurrent !== cardStyleInterpolator) {\n break;\n }\n\n interpolationIndex++;\n }\n\n return interpolationIndex;\n};\n\nconst getIsModal = (\n scene: Scene,\n interpolationIndex: number,\n isParentModal: boolean\n) => {\n if (isParentModal) {\n return true;\n }\n\n const { cardStyleInterpolator } = scene.descriptor.options;\n const isModalPresentation = getIsModalPresentation(cardStyleInterpolator);\n const isModal = isModalPresentation && interpolationIndex !== 0;\n\n return isModal;\n};\n\nconst getHeaderHeights = (\n scenes: Scene[],\n insets: EdgeInsets,\n isParentHeaderShown: boolean,\n isParentModal: boolean,\n layout: Layout,\n previous: Record<string, number>\n) => {\n return scenes.reduce<Record<string, number>>((acc, curr, index) => {\n const {\n headerStatusBarHeight = isParentHeaderShown ? 0 : insets.top,\n headerStyle,\n } = curr.descriptor.options;\n\n const style = StyleSheet.flatten(headerStyle || {});\n\n const height =\n typeof style.height === 'number'\n ? style.height\n : previous[curr.route.key];\n\n const interpolationIndex = getInterpolationIndex(scenes, index);\n const isModal = getIsModal(curr, interpolationIndex, isParentModal);\n\n acc[curr.route.key] =\n typeof height === 'number'\n ? height\n : getDefaultHeaderHeight(layout, isModal, headerStatusBarHeight);\n\n return acc;\n }, {});\n};\n\nconst getDistanceFromOptions = (\n layout: Layout,\n descriptor?: StackDescriptor\n) => {\n const {\n presentation,\n gestureDirection = presentation === 'modal'\n ? ModalTransition.gestureDirection\n : DefaultTransition.gestureDirection,\n } = (descriptor?.options || {}) as StackNavigationOptions;\n\n return getDistanceForDirection(layout, gestureDirection);\n};\n\nconst getProgressFromGesture = (\n gesture: Animated.Value,\n layout: Layout,\n descriptor?: StackDescriptor\n) => {\n const distance = getDistanceFromOptions(\n {\n // Make sure that we have a non-zero distance, otherwise there will be incorrect progress\n // This causes blank screen on web if it was previously inside container with display: none\n width: Math.max(1, layout.width),\n height: Math.max(1, layout.height),\n },\n descriptor\n );\n\n if (distance > 0) {\n return gesture.interpolate({\n inputRange: [0, distance],\n outputRange: [1, 0],\n });\n }\n\n return gesture.interpolate({\n inputRange: [distance, 0],\n outputRange: [0, 1],\n });\n};\n\nexport default class CardStack extends React.Component<Props, State> {\n static getDerivedStateFromProps(\n props: Props,\n state: State\n ): Partial<State> | null {\n if (\n props.routes === state.routes &&\n props.descriptors === state.descriptors\n ) {\n return null;\n }\n\n const gestures = props.routes.reduce<GestureValues>((acc, curr) => {\n const descriptor = props.descriptors[curr.key];\n const { animationEnabled } = descriptor?.options || {};\n\n acc[curr.key] =\n state.gestures[curr.key] ||\n new Animated.Value(\n props.openingRouteKeys.includes(curr.key) &&\n animationEnabled !== false\n ? getDistanceFromOptions(state.layout, descriptor)\n : 0\n );\n\n return acc;\n }, {});\n\n const scenes = props.routes.map((route, index, self) => {\n const previousRoute = self[index - 1];\n const nextRoute = self[index + 1];\n\n const oldScene = state.scenes[index];\n\n const currentGesture = gestures[route.key];\n const previousGesture = previousRoute\n ? gestures[previousRoute.key]\n : undefined;\n const nextGesture = nextRoute ? gestures[nextRoute.key] : undefined;\n\n const descriptor =\n props.descriptors[route.key] ||\n state.descriptors[route.key] ||\n (oldScene ? oldScene.descriptor : FALLBACK_DESCRIPTOR);\n\n const nextDescriptor =\n props.descriptors[nextRoute?.key] || state.descriptors[nextRoute?.key];\n\n const previousDescriptor =\n props.descriptors[previousRoute?.key] ||\n state.descriptors[previousRoute?.key];\n\n // When a screen is not the last, it should use next screen's transition config\n // Many transitions also animate the previous screen, so using 2 different transitions doesn't look right\n // For example combining a slide and a modal transition would look wrong otherwise\n // With this approach, combining different transition styles in the same navigator mostly looks right\n // This will still be broken when 2 transitions have different idle state (e.g. modal presentation),\n // but majority of the transitions look alright\n const optionsForTransitionConfig =\n index !== self.length - 1 &&\n nextDescriptor &&\n nextDescriptor.options.presentation !== 'transparentModal'\n ? nextDescriptor.options\n : descriptor.options;\n\n let defaultTransitionPreset =\n optionsForTransitionConfig.presentation === 'modal'\n ? ModalTransition\n : optionsForTransitionConfig.presentation === 'transparentModal'\n ? ModalFadeTransition\n : DefaultTransition;\n\n const {\n animationEnabled = Platform.OS !== 'web' &&\n Platform.OS !== 'windows' &&\n Platform.OS !== 'macos',\n gestureEnabled = Platform.OS === 'ios' && animationEnabled,\n gestureDirection = defaultTransitionPreset.gestureDirection,\n transitionSpec = defaultTransitionPreset.transitionSpec,\n cardStyleInterpolator = animationEnabled === false\n ? forNoAnimationCard\n : defaultTransitionPreset.cardStyleInterpolator,\n headerStyleInterpolator = defaultTransitionPreset.headerStyleInterpolator,\n cardOverlayEnabled = (Platform.OS !== 'ios' &&\n optionsForTransitionConfig.presentation !== 'transparentModal') ||\n getIsModalPresentation(cardStyleInterpolator),\n } = optionsForTransitionConfig;\n\n const headerMode: StackHeaderMode =\n descriptor.options.headerMode ??\n (!(\n optionsForTransitionConfig.presentation === 'modal' ||\n optionsForTransitionConfig.presentation === 'transparentModal' ||\n nextDescriptor?.options.presentation === 'modal' ||\n nextDescriptor?.options.presentation === 'transparentModal' ||\n getIsModalPresentation(cardStyleInterpolator)\n ) &&\n Platform.OS === 'ios' &&\n descriptor.options.header === undefined\n ? 'float'\n : 'screen');\n\n const scene = {\n route,\n descriptor: {\n ...descriptor,\n options: {\n ...descriptor.options,\n animationEnabled,\n cardOverlayEnabled,\n cardStyleInterpolator,\n gestureDirection,\n gestureEnabled,\n headerStyleInterpolator,\n transitionSpec,\n headerMode,\n },\n },\n progress: {\n current: getProgressFromGesture(\n currentGesture,\n state.layout,\n descriptor\n ),\n next:\n nextGesture &&\n nextDescriptor?.options.presentation !== 'transparentModal'\n ? getProgressFromGesture(\n nextGesture,\n state.layout,\n nextDescriptor\n )\n : undefined,\n previous: previousGesture\n ? getProgressFromGesture(\n previousGesture,\n state.layout,\n previousDescriptor\n )\n : undefined,\n },\n __memo: [\n state.layout,\n descriptor,\n nextDescriptor,\n previousDescriptor,\n currentGesture,\n nextGesture,\n previousGesture,\n ],\n };\n\n if (\n oldScene &&\n scene.__memo.every((it, i) => {\n // @ts-expect-error: we haven't added __memo to the annotation to prevent usage elsewhere\n return oldScene.__memo[i] === it;\n })\n ) {\n return oldScene;\n }\n\n return scene;\n });\n\n return {\n routes: props.routes,\n scenes,\n gestures,\n descriptors: props.descriptors,\n headerHeights: getHeaderHeights(\n scenes,\n props.insets,\n props.isParentHeaderShown,\n props.isParentModal,\n state.layout,\n state.headerHeights\n ),\n };\n }\n\n constructor(props: Props) {\n super(props);\n\n this.state = {\n routes: [],\n scenes: [],\n gestures: {},\n layout: SafeAreaProviderCompat.initialMetrics.frame,\n descriptors: this.props.descriptors,\n // Used when card's header is null and mode is float to make transition\n // between screens with headers and those without headers smooth.\n // This is not a great heuristic here. We don't know synchronously\n // on mount what the header height is so we have just used the most\n // common cases here.\n headerHeights: {},\n };\n }\n\n private handleLayout = (e: LayoutChangeEvent) => {\n const { height, width } = e.nativeEvent.layout;\n\n const layout = { width, height };\n\n this.setState((state, props) => {\n if (height === state.layout.height && width === state.layout.width) {\n return null;\n }\n\n return {\n layout,\n headerHeights: getHeaderHeights(\n state.scenes,\n props.insets,\n props.isParentHeaderShown,\n props.isParentModal,\n layout,\n state.headerHeights\n ),\n };\n });\n };\n\n private handleHeaderLayout = ({\n route,\n height,\n }: {\n route: Route<string>;\n height: number;\n }) => {\n this.setState(({ headerHeights }) => {\n const previousHeight = headerHeights[route.key];\n\n if (previousHeight === height) {\n return null;\n }\n\n return {\n headerHeights: {\n ...headerHeights,\n [route.key]: height,\n },\n };\n });\n };\n\n private getFocusedRoute = () => {\n const { state } = this.props;\n\n return state.routes[state.index];\n };\n\n private getPreviousScene = ({ route }: { route: Route<string> }) => {\n const { getPreviousRoute } = this.props;\n const { scenes } = this.state;\n\n const previousRoute = getPreviousRoute({ route });\n\n if (previousRoute) {\n const previousScene = scenes.find(\n (scene) => scene.descriptor.route.key === previousRoute.key\n );\n\n return previousScene;\n }\n\n return undefined;\n };\n\n render() {\n const {\n insets,\n state,\n routes,\n closingRouteKeys,\n onOpenRoute,\n onCloseRoute,\n renderHeader,\n renderScene,\n isParentHeaderShown,\n isParentModal,\n onTransitionStart,\n onTransitionEnd,\n onGestureStart,\n onGestureEnd,\n onGestureCancel,\n detachInactiveScreens = Platform.OS === 'web' ||\n Platform.OS === 'android' ||\n Platform.OS === 'ios',\n } = this.props;\n\n const { scenes, layout, gestures, headerHeights } = this.state;\n\n const focusedRoute = state.routes[state.index];\n const focusedHeaderHeight = headerHeights[focusedRoute.key];\n\n const isFloatHeaderAbsolute = this.state.scenes.slice(-2).some((scene) => {\n const options = scene.descriptor.options ?? {};\n const { headerMode, headerTransparent, headerShown = true } = options;\n\n if (\n headerTransparent ||\n headerShown === false ||\n headerMode === 'screen'\n ) {\n return true;\n }\n\n return false;\n });\n\n let activeScreensLimit = 1;\n\n for (let i = scenes.length - 1; i >= 0; i--) {\n const { options } = scenes[i].descriptor;\n const {\n // By default, we don't want to detach the previous screen of the active one for modals\n detachPreviousScreen = options.presentation === 'transparentModal'\n ? false\n : getIsModalPresentation(options.cardStyleInterpolator)\n ? i !==\n scenes\n .map((scene) => scene.descriptor.options.cardStyleInterpolator)\n .lastIndexOf(forModalPresentationIOS)\n : true,\n } = options;\n\n if (detachPreviousScreen === false) {\n activeScreensLimit++;\n } else {\n // Check at least last 2 screens before stopping\n // This will make sure that screen isn't detached when another screen is animating on top of the transparent one\n // For example, (Opaque -> Transparent -> Opaque)\n if (i <= scenes.length - 2) {\n break;\n }\n }\n }\n\n const floatingHeader = (\n <React.Fragment key=\"header\">\n {renderHeader({\n mode: 'float',\n layout,\n scenes,\n getPreviousScene: this.getPreviousScene,\n getFocusedRoute: this.getFocusedRoute,\n onContentHeightChange: this.handleHeaderLayout,\n style: [\n styles.floating,\n isFloatHeaderAbsolute && [\n // Without this, the header buttons won't be touchable on Android when headerTransparent: true\n { height: focusedHeaderHeight },\n styles.absolute,\n ],\n ],\n })}\n </React.Fragment>\n );\n\n return (\n <Background>\n {isFloatHeaderAbsolute ? null : floatingHeader}\n <MaybeScreenContainer\n enabled={detachInactiveScreens}\n style={styles.container}\n onLayout={this.handleLayout}\n >\n {routes.map((route, index, self) => {\n const focused = focusedRoute.key === route.key;\n const gesture = gestures[route.key];\n const scene = scenes[index];\n\n // For the screens that shouldn't be active, the value is 0\n // For those that should be active, but are not the top screen, the value is 1\n // For those on top of the stack and with interaction enabled, the value is 2\n // For the old implementation, it stays the same it was\n let isScreenActive: Animated.AnimatedInterpolation | 2 | 1 | 0 = 1;\n\n if (index < self.length - activeScreensLimit - 1) {\n // screen should be inactive because it is too deep in the stack\n isScreenActive = STATE_INACTIVE;\n } else {\n const sceneForActivity = scenes[self.length - 1];\n const outputValue =\n index === self.length - 1\n ? STATE_ON_TOP // the screen is on top after the transition\n : index >= self.length - activeScreensLimit\n ? STATE_TRANSITIONING_OR_BELOW_TOP // the screen should stay active after the transition, it is not on top but is in activeLimit\n : STATE_INACTIVE; // the screen should be active only during the transition, it is at the edge of activeLimit\n isScreenActive = sceneForActivity\n ? sceneForActivity.progress.current.interpolate({\n inputRange: [0, 1 - EPSILON, 1],\n outputRange: [1, 1, outputValue],\n extrapolate: 'clamp',\n })\n : STATE_TRANSITIONING_OR_BELOW_TOP;\n }\n\n const {\n headerShown = true,\n headerTransparent,\n headerStyle,\n headerTintColor,\n } = scene.descriptor.options;\n\n const safeAreaInsetTop = insets.top;\n const safeAreaInsetRight = insets.right;\n const safeAreaInsetBottom = insets.bottom;\n const safeAreaInsetLeft = insets.left;\n\n const headerHeight =\n headerShown !== false ? headerHeights[route.key] : 0;\n\n const { backgroundColor: headerBackgroundColor } =\n StyleSheet.flatten(headerStyle) || {};\n\n let headerDarkContent: boolean | undefined;\n\n if (headerShown) {\n if (typeof headerTintColor === 'string') {\n headerDarkContent = Color(headerTintColor).isDark();\n } else if (typeof headerBackgroundColor === 'string') {\n headerDarkContent = !Color(headerBackgroundColor).isDark();\n }\n }\n\n // Start from current card and count backwards the number of cards with same interpolation\n const interpolationIndex = getInterpolationIndex(scenes, index);\n const isModal = getIsModal(\n scene,\n interpolationIndex,\n isParentModal\n );\n\n const isNextScreenTransparent =\n scenes[index + 1]?.descriptor.options.presentation ===\n 'transparentModal';\n\n const detachCurrentScreen =\n scenes[index + 1]?.descriptor.options.detachPreviousScreen !==\n false;\n\n return (\n <MaybeScreen\n key={route.key}\n style={StyleSheet.absoluteFill}\n enabled={detachInactiveScreens}\n active={isScreenActive}\n pointerEvents=\"box-none\"\n >\n <CardContainer\n index={index}\n interpolationIndex={interpolationIndex}\n modal={isModal}\n active={index === self.length - 1}\n focused={focused}\n closing={closingRouteKeys.includes(route.key)}\n layout={layout}\n gesture={gesture}\n scene={scene}\n safeAreaInsetTop={safeAreaInsetTop}\n safeAreaInsetRight={safeAreaInsetRight}\n safeAreaInsetBottom={safeAreaInsetBottom}\n safeAreaInsetLeft={safeAreaInsetLeft}\n onGestureStart={onGestureStart}\n onGestureCancel={onGestureCancel}\n onGestureEnd={onGestureEnd}\n headerHeight={headerHeight}\n isParentHeaderShown={isParentHeaderShown}\n onHeaderHeightChange={this.handleHeaderLayout}\n getPreviousScene={this.getPreviousScene}\n getFocusedRoute={this.getFocusedRoute}\n headerDarkContent={headerDarkContent}\n hasAbsoluteFloatHeader={\n isFloatHeaderAbsolute && !headerTransparent\n }\n renderHeader={renderHeader}\n renderScene={renderScene}\n onOpenRoute={onOpenRoute}\n onCloseRoute={onCloseRoute}\n onTransitionStart={onTransitionStart}\n onTransitionEnd={onTransitionEnd}\n isNextScreenTransparent={isNextScreenTransparent}\n detachCurrentScreen={detachCurrentScreen}\n />\n </MaybeScreen>\n );\n })}\n </MaybeScreenContainer>\n {isFloatHeaderAbsolute ? floatingHeader : null}\n </Background>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n absolute: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n },\n floating: {\n zIndex: 1,\n },\n});\n"]}
@@ -42,8 +42,8 @@ const GestureHandlerWrapper = _GestureHandler.GestureHandlerRootView !== null &&
42
42
  const isArrayEqual = (a, b) => a.length === b.length && a.every((it, index) => it === b[index]);
43
43
 
44
44
  class StackView extends React.Component {
45
- constructor(...args) {
46
- super(...args);
45
+ constructor() {
46
+ super(...arguments);
47
47
 
48
48
  _defineProperty(this, "state", {
49
49
  routes: [],
@@ -55,9 +55,10 @@ class StackView extends React.Component {
55
55
  descriptors: {}
56
56
  });
57
57
 
58
- _defineProperty(this, "getPreviousRoute", ({
59
- route
60
- }) => {
58
+ _defineProperty(this, "getPreviousRoute", _ref => {
59
+ let {
60
+ route
61
+ } = _ref;
61
62
  const {
62
63
  closingRouteKeys,
63
64
  replacingRouteKeys
@@ -67,9 +68,10 @@ class StackView extends React.Component {
67
68
  return routes[index - 1];
68
69
  });
69
70
 
70
- _defineProperty(this, "renderScene", ({
71
- route
72
- }) => {
71
+ _defineProperty(this, "renderScene", _ref2 => {
72
+ let {
73
+ route
74
+ } = _ref2;
73
75
  const descriptor = this.state.descriptors[route.key] || this.props.descriptors[route.key];
74
76
 
75
77
  if (!descriptor) {
@@ -83,9 +85,10 @@ class StackView extends React.Component {
83
85
  return /*#__PURE__*/React.createElement(_HeaderContainer.default, props);
84
86
  });
85
87
 
86
- _defineProperty(this, "handleOpenRoute", ({
87
- route
88
- }) => {
88
+ _defineProperty(this, "handleOpenRoute", _ref3 => {
89
+ let {
90
+ route
91
+ } = _ref3;
89
92
  const {
90
93
  state,
91
94
  navigation
@@ -109,9 +112,10 @@ class StackView extends React.Component {
109
112
  }
110
113
  });
111
114
 
112
- _defineProperty(this, "handleCloseRoute", ({
113
- route
114
- }) => {
115
+ _defineProperty(this, "handleCloseRoute", _ref4 => {
116
+ let {
117
+ route
118
+ } = _ref4;
115
119
  const {
116
120
  state,
117
121
  navigation
@@ -135,47 +139,56 @@ class StackView extends React.Component {
135
139
  }
136
140
  });
137
141
 
138
- _defineProperty(this, "handleTransitionStart", ({
139
- route
140
- }, closing) => this.props.navigation.emit({
141
- type: 'transitionStart',
142
- data: {
143
- closing
144
- },
145
- target: route.key
146
- }));
147
-
148
- _defineProperty(this, "handleTransitionEnd", ({
149
- route
150
- }, closing) => this.props.navigation.emit({
151
- type: 'transitionEnd',
152
- data: {
153
- closing
154
- },
155
- target: route.key
156
- }));
157
-
158
- _defineProperty(this, "handleGestureStart", ({
159
- route
160
- }) => {
142
+ _defineProperty(this, "handleTransitionStart", (_ref5, closing) => {
143
+ let {
144
+ route
145
+ } = _ref5;
146
+ return this.props.navigation.emit({
147
+ type: 'transitionStart',
148
+ data: {
149
+ closing
150
+ },
151
+ target: route.key
152
+ });
153
+ });
154
+
155
+ _defineProperty(this, "handleTransitionEnd", (_ref6, closing) => {
156
+ let {
157
+ route
158
+ } = _ref6;
159
+ return this.props.navigation.emit({
160
+ type: 'transitionEnd',
161
+ data: {
162
+ closing
163
+ },
164
+ target: route.key
165
+ });
166
+ });
167
+
168
+ _defineProperty(this, "handleGestureStart", _ref7 => {
169
+ let {
170
+ route
171
+ } = _ref7;
161
172
  this.props.navigation.emit({
162
173
  type: 'gestureStart',
163
174
  target: route.key
164
175
  });
165
176
  });
166
177
 
167
- _defineProperty(this, "handleGestureEnd", ({
168
- route
169
- }) => {
178
+ _defineProperty(this, "handleGestureEnd", _ref8 => {
179
+ let {
180
+ route
181
+ } = _ref8;
170
182
  this.props.navigation.emit({
171
183
  type: 'gestureEnd',
172
184
  target: route.key
173
185
  });
174
186
  });
175
187
 
176
- _defineProperty(this, "handleGestureCancel", ({
177
- route
178
- }) => {
188
+ _defineProperty(this, "handleGestureCancel", _ref9 => {
189
+ let {
190
+ route
191
+ } = _ref9;
179
192
  this.props.navigation.emit({
180
193
  type: 'gestureCancel',
181
194
  target: route.key
@@ -298,9 +311,12 @@ class StackView extends React.Component {
298
311
  } else if (replacingRouteKeys.length || closingRouteKeys.length) {
299
312
  // Keep the routes we are closing or replacing if animation is enabled for them
300
313
  routes = routes.slice();
301
- routes.splice(routes.length - 1, 0, ...state.routes.filter(({
302
- key
303
- }) => isAnimationEnabled(key) ? replacingRouteKeys.includes(key) || closingRouteKeys.includes(key) : false));
314
+ routes.splice(routes.length - 1, 0, ...state.routes.filter(_ref10 => {
315
+ let {
316
+ key
317
+ } = _ref10;
318
+ return isAnimationEnabled(key) ? replacingRouteKeys.includes(key) || closingRouteKeys.includes(key) : false;
319
+ }));
304
320
  }
305
321
 
306
322
  if (!routes.length) {
@@ -1 +1 @@
1
- {"version":3,"sources":["StackView.tsx"],"names":["GestureHandlerWrapper","GestureHandlerRootView","View","isArrayEqual","a","b","length","every","it","index","StackView","React","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","StackActions","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","StyleSheet","create","flex"],"mappings":";;;;;;;AAAA;;AAIA;;AAMA;;AACA;;AACA;;AAUA;;AACA;;AACA;;AAGA;;;;;;;;;;;;AA0BA,MAAMA,qBAAqB,GAAGC,sCAAH,aAAGA,sCAAH,cAAGA,sCAAH,GAA6BC,iBAAxD;AAEA;AACA;AACA;AACA;;AACA,MAAMC,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;;AAGe,MAAMC,SAAN,SAAwBC,KAAK,CAACC,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,MAAAA,gBAAgB,EAAE,EALL;AAMbC,MAAAA,kBAAkB,EAAE,EANP;AAObC,MAAAA,WAAW,EAAE;AAPA,KAzNoD;;AAAA,8CAmOxC,CAAC;AAAEC,MAAAA;AAAF,KAAD,KAAyC;AAClE,YAAM;AAAEH,QAAAA,gBAAF;AAAoBC,QAAAA;AAApB,UAA2C,KA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BACC,oBAAC,kBAAD;AACE,MAAA,MAAM,EAAEF,MADV;AAEE,MAAA,mBAAmB,EAAEE,mBAFvB;AAGE,MAAA,aAAa,EAAED,aAHjB;AAIE,MAAA,gBAAgB,EAAE,KAAKE,gBAJzB;AAKE,MAAA,MAAM,EAAErD,MALV;AAME,MAAA,gBAAgB,EAAEG,gBANpB;AAOE,MAAA,gBAAgB,EAAEC,gBAPpB;AAQE,MAAA,WAAW,EAAE,KAAKkD,eARpB;AASE,MAAA,YAAY,EAAE,KAAKC,gBATrB;AAUE,MAAA,iBAAiB,EAAE,KAAKC,qBAV1B;AAWE,MAAA,eAAe,EAAE,KAAKC,mBAXxB;AAYE,MAAA,YAAY,EAAE,KAAKC,YAZrB;AAaE,MAAA,WAAW,EAAE,KAAKC,WAbpB;AAcE,MAAA,KAAK,EAAEnD,KAdT;AAeE,MAAA,WAAW,EAAEF,WAff;AAgBE,MAAA,cAAc,EAAE,KAAKsD,kBAhBvB;AAiBE,MAAA,YAAY,EAAE,KAAKC,gBAjBrB;AAkBE,MAAA,eAAe,EAAE,KAAKC;AAlBxB,OAmBMf,IAnBN,EAFJ,CAFJ,CAFJ,CADF,CADF,CADF;AAuCD;;AApZkE;;;;AAuZrE,MAAMC,MAAM,GAAGe,wBAAWC,MAAX,CAAkB;AAC/Bf,EAAAA,SAAS,EAAE;AACTgB,IAAAA,IAAI,EAAE;AADG;AADoB,CAAlB,CAAf","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"]}
1
+ {"version":3,"sources":["StackView.tsx"],"names":["GestureHandlerWrapper","GestureHandlerRootView","View","isArrayEqual","a","b","length","every","it","index","StackView","React","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","StackActions","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","StyleSheet","create","flex"],"mappings":";;;;;;;AAAA;;AAIA;;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EAAE,KAAKkD,eARpB;AASE,MAAA,YAAY,EAAE,KAAKC,gBATrB;AAUE,MAAA,iBAAiB,EAAE,KAAKC,qBAV1B;AAWE,MAAA,eAAe,EAAE,KAAKC,mBAXxB;AAYE,MAAA,YAAY,EAAE,KAAKC,YAZrB;AAaE,MAAA,WAAW,EAAE,KAAKC,WAbpB;AAcE,MAAA,KAAK,EAAEnD,KAdT;AAeE,MAAA,WAAW,EAAEF,WAff;AAgBE,MAAA,cAAc,EAAE,KAAKsD,kBAhBvB;AAiBE,MAAA,YAAY,EAAE,KAAKC,gBAjBrB;AAkBE,MAAA,eAAe,EAAE,KAAKC;AAlBxB,OAmBMf,IAnBN,EAFJ,CAFJ,CAFJ,CADF,CADF,CADF;AAuCD;;AApZkE;;;;AAuZrE,MAAMC,MAAM,GAAGe,wBAAWC,MAAX,CAAkB;AAC/Bf,EAAAA,SAAS,EAAE;AACTgB,IAAAA,IAAI,EAAE;AADG;AADoB,CAAlB,CAAf","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"]}