react-native-screens: Header background color doesn't work (IOS only)

Description

  1. I used Nesting navigators like this root stack nav -> stack nav -> bottom tab -> stack nav (last stack screen)
  2. Header style (backgroundColor) in my header in last stack screen doesn’t work
  3. Have some screen work but some screen don’t work.
  4. when close app and reopen app then sometime it work fine (yellow header) but sometime it doesn’t work(transparent header).

Screenshots

Screen Shot 2564-03-05 at 15 59 43 Screen Shot 2564-03-05 at 16 09 23

Steps To Reproduce

import { createNativeStackNavigator } from "react-native-screens/native-stack"
const Stack = createNativeStackNavigator<PrimaryMoreParamList>()
const HeaderCenter = (props: any) => {
  const { tx, text, ...rest } = props
  const textProps = tx ? { tx } : { text }
  return (<Text {...textProps} {...rest} preset="topic" />)
}
export function MoreNavigator() {
  return (
    <Stack.Navigator
      screenOptions={{
        headerShown: true,
        gestureEnabled: true,
        headerStyle: {
          backgroundColor: 'yellow',  // It should be yellow color
        },
        stackAnimation: 'slide_from_right',
      }}
    >
      <Stack.Screen name="more" component={MoreScreen}
        options={({ navigation, route }) => ({
          headerCenter: () => <HeaderCenter tx={"moreScreen.moreMenu"} />,
          headerHideShadow: false,
        })}
      />
    </Stack.Navigator>
  )
}

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 7
  • Comments: 26 (7 by maintainers)

Most upvoted comments

After a clean build on simulator with the patch, I think the bug should be fixed now (at least we haven’t had the same problem yet), now sure why it didn’t work yesterday 🤔️

Anyway, thanks for your help ❤️

Can you provide a code example with minimal configuration needed to reproduce the issue then?