Browse Source

Fix `Import declaration conflicts with local declaration of 'EdgeInsets'`

Not sure if there is a better way to do this but it should work...

Also confused why the error doesn't show up in the project.

Fixes #22
Janic Duplessis 5 years ago
parent
commit
4718a6ed12
1 changed files with 6 additions and 6 deletions
  1. 6
    6
      src/index.tsx

+ 6
- 6
src/index.tsx View File

@@ -1,13 +1,13 @@
1 1
 import * as React from 'react';
2 2
 import { StyleSheet, View, ViewProps } from 'react-native';
3
-import { EdgeInsets, InsetChangedEvent } from './SafeArea.types';
3
+import { EdgeInsets as EdgeInsetsT, InsetChangedEvent } from './SafeArea.types';
4 4
 import NativeSafeAreaView from './NativeSafeAreaView';
5 5
 
6
-export const SafeAreaContext = React.createContext<EdgeInsets | null>(null);
6
+export const SafeAreaContext = React.createContext<EdgeInsetsT | null>(null);
7 7
 
8 8
 export interface SafeAreaViewProps {
9 9
   children?: React.ReactNode;
10
-  initialSafeAreaInsets?: EdgeInsets | null;
10
+  initialSafeAreaInsets?: EdgeInsetsT | null;
11 11
 }
12 12
 
13 13
 export function SafeAreaProvider({
@@ -15,7 +15,7 @@ export function SafeAreaProvider({
15 15
   initialSafeAreaInsets,
16 16
 }: SafeAreaViewProps) {
17 17
   const parentInsets = useParentSafeArea();
18
-  const [insets, setInsets] = React.useState<EdgeInsets | null | undefined>(
18
+  const [insets, setInsets] = React.useState<EdgeInsetsT | null | undefined>(
19 19
     initialSafeAreaInsets || parentInsets,
20 20
   );
21 21
   const onInsetsChange = React.useCallback((event: InsetChangedEvent) => {
@@ -43,7 +43,7 @@ function useParentSafeArea(): React.ContextType<typeof SafeAreaContext> {
43 43
   return React.useContext(SafeAreaContext);
44 44
 }
45 45
 
46
-export function useSafeArea(): EdgeInsets {
46
+export function useSafeArea(): EdgeInsetsT {
47 47
   const safeArea = React.useContext(SafeAreaContext);
48 48
   if (safeArea == null) {
49 49
     throw new Error(
@@ -75,4 +75,4 @@ export function SafeAreaView({
75 75
   );
76 76
 }
77 77
 
78
-export type EdgeInsets = EdgeInsets;
78
+export type EdgeInsets = EdgeInsetsT;