amis-rpc-design/node_modules/react-native-screens/lib/module/native-stack/utils/SafeAreaProviderCompat.js.map
2023-10-07 19:42:30 +08:00

1 line
3.4 KiB
Plaintext

{"version":3,"names":["React","Dimensions","Platform","StyleSheet","View","initialWindowMetrics","SafeAreaInsetsContext","SafeAreaProvider","width","height","get","initialMetrics","OS","frame","x","y","insets","top","left","right","bottom","SafeAreaProviderCompat","_ref","children","style","createElement","Consumer","styles","container","create","flex"],"sources":["SafeAreaProviderCompat.tsx"],"sourcesContent":["// code taken from\n// https://github.com/react-navigation/react-navigation/blob/ec0d113eb25c39ef9defb6c7215640f44e3569ae/packages/elements/src/SafeAreaProviderCompat.tsx\nimport * as React from 'react';\nimport {\n Dimensions,\n Platform,\n StyleProp,\n StyleSheet,\n View,\n ViewStyle,\n} from 'react-native';\nimport {\n initialWindowMetrics,\n SafeAreaInsetsContext,\n SafeAreaProvider,\n} from 'react-native-safe-area-context';\n\ntype Props = {\n children: React.ReactNode;\n style?: StyleProp<ViewStyle>;\n};\n\nconst { width = 0, height = 0 } = Dimensions.get('window');\n\n// To support SSR on web, we need to have empty insets for initial values\n// Otherwise there can be mismatch between SSR and client output\n// We also need to specify empty values to support tests environments\nconst initialMetrics =\n Platform.OS === 'web' || initialWindowMetrics == null\n ? {\n frame: { x: 0, y: 0, width, height },\n insets: { top: 0, left: 0, right: 0, bottom: 0 },\n }\n : initialWindowMetrics;\n\nexport default function SafeAreaProviderCompat({ children, style }: Props) {\n return (\n <SafeAreaInsetsContext.Consumer>\n {(insets) => {\n if (insets) {\n // If we already have insets, don't wrap the stack in another safe area provider\n // This avoids an issue with updates at the cost of potentially incorrect values\n // https://github.com/react-navigation/react-navigation/issues/174\n return <View style={[styles.container, style]}>{children}</View>;\n }\n\n return (\n <SafeAreaProvider initialMetrics={initialMetrics} style={style}>\n {children}\n </SafeAreaProvider>\n );\n }}\n </SafeAreaInsetsContext.Consumer>\n );\n}\n\nSafeAreaProviderCompat.initialMetrics = initialMetrics;\n\nconst styles = Sty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