Skip to content

Commit 0274b14

Browse files
committed
fix SafeAreaView warning
1 parent 8e1c82d commit 0274b14

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

examples/basic/App.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
import * as React from 'react';
2-
import { SafeAreaView } from 'react-native';
2+
import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context';
33
import { LoginForm } from './components/LoginForm';
44
import { Home } from './components/Home';
55

66
const App = () => {
77
const [user, setUser] = React.useState<string | null>(null);
88

99
return (
10-
<SafeAreaView>
11-
{user == null ? <LoginForm onLoginSuccess={setUser} /> : <Home user={user} />}
12-
</SafeAreaView>
10+
<SafeAreaProvider>
11+
<SafeAreaView>
12+
{user == null ? <LoginForm onLoginSuccess={setUser} /> : <Home user={user} />}
13+
</SafeAreaView>
14+
</SafeAreaProvider>
1315
);
1416
};
1517

examples/basic/jest-setup.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import mockSafeAreaContext from 'react-native-safe-area-context/jest/mock';
2+
3+
jest.mock('react-native-safe-area-context', () => mockSafeAreaContext);

0 commit comments

Comments
 (0)