Skip to content

Add ability to remove StatusBar from Header #3755

Description

@vruffer

Is your feature request related to a problem? Please Describe.

Rendering a StatusBar component as a part of the Header component causes a lot of side-effects. Such as not being able to implement custom StatusBar components, like the one described in this react-navigation guide.

Describe the solution you'd like

I think it would make sense to optionally render the StatusBar based on a prop. Such as:

 <Header
  statusBar={false}
/>

which would then make the Header component look something like

<>
  {props.statusBar === true && (
    <StatusBar
      barStyle={barStyle}
      translucent={true}
      backgroundColor={backgroundColor || theme?.colors?.primary}
      {...statusBarProps}
    />
  )}
</>

Describe alternatives you've considered

Since the last StatusBar in the render tree always takes preference, it is quite impossible to do custom logic on the StatusBar somewhere higher in the render tree, so I don't see another option, but please let me know if there's something I'm missing.

Additional context

If there are any issues with the approach that I've missed, please let me know, otherwise I'm happy to open a pull request with the above implementation 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions