Skip to content

Commit a9e8a71

Browse files
Lucas Bentofacebook-github-bot
Lucas Bento
authored andcommitted
Add SafeAreaView to not have content behind StatusBar in iOS (#24868)
Summary: This PR fixes the content being shown behind the `StatusBar` in the new app template, was only happening in iOS. ## Changelog [General] [Changed] - Fix content being shown behind `StatusBar` in the new app template. Pull Request resolved: #24868 Differential Revision: D15353748 Pulled By: cpojer fbshipit-source-id: 4c84a65d9f8e85e5558d447533e381126c971e38
1 parent 654868d commit a9e8a71

File tree

1 file changed

+43
-33
lines changed

1 file changed

+43
-33
lines changed

template/App.js

+43-33
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@
77
*/
88

99
import React, {Fragment} from 'react';
10-
import {StyleSheet, ScrollView, View, Text, StatusBar} from 'react-native';
10+
import {
11+
SafeAreaView,
12+
StyleSheet,
13+
ScrollView,
14+
View,
15+
Text,
16+
StatusBar,
17+
} from 'react-native';
1118

1219
import {
1320
Header,
@@ -21,39 +28,42 @@ const App = () => {
2128
return (
2229
<Fragment>
2330
<StatusBar barStyle="dark-content" />
24-
<ScrollView
25-
contentInsetAdjustmentBehavior="automatic"
26-
style={styles.scrollView}>
27-
<Header />
28-
<View style={styles.body}>
29-
<View style={styles.sectionContainer}>
30-
<Text style={styles.sectionTitle}>Step One</Text>
31-
<Text style={styles.sectionDescription}>
32-
Edit <Text style={styles.highlight}>App.js</Text> to change this
33-
screen and then come back to see your edits.
34-
</Text>
35-
</View>
36-
<View style={styles.sectionContainer}>
37-
<Text style={styles.sectionTitle}>See Your Changes</Text>
38-
<Text style={styles.sectionDescription}>
39-
<ReloadInstructions />
40-
</Text>
41-
</View>
42-
<View style={styles.sectionContainer}>
43-
<Text style={styles.sectionTitle}>Debug</Text>
44-
<Text style={styles.sectionDescription}>
45-
<DebugInstructions />
46-
</Text>
47-
</View>
48-
<View style={styles.sectionContainer}>
49-
<Text style={styles.sectionTitle}>Learn More</Text>
50-
<Text style={styles.sectionDescription}>
51-
Read the docs on what to do once seen how to work in React Native.
52-
</Text>
31+
<SafeAreaView>
32+
<ScrollView
33+
contentInsetAdjustmentBehavior="automatic"
34+
style={styles.scrollView}>
35+
<Header />
36+
<View style={styles.body}>
37+
<View style={styles.sectionContainer}>
38+
<Text style={styles.sectionTitle}>Step One</Text>
39+
<Text style={styles.sectionDescription}>
40+
Edit <Text style={styles.highlight}>App.js</Text> to change this
41+
screen and then come back to see your edits.
42+
</Text>
43+
</View>
44+
<View style={styles.sectionContainer}>
45+
<Text style={styles.sectionTitle}>See Your Changes</Text>
46+
<Text style={styles.sectionDescription}>
47+
<ReloadInstructions />
48+
</Text>
49+
</View>
50+
<View style={styles.sectionContainer}>
51+
<Text style={styles.sectionTitle}>Debug</Text>
52+
<Text style={styles.sectionDescription}>
53+
<DebugInstructions />
54+
</Text>
55+
</View>
56+
<View style={styles.sectionContainer}>
57+
<Text style={styles.sectionTitle}>Learn More</Text>
58+
<Text style={styles.sectionDescription}>
59+
Read the docs on what to do once seen how to work in React
60+
Native.
61+
</Text>
62+
</View>
63+
<LearnMoreLinks />
5364
</View>
54-
<LearnMoreLinks />
55-
</View>
56-
</ScrollView>
65+
</ScrollView>
66+
</SafeAreaView>
5767
</Fragment>
5868
);
5969
};

0 commit comments

Comments
 (0)