Skip to content

Commit 8cc558a

Browse files
authored
Restore SafeAreaProvider in App.tsx (#156)
1 parent f728617 commit 8cc558a

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

template/App.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,31 @@
77

88
import { NewAppScreen } from '@react-native/new-app-screen';
99
import { StatusBar, StyleSheet, useColorScheme, View } from 'react-native';
10+
import {
11+
SafeAreaProvider,
12+
useSafeAreaInsets,
13+
} from 'react-native-safe-area-context';
1014

1115
function App() {
1216
const isDarkMode = useColorScheme() === 'dark';
1317

1418
return (
15-
<>
19+
<SafeAreaProvider>
1620
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
1721
<AppContent />
18-
</>
22+
</SafeAreaProvider>
1923
);
2024
}
2125

2226
function AppContent() {
23-
// TODO(huntie): Restore safeAreaInsets assignment (see #153)
27+
const safeAreaInsets = useSafeAreaInsets();
28+
2429
return (
2530
<View style={styles.container}>
26-
<NewAppScreen templateFileName="App.tsx" />
31+
<NewAppScreen
32+
templateFileName="App.tsx"
33+
safeAreaInsets={safeAreaInsets}
34+
/>
2735
</View>
2836
);
2937
}

template/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"dependencies": {
1313
"react": "19.1.0",
1414
"react-native": "1000.0.0",
15-
"@react-native/new-app-screen": "0.82.0-main"
15+
"@react-native/new-app-screen": "0.82.0-main",
16+
"react-native-safe-area-context": "^5.5.2"
1617
},
1718
"devDependencies": {
1819
"@babel/core": "^7.25.2",

0 commit comments

Comments
 (0)