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 randomly goes white, loses styles

See original GitHub issue

Description

I’m using native-stack. The header on one screen randomly goes white, even though it should be gray. The title font family also loses style.

Screenshots

Watch when I open the Account screen. Notice how the header keeps going white (incorrectly). After multiple quits, it finally works and becomes the correct color. 🤷🏼‍♂️

https://www.loom.com/share/ed22f7fd56cd4a449dec47c9a59f068d

Steps To Reproduce

Honestly, no idea. It’s totally random when this happens. My best guess is the fact that this header has a headerRight set, since it’s the only screen where this happens, and also the only screen with headerRight.

This is what my screen looks like:

<Screen
  name="User"
  component={UserProfileScreen}
  options={{
    title: 'Account',
    headerRight: function HeaderRight() {
      return <SignoutLink />
    }
  }}
/>

And for reference, this is my navigator:

<Navigator
      screenOptions={{
        contentStyle: {
          backgroundColor: colors.background,
        },
        headerStyle: {
          backgroundColor: colors.muted,
        },
        headerTitleStyle: {
          color: colors.text,
          fontFamily: font.bold, 
        },
        headerTintColor: colors.primary, 
      }}
      initialRouteName={initialRouteName}
    >

Expected behavior

The header should always be styled correctly.

Actual behavior

The header randomly flickers white on certain occasions, but not on others. See the video above.

Snack or minimal code example

Sorry, I haven’t been able to reproduce this yet. It’s very inconsistent.

Package versions

  • React: 16.13.1
  • React Native: 0.63.4
  • React Native Screens: ~3.0.0

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
nandorojocommented, Jun 20, 2021

I’m using 3.4.0 and it works well now! Thanks for the help.

1reaction
kacperkapusciakcommented, Jun 11, 2021

Hi @nandorojo 👋 I’m pretty sure this issue was fixed in v3.1.0. You can check the original issue for this here. Could you check if your issue persists in react-native-screens >=3.1.0?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to remove default styles from react-navigation?
I was making an app with react native and react-navigation. So what I did was I made a Login screen. Then I used...
Read more >
Configuring the header bar
In the example below, we set the tint color to white ( #fff ) so the back button and the header title would...
Read more >
React Navigation: I Like Your Style | by Daniel Merrill | Async
In this post, we'll go through basic styling, as well as using setParams() to dynamically alter the header based on user input. I'm...
Read more >
A guide to React Native Navigation
We'll integrate it to ensure you can go to the ItemDetail screen from ... it. header: ({navigation, route}) => ( <View style={{height: 56, ......
Read more >
createStackNavigator - React Navigation - Netlify
On iOS the stack navigator can also be configured to a modal style where screens slide in ... This may lead to white...
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