wix / react-native-navigation

A complete native navigation solution for React Native
https://wix.github.io/react-native-navigation/
MIT License
13.03k stars 2.67k forks source link

iOS 14.2: Back Button vertically misaligned #6763

Open mrousavy opened 3 years ago

mrousavy commented 3 years ago

🐛 Bug Report

Since iOS 14.2, the back button is somewhat weirdly aligned (vertically).

iPhone without notch, iOS 14.1:

13

iPhone with notch, iOS 14.2:

14

To Reproduce

  1. Create screen with backbutton
  2. Run on iOS 14.2

Your Environment

arcziby commented 3 years ago

Any information about coming fixes?

yogevbd commented 3 years ago

Couldn't reproduce it on an iPhone 12 Pro running iOS 14.2. Could you please try to reproduce it in the playground app?

simulator_screenshot_D144B9A7-0D24-46CF-9844-C409333F76CB

arcziby commented 3 years ago

image after upgrade to 7.7.0 I still have wrong look

pontusstjerna commented 3 years ago

For us, it was the previous view missing a back button options (the root view of the stack in our case). When back button options was set for that view as well, the alignment was fixed.

My wild guess is that it is related to UINavigationItem *previousNavigationItem = previousViewControllerInStack.navigationItem; and the options are not applied to the current navigation item, but I am not really an Objective-C developer.

arcziby commented 3 years ago

any updates?

florinvasilevilsan commented 3 years ago

Any updates?

mateioprea commented 3 years ago

Can someone who's having this issue, fork the repo and provide a reproduction case in the playground app?

After that someone can look into it.

florinvasilevilsan commented 3 years ago

Iphone12, IOS 14.4

I managed to get this sorted in my case.

I can reproduce the issue in my project by using a stack that has no topBar.title.text defined. The initial screen that this stack is loading, as you can see in the image below, has the topBar.title.text set as empty string nor back button defined (I believe I added this in the past to solve another react-native-navigation issue, which I cannot remember atm). The entire topBar is hidden also.

// SearchScreen Screenshot 2021-07-07 at 12 24 33

Once I tap an item in the list above, the backButton title vertical alignment is top aligned, rather than middle. I am setting the topBar.backButton object for this screen , which has a title.

// CategoryListingScreen Screenshot 2021-07-07 at 12 31 10

// topBar options passed to the SearchScreen.

visible: false,
animate: false,
height: 0,
title: {
    text: 'Search',
    alignment: 'center',
},

// topBar options passed to the CategoryListingScreen.

backButton: {
    title: name,
    showTitle: true,
    visible: true,
},
title: {
    alignment: 'center',
    color: 'transparent',
},

I managed to fix the issue above by assigning a title to the topBar.title.text (does not matter what that is in my case(cause topBar is hidden on that screen), as long as you provide a non-empty string value).

So that's all. Hope this helps anyone who's having an issue.

phuongwd commented 3 years ago

Couldn't reproduce it on an iPhone 12 Pro running iOS 14.2. Could you please try to reproduce it in the playground app?

@yogevbd This issue is happening on real devices. I tested on iPhone X - 14.5 / 14.6

image

arcziby commented 2 years ago

+1