SafeAreaView doesn't work on iOS 10 and below
See original GitHub issueIs this a bug report?
don’t know
Environment
Environment: OS: macOS Sierra 10.12.6 Node: 8.4.0 Xcode: 9.2
react-native: 0.48.1 => 0.48.1 react: 16.0.0-alpha.12 => 16.0.0-alpha.12
Target Platform: iOS 10 and greater
Steps to Reproduce
in my index.ios.js
`render() {
StatusBar.setBarStyle('light-content', true);
StatusBar.setTranslucent(true)
StatusBar.setHidden(true)
return (
<SafeAreaView style={{ flex:1,backgroundColor:BACKGROUND,}}>
<View style={{flex:1}}>
<StatusBar hidden={true} />
<Provider store={store}>
<RouterComponent />
</Provider>
</View>
</SafeAreaView>
);
}
)`
My React Native app on iOS 10 starts from under the status bar but in iOS 11 the app starts from below the status bar. I want to start the app from 0x 0y off screen for all versions of iOS and the nav bar under the status bar. In Android there is a function called setTranslucent() but on iOS I didn’t find a function which supports this. In my index.ios.js @redmar @mojodna @aroth
Issue Analytics
- State:
- Created 6 years ago
- Reactions:15
- Comments:20 (9 by maintainers)
Top Results From Across the Web
<SafeAreaView> not work (Views go above the notification tab)
According to react-native docs: The purpose of SafeAreaView is to render content within the safe area boundaries of a device.
Read more >Supporting safe areas | React Navigation
While React Native exports a SafeAreaView component, it has some inherent issues, i.e. if a screen containing safe area is animating, it causes...
Read more >SafeAreaView - React Native
The purpose of SafeAreaView is to render content within the safe area boundaries of a device. It is currently only applicable to iOS...
Read more >react-native-safe-area-context - npm
SafeAreaView is a regular View component with the safe area insets applied as padding or margin. Padding or margin styles are added to...
Read more >Usage of SafeAreaView and View in React native - Medium
Nowadays in market, every phones has common is camera notches; whether it is android or iOS devices. Notches means where punch-hole camera space...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Have the exact same issue with SafeAreaView. Definitely smells like a bug.
Same code running in two simulators side by side. Happens on actual devices too:
Code:
The workaround we currently use is to add padding to our heading component if iOS version is under 11:
Looks like @vovkasm clearly describe why this happens on iOS 10: https://github.com/facebook/react-native/issues/17638#issuecomment-366534837. Closing as that seems to provide a reasonable workaround.