소스 검색

Bring back SafeAreaContext for better compat with 0.x

Janic Duplessis 4 년 전
부모
커밋
7a7935f78b
1개의 변경된 파일14개의 추가작업 그리고 9개의 파일을 삭제
  1. 14
    9
      src/SafeAreaContext.tsx

+ 14
- 9
src/SafeAreaContext.tsx 파일 보기

@@ -91,6 +91,16 @@ export function useSafeAreaFrame(): Rect {
91 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 105
  * @deprecated
96 106
  */
@@ -107,12 +117,7 @@ export function SafeAreaConsumer(
107 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;