{"version":3,"names":["React","Platform","InnerScreen","Animated","useEvent","useSharedValue","ReanimatedTransitionProgressContext","useSafeAreaFrame","useSafeAreaInsets","getDefaultHeaderHeight","getStatusBarHeight","ReanimatedHeaderHeightContext","AnimatedScreen","createAnimatedComponent","ENABLE_FABRIC","_global","global","_IS_FABRIC","ReanimatedNativeStackScreen","forwardRef","props","ref","_rest$statusBarTransl","children","rest","stackPresentation","hasLargeHeader","dimensions","topInset","top","isStatusBarTranslucent","statusBarTranslucent","statusBarHeight","defaultHeaderHeight","cachedHeaderHeight","useRef","headerHeight","progress","closing","goingForward","createElement","_extends","onTransitionProgressReanimated","event","value","OS","onHeaderHeightChangeReanimated","current","Provider","displayName"],"sources":["ReanimatedNativeStackScreen.tsx"],"sourcesContent":["import React from 'react';\nimport { Platform } from 'react-native';\nimport {\n HeaderHeightChangeEventType,\n InnerScreen,\n ScreenProps,\n TransitionProgressEventType,\n} from 'react-native-screens';\n\n// @ts-ignore file to be used only if `react-native-reanimated` available in the project\nimport Animated, { useEvent, useSharedValue } from 'react-native-reanimated';\nimport ReanimatedTransitionProgressContext from './ReanimatedTransitionProgressContext';\nimport {\n useSafeAreaFrame,\n useSafeAreaInsets,\n} from 'react-native-safe-area-context';\nimport getDefaultHeaderHeight from '../native-stack/utils/getDefaultHeaderHeight';\nimport getStatusBarHeight from '../native-stack/utils/getStatusBarHeight';\nimport ReanimatedHeaderHeightContext from './ReanimatedHeaderHeightContext';\n\nconst AnimatedScreen = Animated.createAnimatedComponent(\n InnerScreen as unknown as React.ComponentClass\n);\n\n// We use prop added to global by reanimated since it seems safer than the one from RN. See:\n// https://github.com/software-mansion/react-native-reanimated/blob/3fe8b35b05e82b2f2aefda1fb97799cf81e4b7bb/src/reanimated2/UpdateProps.ts#L46\n// @ts-expect-error nativeFabricUIManager is not yet included in the RN types\nconst ENABLE_FABRIC = !!global?._IS_FABRIC;\n\nconst ReanimatedNativeStackScreen = React.forwardRef<\n typeof AnimatedScreen,\n ScreenProps\n>((props, ref) => {\n const { children, ...rest } = props;\n const { stackPresentation = 'push', hasLargeHeader } = rest;\n\n const dimensions = useSafeAreaFrame();\n const topInset = useSafeAreaInsets().top;\n const isStatusBarTranslucent = rest.statusBarTranslucent ?? false;\n const statusBarHeight = getStatusBarHeight(\n topInset,\n dimensions,\n isStatusBarTranslucent\n );\n\n // Default header height, normally used in `useHeaderHeight` hook.\n // Here, it is used for returning a default value for shared value.\n const defaultHeaderHeight = getDefaultHeaderHeight(\n dimensions,\n statusBarHeight,\n stackPresentation,\n hasLargeHeader\n );\n\n const cachedHeaderHeight = React.useRef(defaultHeaderHeight);\n const headerHeight = useSharedValue(defaultHeaderHeight);\n\n const progress = useSharedValue(0);\n const closing = useSharedValue(0);\n const goingForward = useSharedValue(0);\n\n return (\n {\n 'worklet';\n progress.value = event.progress;\n closing.value = event.closing;\n goingForward.value = event.goingForward;\n },\n [\n // This should not be necessary, but is not properly managed by `react-native-reanimated`\n // @ts-ignore wrong type\n Platform.OS === 'android'\n ? 'onTransitionProgress'\n : // for some reason there is a difference in required event name between architectures\n ENABLE_FABRIC\n ? 'onTransitionProgress'\n : 'topTransitionProgress',\n ]\n )}\n onHeaderHeightChangeReanimated={useEvent(\n (event: HeaderHeightChangeEventType) => {\n 'worklet';\n if (event.headerHeight !== cachedHeaderHeight.current) {\n headerHeight.value = event.headerHeight;\n cachedHeaderHeight.current = event.headerHeight;\n }\n },\n [\n // @ts-ignore wrong type\n Platform.OS === 'android'\n ? 'onHeaderHeightChange'\n : ENABLE_FABRIC\n ? 'onHeaderHeightChange'\n : 'topHeaderHeightChange',\n ]\n )}\n {...rest}>\n \n \n {children}\n \n \n \n );\n});\n\nReanimatedNativeStackScreen.displayName = 'ReanimatedNativeStackScreen';\n\nexport default ReanimatedNativeStackScreen;\n"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAEEC,WAAW,QAGN,sBAAsB;;AAE7B;AACA,OAAOC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