[native-stack] Header is out of the safe area on Android
See original GitHub issueMoved from react-navigation/react-navigation#6797. Originally opened by @enheit
Current Behavior
The header navigation is rendered beyond safe area on Android devices.
Expected Behavior
The header should be rendered in ‘safe area’.
(this is how @react-navigation/stack
works)
How to reproduce
Create a screen by using Screen.Stack
from @react-navigation/native-stack
Your Environment
software | version |
---|---|
iOS or Android | Android (v9) |
@react-navigation/native | ^5.0.0-alpha.33 |
@react-navigation/native-stack | ^5.0.0 |
react-native-screens | ^2.0.0-beta.2 |
react-native | ~0.61.4 |
expo | ~36.0.0 |
node | v12.14.1 |
npm or yarn | 6.13.4 |
Issue Analytics
- State:
- Created 4 years ago
- Reactions:10
- Comments:11 (5 by maintainers)
Top Results From Across the Web
[native-stack] Header is out of the safe area on Android ...
When setting StatusBar translucent to true, header will get render out of safe area on android. StatusBar translucent=true StatusBar ...
Read more >Supporting safe areas
React Navigation handles safe area in the default header. However, if you're using a custom header, it's important to ensure your UI is...
Read more >Navigating Between Screens
This native-stack navigator uses the native APIs: UINavigationController on iOS and Fragment on Android so that navigation built with ...
Read more >A guide to React Native Navigation
In this guide, learn how to enable different types of navigation in your React Native apps by building an example e-commerce application.
Read more >react-navigation header has a faint line
While this question seems to be targeted at android, the answers also mention ... const styles = StyleSheet.create ({ safeArea : { flex:...
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
@WoLewicki I just realised that I might be running into a separate but similar issue. I seem to be getting the problem when using
import { createNativeStackNavigator } from "react-native-screens/native-stack";
to create my stack. Using the stack navigator from react-navigation seems to fix my issue.Here is an example: https://snack.expo.io/HqDtTeyzQ
I found a temp solution for Android while using Expo. In the
Screen
options
, when declaring your header (left, center and right), you can addheight
andmarginTop
to it and that can help, maybe not in all cases though.