Przeglądaj źródła

Bring back SafeAreaContext for better compat with 0.x

Janic Duplessis 4 lat temu
rodzic
commit
7a7935f78b
1 zmienionych plików z 14 dodań i 9 usunięć
  1. 14
    9
      src/SafeAreaContext.tsx

+ 14
- 9
src/SafeAreaContext.tsx Wyświetl plik

91
   return frame;
91
   return frame;
92
 }
92
 }
93
 
93
 
94
+export function withSafeAreaInsets<T>(
95
+  WrappedComponent: React.ComponentType<T>,
96
+) {
97
+  return (props: T) => (
98
+    <SafeAreaConsumer>
99
+      {(insets) => <WrappedComponent {...props} insets={insets} />}
100
+    </SafeAreaConsumer>
101
+  );
102
+}
103
+
94
 /**
104
 /**
95
  * @deprecated
105
  * @deprecated
96
  */
106
  */
107
   return <SafeAreaInsetsContext.Consumer {...props} />;
117
   return <SafeAreaInsetsContext.Consumer {...props} />;
108
 }
118
 }
109
 
119
 
110
-export function withSafeAreaInsets<T>(
111
-  WrappedComponent: React.ComponentType<T>,
112
-) {
113
-  return (props: T) => (
114
-    <SafeAreaConsumer>
115
-      {(insets) => <WrappedComponent {...props} insets={insets} />}
116
-    </SafeAreaConsumer>
117
-  );
118
-}
120
+/**
121
+ * @deprecated
122
+ */
123
+export const SafeAreaContext = SafeAreaInsetsContext;