1 line
2.4 KiB
Plaintext
1 line
2.4 KiB
Plaintext
|
{"version":3,"sources":["SafeAreaProviderCompat.tsx"],"names":["React","SafeAreaProvider","SafeAreaConsumer","initialWindowSafeAreaInsets","getStatusBarHeight","getBottomSpace","initialSafeAreaInsets","top","bottom","right","left","SafeAreaProviderCompat","children","insets"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SACEC,gBADF,EAEEC,gBAFF,EAGEC,2BAHF,QAIO,gCAJP;AAKA,SACEC,kBADF,EAEEC,cAFF,QAGO,8BAHP,C,CAKA;AACA;AACA;;AACA,OAAO,MAAMC,qBAAqB,GAAG;AACnC;AACAC,EAAAA,GAAG,EAAEH,kBAAkB,CAAC,IAAD,CAFY;AAGnCI,EAAAA,MAAM,EAAEH,cAAc,EAHa;AAInCI,EAAAA,KAAK,EAAE,CAJ4B;AAKnCC,EAAAA,IAAI,EAAE,CAL6B;AAMnC;AACA;AACA,KAAGP;AARgC,CAA9B;AAeP,eAAe,SAASQ,sBAAT,CAAgC;AAAEC,EAAAA;AAAF,CAAhC,EAAqD;AAClE,sBACE,oBAAC,gBAAD,QACIC,MAAD,IAAY;AACX,QAAIA,MAAJ,EAAY;AACV;AACA;AACA;AACA,aAAOD,QAAP;AACD;;AAED,wBACE,oBAAC,gBAAD;AAAkB,MAAA,qBAAqB,EAAEN;AAAzC,OACGM,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"]}
|