Skip to content

Commit

Permalink
Fix `Import declaration conflicts with local declaration of 'EdgeInse…
Browse files Browse the repository at this point in the history
…ts'`

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
  • Loading branch information
janicduplessis committed Nov 4, 2019
1 parent e9c43a7 commit 4718a6e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import * as React from 'react';
import { StyleSheet, View, ViewProps } from 'react-native';
import { EdgeInsets, InsetChangedEvent } from './SafeArea.types';
import { EdgeInsets as EdgeInsetsT, InsetChangedEvent } from './SafeArea.types';
import NativeSafeAreaView from './NativeSafeAreaView';

export const SafeAreaContext = React.createContext<EdgeInsets | null>(null);
export const SafeAreaContext = React.createContext<EdgeInsetsT | null>(null);

export interface SafeAreaViewProps {
children?: React.ReactNode;
initialSafeAreaInsets?: EdgeInsets | null;
initialSafeAreaInsets?: EdgeInsetsT | null;
}

export function SafeAreaProvider({
children,
initialSafeAreaInsets,
}: SafeAreaViewProps) {
const parentInsets = useParentSafeArea();
const [insets, setInsets] = React.useState<EdgeInsets | null | undefined>(
const [insets, setInsets] = React.useState<EdgeInsetsT | null | undefined>(
initialSafeAreaInsets || parentInsets,
);
const onInsetsChange = React.useCallback((event: InsetChangedEvent) => {
Expand Down Expand Up @@ -43,7 +43,7 @@ function useParentSafeArea(): React.ContextType<typeof SafeAreaContext> {
return React.useContext(SafeAreaContext);
}

export function useSafeArea(): EdgeInsets {
export function useSafeArea(): EdgeInsetsT {
const safeArea = React.useContext(SafeAreaContext);
if (safeArea == null) {
throw new Error(
Expand Down Expand Up @@ -75,4 +75,4 @@ export function SafeAreaView({
);
}

export type EdgeInsets = EdgeInsets;
export type EdgeInsets = EdgeInsetsT;

0 comments on commit 4718a6e

Please sign in to comment.