Skip to content

Commit a1d5e3d

Browse files
authored
Update safe area handling for NewAppScreen (0.81) (#151)
1 parent f1f65e1 commit a1d5e3d

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

template/App.tsx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +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-
<View style={styles.container}>
19+
<SafeAreaProvider>
1620
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
17-
<NewAppScreen templateFileName="App.tsx" />
21+
<AppContent />
22+
</SafeAreaProvider>
23+
);
24+
}
25+
26+
function AppContent() {
27+
const safeAreaInsets = useSafeAreaInsets();
28+
29+
return (
30+
<View style={styles.container}>
31+
<NewAppScreen
32+
templateFileName="App.tsx"
33+
safeAreaInsets={safeAreaInsets}
34+
/>
1835
</View>
1936
);
2037
}

template/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"dependencies": {
1313
"react": "19.1.0",
1414
"react-native": "1000.0.0",
15+
"react-native-safe-area-context": "^5.5.1",
1516
"@react-native/new-app-screen": "0.82.0-main"
1617
},
1718
"devDependencies": {

0 commit comments

Comments
 (0)