UNPKG

29.3 kBSource Map (JSON)View Raw
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,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AKC,gBAjBrB;AAkBE,MAAA,eAAe,EAAE,KAAKC;AAlBxB,OAmBMf,IAnBN,EAFJ,CAFJ,CAFJ,CADF,CADF,CADF;AAuCD;;AApZkE;AAuZrE,MAAMC,MAAM,GAAGhE,UAAU,CAAC+E,MAAX,CAAkB;AAC/Bd,EAAAA,SAAS,EAAE;AACTe,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"]}
\No newline at end of file