| 
				
			 | 
			
			
				@@ -1,59 +1,10 @@ 
			 | 
		
	
		
			
			| 
				1
			 | 
			
				
			 | 
			
			
				-/** 
			 | 
		
	
		
			
			| 
				2
			 | 
			
				
			 | 
			
			
				- * Sample React Native App 
			 | 
		
	
		
			
			| 
				3
			 | 
			
				
			 | 
			
			
				- * https://github.com/facebook/react-native 
			 | 
		
	
		
			
			| 
				4
			 | 
			
				
			 | 
			
			
				- * 
			 | 
		
	
		
			
			| 
				5
			 | 
			
				
			 | 
			
			
				- * @format 
			 | 
		
	
		
			
			| 
				6
			 | 
			
				
			 | 
			
			
				- * @flow 
			 | 
		
	
		
			
			| 
				7
			 | 
			
				
			 | 
			
			
				- */ 
			 | 
		
	
		
			
			| 
				8
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				9
			 | 
			
				1
			 | 
			
			
				 import * as React from 'react'; 
			 | 
		
	
		
			
			| 
				10
			 | 
			
				
			 | 
			
			
				-import { StyleSheet, ScrollView, View, Text, StatusBar } from 'react-native'; 
			 | 
		
	
		
			
			| 
				11
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				12
			 | 
			
				
			 | 
			
			
				-import { 
			 | 
		
	
		
			
			| 
				13
			 | 
			
				
			 | 
			
			
				-  Header, 
			 | 
		
	
		
			
			| 
				14
			 | 
			
				
			 | 
			
			
				-  LearnMoreLinks, 
			 | 
		
	
		
			
			| 
				15
			 | 
			
				
			 | 
			
			
				-  Colors, 
			 | 
		
	
		
			
			| 
				16
			 | 
			
				
			 | 
			
			
				-  DebugInstructions, 
			 | 
		
	
		
			
			| 
				17
			 | 
			
				
			 | 
			
			
				-  ReloadInstructions, 
			 | 
		
	
		
			
			| 
				18
			 | 
			
				
			 | 
			
			
				-} from 'react-native/Libraries/NewAppScreen'; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				2
			 | 
			
			
				+import { View, Text, StatusBar, Button } from 'react-native'; 
			 | 
		
	
		
			
			| 
				19
			 | 
			
				3
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				20
			 | 
			
				4
			 | 
			
			
				 // import { SafeAreaProvider, useSafeArea } from 'react-native-safe-area-context'; in your app. 
			 | 
		
	
		
			
			| 
				21
			 | 
			
				5
			 | 
			
			
				 import { SafeAreaProvider, useSafeArea } from '../src'; 
			 | 
		
	
		
			
			| 
				22
			 | 
			
				6
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				23
			 | 
			
				
			 | 
			
			
				-type ForceInsets = 'always' | 'never'; 
			 | 
		
	
		
			
			| 
				24
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				25
			 | 
			
				
			 | 
			
			
				-const CompatSafeAreaView = ({ 
			 | 
		
	
		
			
			| 
				26
			 | 
			
				
			 | 
			
			
				-  forceInsets = {}, 
			 | 
		
	
		
			
			| 
				27
			 | 
			
				
			 | 
			
			
				-  children, 
			 | 
		
	
		
			
			| 
				28
			 | 
			
				
			 | 
			
			
				-}: { 
			 | 
		
	
		
			
			| 
				29
			 | 
			
				
			 | 
			
			
				-  forceInsets?: { 
			 | 
		
	
		
			
			| 
				30
			 | 
			
				
			 | 
			
			
				-    top?: ForceInsets; 
			 | 
		
	
		
			
			| 
				31
			 | 
			
				
			 | 
			
			
				-    right?: ForceInsets; 
			 | 
		
	
		
			
			| 
				32
			 | 
			
				
			 | 
			
			
				-    bottom?: ForceInsets; 
			 | 
		
	
		
			
			| 
				33
			 | 
			
				
			 | 
			
			
				-    left?: ForceInsets; 
			 | 
		
	
		
			
			| 
				34
			 | 
			
				
			 | 
			
			
				-  }; 
			 | 
		
	
		
			
			| 
				35
			 | 
			
				
			 | 
			
			
				-  children?: React.ReactNode; 
			 | 
		
	
		
			
			| 
				36
			 | 
			
				
			 | 
			
			
				-}) => { 
			 | 
		
	
		
			
			| 
				37
			 | 
			
				
			 | 
			
			
				-  const insets = useSafeArea(); 
			 | 
		
	
		
			
			| 
				38
			 | 
			
				
			 | 
			
			
				-  const top = forceInsets.top === 'never' ? 0 : insets.top; 
			 | 
		
	
		
			
			| 
				39
			 | 
			
				
			 | 
			
			
				-  const right = forceInsets.right === 'never' ? 0 : insets.right; 
			 | 
		
	
		
			
			| 
				40
			 | 
			
				
			 | 
			
			
				-  const bottom = forceInsets.bottom === 'never' ? 0 : insets.bottom; 
			 | 
		
	
		
			
			| 
				41
			 | 
			
				
			 | 
			
			
				-  const left = forceInsets.left === 'never' ? 0 : insets.left; 
			 | 
		
	
		
			
			| 
				42
			 | 
			
				
			 | 
			
			
				-  return ( 
			 | 
		
	
		
			
			| 
				43
			 | 
			
				
			 | 
			
			
				-    <View 
			 | 
		
	
		
			
			| 
				44
			 | 
			
				
			 | 
			
			
				-      style={{ 
			 | 
		
	
		
			
			| 
				45
			 | 
			
				
			 | 
			
			
				-        paddingTop: top, 
			 | 
		
	
		
			
			| 
				46
			 | 
			
				
			 | 
			
			
				-        paddingRight: right, 
			 | 
		
	
		
			
			| 
				47
			 | 
			
				
			 | 
			
			
				-        paddingBottom: bottom, 
			 | 
		
	
		
			
			| 
				48
			 | 
			
				
			 | 
			
			
				-        paddingLeft: left, 
			 | 
		
	
		
			
			| 
				49
			 | 
			
				
			 | 
			
			
				-      }} 
			 | 
		
	
		
			
			| 
				50
			 | 
			
				
			 | 
			
			
				-    > 
			 | 
		
	
		
			
			| 
				51
			 | 
			
				
			 | 
			
			
				-      {children} 
			 | 
		
	
		
			
			| 
				52
			 | 
			
				
			 | 
			
			
				-    </View> 
			 | 
		
	
		
			
			| 
				53
			 | 
			
				
			 | 
			
			
				-  ); 
			 | 
		
	
		
			
			| 
				54
			 | 
			
				
			 | 
			
			
				-}; 
			 | 
		
	
		
			
			| 
				55
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				56
			 | 
			
				
			 | 
			
			
				-const App = () => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7
			 | 
			
			
				+const Screen = () => { 
			 | 
		
	
		
			
			| 
				57
			 | 
			
				8
			 | 
			
			
				   const insets = useSafeArea(); 
			 | 
		
	
		
			
			| 
				58
			 | 
			
				9
			 | 
			
			
				   return ( 
			 | 
		
	
		
			
			| 
				59
			 | 
			
				10
			 | 
			
			
				     <> 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -62,97 +13,42 @@ const App = () => { 
			 | 
		
	
		
			
			| 
				62
			 | 
			
				13
			 | 
			
			
				         translucent={false} 
			 | 
		
	
		
			
			| 
				63
			 | 
			
				14
			 | 
			
			
				         backgroundColor="transparent" 
			 | 
		
	
		
			
			| 
				64
			 | 
			
				15
			 | 
			
			
				       /> 
			 | 
		
	
		
			
			| 
				65
			 | 
			
				
			 | 
			
			
				-      <ScrollView 
			 | 
		
	
		
			
			| 
				66
			 | 
			
				
			 | 
			
			
				-        contentInsetAdjustmentBehavior="never" 
			 | 
		
	
		
			
			| 
				67
			 | 
			
				
			 | 
			
			
				-        style={styles.scrollView} 
			 | 
		
	
		
			
			| 
				68
			 | 
			
				
			 | 
			
			
				-      > 
			 | 
		
	
		
			
			| 
				69
			 | 
			
				
			 | 
			
			
				-        <CompatSafeAreaView> 
			 | 
		
	
		
			
			| 
				70
			 | 
			
				
			 | 
			
			
				-          <Header /> 
			 | 
		
	
		
			
			| 
				71
			 | 
			
				
			 | 
			
			
				-          <View style={styles.body}> 
			 | 
		
	
		
			
			| 
				72
			 | 
			
				
			 | 
			
			
				-            <View style={styles.sectionContainer}> 
			 | 
		
	
		
			
			| 
				73
			 | 
			
				
			 | 
			
			
				-              <Text style={styles.sectionTitle}>Step One</Text> 
			 | 
		
	
		
			
			| 
				74
			 | 
			
				
			 | 
			
			
				-              <Text style={styles.sectionDescription}> 
			 | 
		
	
		
			
			| 
				75
			 | 
			
				
			 | 
			
			
				-                Edit <Text style={styles.highlight}>App.js</Text> to change this 
			 | 
		
	
		
			
			| 
				76
			 | 
			
				
			 | 
			
			
				-                screen and then come back to see your edits. 
			 | 
		
	
		
			
			| 
				77
			 | 
			
				
			 | 
			
			
				-              </Text> 
			 | 
		
	
		
			
			| 
				78
			 | 
			
				
			 | 
			
			
				-            </View> 
			 | 
		
	
		
			
			| 
				79
			 | 
			
				
			 | 
			
			
				-            <View style={styles.sectionContainer}> 
			 | 
		
	
		
			
			| 
				80
			 | 
			
				
			 | 
			
			
				-              <Text style={styles.sectionTitle}>See Your Changes</Text> 
			 | 
		
	
		
			
			| 
				81
			 | 
			
				
			 | 
			
			
				-              <Text style={styles.sectionDescription}> 
			 | 
		
	
		
			
			| 
				82
			 | 
			
				
			 | 
			
			
				-                <ReloadInstructions /> 
			 | 
		
	
		
			
			| 
				83
			 | 
			
				
			 | 
			
			
				-              </Text> 
			 | 
		
	
		
			
			| 
				84
			 | 
			
				
			 | 
			
			
				-            </View> 
			 | 
		
	
		
			
			| 
				85
			 | 
			
				
			 | 
			
			
				-            <View style={styles.sectionContainer}> 
			 | 
		
	
		
			
			| 
				86
			 | 
			
				
			 | 
			
			
				-              <Text style={styles.sectionTitle}>Debug</Text> 
			 | 
		
	
		
			
			| 
				87
			 | 
			
				
			 | 
			
			
				-              <Text style={styles.sectionDescription}> 
			 | 
		
	
		
			
			| 
				88
			 | 
			
				
			 | 
			
			
				-                <DebugInstructions /> 
			 | 
		
	
		
			
			| 
				89
			 | 
			
				
			 | 
			
			
				-              </Text> 
			 | 
		
	
		
			
			| 
				90
			 | 
			
				
			 | 
			
			
				-            </View> 
			 | 
		
	
		
			
			| 
				91
			 | 
			
				
			 | 
			
			
				-            <View style={styles.sectionContainer}> 
			 | 
		
	
		
			
			| 
				92
			 | 
			
				
			 | 
			
			
				-              <Text style={styles.sectionTitle}>Learn More</Text> 
			 | 
		
	
		
			
			| 
				93
			 | 
			
				
			 | 
			
			
				-              <Text style={styles.sectionDescription}> 
			 | 
		
	
		
			
			| 
				94
			 | 
			
				
			 | 
			
			
				-                Read the docs to discover what to do next: 
			 | 
		
	
		
			
			| 
				95
			 | 
			
				
			 | 
			
			
				-              </Text> 
			 | 
		
	
		
			
			| 
				96
			 | 
			
				
			 | 
			
			
				-            </View> 
			 | 
		
	
		
			
			| 
				97
			 | 
			
				
			 | 
			
			
				-            <LearnMoreLinks /> 
			 | 
		
	
		
			
			| 
				98
			 | 
			
				
			 | 
			
			
				-          </View> 
			 | 
		
	
		
			
			| 
				99
			 | 
			
				
			 | 
			
			
				-        </CompatSafeAreaView> 
			 | 
		
	
		
			
			| 
				100
			 | 
			
				
			 | 
			
			
				-      </ScrollView> 
			 | 
		
	
		
			
			| 
				101
			 | 
			
				16
			 | 
			
			
				       <View 
			 | 
		
	
		
			
			| 
				102
			 | 
			
				17
			 | 
			
			
				         style={{ 
			 | 
		
	
		
			
			| 
				103
			 | 
			
				
			 | 
			
			
				-          position: 'absolute', 
			 | 
		
	
		
			
			| 
				104
			 | 
			
				
			 | 
			
			
				-          top: 0, 
			 | 
		
	
		
			
			| 
				105
			 | 
			
				
			 | 
			
			
				-          right: 0, 
			 | 
		
	
		
			
			| 
				106
			 | 
			
				
			 | 
			
			
				-          left: 0, 
			 | 
		
	
		
			
			| 
				107
			 | 
			
				
			 | 
			
			
				-          height: insets.top, 
			 | 
		
	
		
			
			| 
				108
			 | 
			
				
			 | 
			
			
				-          backgroundColor: 'rgba(0, 0, 0, 0.3)', 
			 | 
		
	
		
			
			| 
				
			 | 
			
				18
			 | 
			
			
				+          flex: 1, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				19
			 | 
			
			
				+          backgroundColor: 'red', 
			 | 
		
	
		
			
			| 
				
			 | 
			
				20
			 | 
			
			
				+          paddingTop: insets.top, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				21
			 | 
			
			
				+          paddingLeft: insets.left, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				22
			 | 
			
			
				+          paddingBottom: insets.bottom, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				23
			 | 
			
			
				+          paddingRight: insets.right, 
			 | 
		
	
		
			
			| 
				109
			 | 
			
				24
			 | 
			
			
				         }} 
			 | 
		
	
		
			
			| 
				110
			 | 
			
				
			 | 
			
			
				-      /> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				25
			 | 
			
			
				+      > 
			 | 
		
	
		
			
			| 
				
			 | 
			
				26
			 | 
			
			
				+        <View 
			 | 
		
	
		
			
			| 
				
			 | 
			
				27
			 | 
			
			
				+          style={{ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				28
			 | 
			
			
				+            flex: 1, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				29
			 | 
			
			
				+            backgroundColor: 'white', 
			 | 
		
	
		
			
			| 
				
			 | 
			
				30
			 | 
			
			
				+            alignItems: 'center', 
			 | 
		
	
		
			
			| 
				
			 | 
			
				31
			 | 
			
			
				+            justifyContent: 'center', 
			 | 
		
	
		
			
			| 
				
			 | 
			
				32
			 | 
			
			
				+          }} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				33
			 | 
			
			
				+        > 
			 | 
		
	
		
			
			| 
				
			 | 
			
				34
			 | 
			
			
				+          <Text>Insets: {JSON.stringify(insets, null, 2)}</Text> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				35
			 | 
			
			
				+        </View> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				36
			 | 
			
			
				+      </View> 
			 | 
		
	
		
			
			| 
				111
			 | 
			
				37
			 | 
			
			
				     </> 
			 | 
		
	
		
			
			| 
				112
			 | 
			
				38
			 | 
			
			
				   ); 
			 | 
		
	
		
			
			| 
				113
			 | 
			
				39
			 | 
			
			
				 }; 
			 | 
		
	
		
			
			| 
				114
			 | 
			
				40
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				115
			 | 
			
				
			 | 
			
			
				-const styles = StyleSheet.create({ 
			 | 
		
	
		
			
			| 
				116
			 | 
			
				
			 | 
			
			
				-  scrollView: { 
			 | 
		
	
		
			
			| 
				117
			 | 
			
				
			 | 
			
			
				-    backgroundColor: Colors.lighter, 
			 | 
		
	
		
			
			| 
				118
			 | 
			
				
			 | 
			
			
				-  }, 
			 | 
		
	
		
			
			| 
				119
			 | 
			
				
			 | 
			
			
				-  engine: { 
			 | 
		
	
		
			
			| 
				120
			 | 
			
				
			 | 
			
			
				-    position: 'absolute', 
			 | 
		
	
		
			
			| 
				121
			 | 
			
				
			 | 
			
			
				-    right: 0, 
			 | 
		
	
		
			
			| 
				122
			 | 
			
				
			 | 
			
			
				-  }, 
			 | 
		
	
		
			
			| 
				123
			 | 
			
				
			 | 
			
			
				-  body: { 
			 | 
		
	
		
			
			| 
				124
			 | 
			
				
			 | 
			
			
				-    backgroundColor: Colors.white, 
			 | 
		
	
		
			
			| 
				125
			 | 
			
				
			 | 
			
			
				-  }, 
			 | 
		
	
		
			
			| 
				126
			 | 
			
				
			 | 
			
			
				-  sectionContainer: { 
			 | 
		
	
		
			
			| 
				127
			 | 
			
				
			 | 
			
			
				-    marginTop: 32, 
			 | 
		
	
		
			
			| 
				128
			 | 
			
				
			 | 
			
			
				-    paddingHorizontal: 24, 
			 | 
		
	
		
			
			| 
				129
			 | 
			
				
			 | 
			
			
				-  }, 
			 | 
		
	
		
			
			| 
				130
			 | 
			
				
			 | 
			
			
				-  sectionTitle: { 
			 | 
		
	
		
			
			| 
				131
			 | 
			
				
			 | 
			
			
				-    fontSize: 24, 
			 | 
		
	
		
			
			| 
				132
			 | 
			
				
			 | 
			
			
				-    fontWeight: '600', 
			 | 
		
	
		
			
			| 
				133
			 | 
			
				
			 | 
			
			
				-    color: Colors.black, 
			 | 
		
	
		
			
			| 
				134
			 | 
			
				
			 | 
			
			
				-  }, 
			 | 
		
	
		
			
			| 
				135
			 | 
			
				
			 | 
			
			
				-  sectionDescription: { 
			 | 
		
	
		
			
			| 
				136
			 | 
			
				
			 | 
			
			
				-    marginTop: 8, 
			 | 
		
	
		
			
			| 
				137
			 | 
			
				
			 | 
			
			
				-    fontSize: 18, 
			 | 
		
	
		
			
			| 
				138
			 | 
			
				
			 | 
			
			
				-    fontWeight: '400', 
			 | 
		
	
		
			
			| 
				139
			 | 
			
				
			 | 
			
			
				-    color: Colors.dark, 
			 | 
		
	
		
			
			| 
				140
			 | 
			
				
			 | 
			
			
				-  }, 
			 | 
		
	
		
			
			| 
				141
			 | 
			
				
			 | 
			
			
				-  highlight: { 
			 | 
		
	
		
			
			| 
				142
			 | 
			
				
			 | 
			
			
				-    fontWeight: '700', 
			 | 
		
	
		
			
			| 
				143
			 | 
			
				
			 | 
			
			
				-  }, 
			 | 
		
	
		
			
			| 
				144
			 | 
			
				
			 | 
			
			
				-  footer: { 
			 | 
		
	
		
			
			| 
				145
			 | 
			
				
			 | 
			
			
				-    color: Colors.dark, 
			 | 
		
	
		
			
			| 
				146
			 | 
			
				
			 | 
			
			
				-    fontSize: 12, 
			 | 
		
	
		
			
			| 
				147
			 | 
			
				
			 | 
			
			
				-    fontWeight: '600', 
			 | 
		
	
		
			
			| 
				148
			 | 
			
				
			 | 
			
			
				-    padding: 4, 
			 | 
		
	
		
			
			| 
				149
			 | 
			
				
			 | 
			
			
				-    paddingRight: 12, 
			 | 
		
	
		
			
			| 
				150
			 | 
			
				
			 | 
			
			
				-    textAlign: 'right', 
			 | 
		
	
		
			
			| 
				151
			 | 
			
				
			 | 
			
			
				-  }, 
			 | 
		
	
		
			
			| 
				152
			 | 
			
				
			 | 
			
			
				-}); 
			 | 
		
	
		
			
			| 
				153
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				154
			 | 
			
				
			 | 
			
			
				-export default () => ( 
			 | 
		
	
		
			
			| 
				155
			 | 
			
				
			 | 
			
			
				-  <SafeAreaProvider> 
			 | 
		
	
		
			
			| 
				156
			 | 
			
				
			 | 
			
			
				-    <App /> 
			 | 
		
	
		
			
			| 
				157
			 | 
			
				
			 | 
			
			
				-  </SafeAreaProvider> 
			 | 
		
	
		
			
			| 
				158
			 | 
			
				
			 | 
			
			
				-); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				41
			 | 
			
			
				+export default function App() { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				42
			 | 
			
			
				+  const [refreshKey, setRefreshKey] = React.useState(1); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				43
			 | 
			
			
				+  return ( 
			 | 
		
	
		
			
			| 
				
			 | 
			
				44
			 | 
			
			
				+    <View key={refreshKey} style={{ flex: 1 }}> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				45
			 | 
			
			
				+      <SafeAreaProvider> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				46
			 | 
			
			
				+        <Screen /> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				47
			 | 
			
			
				+        <Button 
			 | 
		
	
		
			
			| 
				
			 | 
			
				48
			 | 
			
			
				+          title="Refresh" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				49
			 | 
			
			
				+          onPress={() => setRefreshKey(state => state + 1)} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				50
			 | 
			
			
				+        /> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				51
			 | 
			
			
				+      </SafeAreaProvider> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				52
			 | 
			
			
				+    </View> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				53
			 | 
			
			
				+  ); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				54
			 | 
			
			
				+} 
			 |