1 line
2.2 KiB
Plaintext
1 line
2.2 KiB
Plaintext
|
{"version":3,"sources":["SafeAreaProviderCompat.tsx"],"names":["initialSafeAreaInsets","top","bottom","right","left","initialWindowSafeAreaInsets","SafeAreaProviderCompat","children","insets"],"mappings":";;;;;;;;AAAA;;AACA;;AAKA;;;;;;AAKA;AACA;AACA;AACO,MAAMA,qBAAqB,GAAG;AACnC;AACAC,EAAAA,GAAG,EAAE,kDAAmB,IAAnB,CAF8B;AAGnCC,EAAAA,MAAM,EAAE,+CAH2B;AAInCC,EAAAA,KAAK,EAAE,CAJ4B;AAKnCC,EAAAA,IAAI,EAAE,CAL6B;AAMnC;AACA;AACA,KAAGC;AARgC,CAA9B;;;AAeQ,SAASC,sBAAT,CAAgC;AAAEC,EAAAA;AAAF,CAAhC,EAAqD;AAClE,sBACE,oBAAC,4CAAD,QACIC,MAAD,IAAY;AACX,QAAIA,MAAJ,EAAY;AACV;AACA;AACA;AACA,aAAOD,QAAP;AACD;;AAED,wBACE,oBAAC,4CAAD;AAAkB,MAAA,qBAAqB,EAAEP;AAAzC,OACGO,QADH,CADF;AAKD,GAdH,CADF;AAkBD","sourcesContent":["import * as React from 'react';\nimport {\n SafeAreaProvider,\n SafeAreaConsumer,\n initialWindowSafeAreaInsets,\n} from 'react-native-safe-area-context';\nimport {\n getStatusBarHeight,\n getBottomSpace,\n} from 'react-native-iphone-x-helper';\n\n// The provider component for safe area initializes asynchornously\n// Until the insets are available, there'll be blank screen\n// To avoid the blank screen, we specify some initial values\nexport const initialSafeAreaInsets = {\n // Approximate values which are good enough for most cases\n top: getStatusBarHeight(true),\n bottom: getBottomSpace(),\n right: 0,\n left: 0,\n // If we are on a newer version of the library, we can get the correct window insets\n // The component might not be filling the window, but this is good enough for most cases\n ...initialWindowSafeAreaInsets,\n};\n\ntype Props = {\n children: React.ReactNode;\n};\n\nexport default function SafeAreaProviderCompat({ children }: Props) {\n return (\n <SafeAreaConsumer>\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 children;\n }\n\n return (\n <SafeAreaProvider initialSafeAreaInsets={initialSafeAreaInsets}>\n {children}\n </SafeAreaProvider>\n );\n }}\n </SafeAreaConsumer>\n );\n}\n"]}
|