question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[native-stack] Header is out of the safe area on Android with translucent status bar

See original GitHub issue

When setting StatusBar translucent to true, header will get render out of safe area on android.

StatusBar translucent=true tt

StatusBar translucent=false tt2

Snack code: https://snack.expo.io/Ld5Ma4ZNM

import * as React from 'react';
import { Text, View, StatusBar } from 'react-native';
import { enableScreens } from 'react-native-screens';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from 'react-native-screens/native-stack';

enableScreens();

const Stack = createNativeStackNavigator();

function HomeScreen() {
  return (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
      <StatusBar
        barStyle="light-content"
        backgroundColor="rgba(0, 0, 0, 0.3)"
        translucent
        animated
      />
      <Text>Home Screen</Text>
    </View>
  );
}

export default function App() {
  return (
    <NavigationContainer>
      <Stack.Navigator>
        <Stack.Screen name="Application" component={HomeScreen} />
      </Stack.Navigator>
    </NavigationContainer>
  );
}

Environment

software version
iOS or Android Android
@react-navigation/native 5.1.6
react-native-screens 2.7
react-native 0.62.2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
Jalson1982commented, May 1, 2020

@WoLewicki is it possible to look into this too? This is issue with android devices and header again 😦

1reaction
WoLewickicommented, May 25, 2020

I am investigating it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Supporting safe areas | React Navigation
Status bar overlay; Home activity indicator on iOS; Navigation bar on Android. The area not overlapped by such items is referred to as...
Read more >
How to use SafeAreaView for Android notch devices?
This should be the accepted answer as it takes uses the StatusBar.currentHeight instead of a arbitrary height. Note that the status bar height ......
Read more >
createStackNavigator - React Navigation - Netlify
Safe area insets for the screen. This is used to avoid elements like notch and status bar. By default, the device's safe area...
Read more >
react native splash screen status bar color - You.com
Safe Search: Moderate. Off. Moderate. Strict. Open links in a new tab ... Change color of statusBar in splashScreen react-native android.
Read more >
StatusBar - React Native
Android. ​. If the status bar is translucent. When translucent is set to true , the app will draw under the status bar....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found