Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Statusbar marginTop for navTransparent #3212

Merged
merged 2 commits into from
Aug 28, 2018
Merged

Conversation

rikochet
Copy link
Contributor

When using navTransparent feature, the headerStyle is removed causing the navbar to be obstructed by the Statusbar.

This fix adds marginTop to the headerStyle to that the navbar is aligned below the Statusbar.

When using navTransparent feature, the headerStyle is removed causing the navbar to be obstructed by the Statusbar. 
This fix adds marginTop to the headerStyle to that the navbar is aligned below the Statusbar.
@daviscabral
Copy link
Collaborator

Do you mind showing how is that behaving on Android and iOS before and after? I am trying here and not being able to see the problem or to confirm that this change is not going to break anything else for other people.

@daviscabral
Copy link
Collaborator

Also, could you check if SafeAreaView is not something that would fix this for you?

@rikochet
Copy link
Contributor Author

This issue only seems to affect Android.. You can see the difference before and after my patch in the attached illustration. iOS seems to display fine both with and without a StatusBar height..

patch

Copy link
Collaborator

@daviscabral daviscabral left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. One interesting thing is this:

Constants
currentHeight (Android only) The height of the status bar.

https://facebook.github.io/react-native/docs/statusbar

@daviscabral daviscabral added bug android Specific to Android and removed enhancement labels Aug 28, 2018
@daviscabral daviscabral merged commit e68e664 into aksonov:master Aug 28, 2018
daviscabral added a commit that referenced this pull request Aug 28, 2018
* master:
  Add StatusBar marginTop for navTransparent (#3212)
@smilingkylan
Copy link

Are we sure that this was an appropriate fix? My transparent header NavBar was positioned fine before this update and now it appears as if it is pushed down by 24px on Android. According to this other GitHub issue it appears I'm not the only one having this problem.
#3291

Unfortunately since the headerStyle is overwritten for a navTransparent of true it means that I cannot manually change the marginTop back to 0.

@bang9
Copy link
Contributor

bang9 commented Jun 20, 2019

@daviscabral This is not good..
I'm not using status bar as absolute position in my app.. this merge occur error to me
Moreover, since the header itself set margin top, the user cannot set the styling through navigationBarStyle prop..

navigation never affected other positions, If user want to status bar as absolute position, just use padding top in the scene

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android Specific to Android bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants