React-native-navigation: [V2] iOS back gesture doesn't work when topBar or backButton is hidden

Created on 15 Dec 2018  路  12Comments  路  Source: wix/react-native-navigation

Issue Description

Back gesture doesn't work when topBar or backButton's visible set to false

Steps to Reproduce / Code Snippets / Screenshots

Navigation.push(this.props.componentId, {
  component: {
    name: 'example.PushedScreen',
    passProps: {
      text: 'Pushed screen'
    },
    options: {
      topBar: {
        visible: false
      }
    }
  }
});

or

Navigation.push(this.props.componentId, {
  component: {
    name: 'example.PushedScreen',
    passProps: {
      text: 'Pushed screen'
    },
    options: {
      topBar: {
        backButton: {
          visible: false
        }
      }
    }
  }
});

Environment

  • React Native Navigation version: 2.2.1-snapshot.61
  • React Native version: 0.57.7
  • Platform(s): iOS
  • Device info: Both simulator & device, iOS 12, Both debug & release
iOS acceptebug 馃搶 pinned

Most helpful comment

It's not stale - I'm still having this issue

All 12 comments

I encountered the same issue today. After some googling I came across this Native iOS issue on Stackoverflow.

However, my iOS experience is extremely limited. So I'm not able to verify or try to fix the problem myself.

Doesn't matter (in my case) if it's hidden or not. As soon as you're using custom left button, the gesture is gone! Was using 2.1.3 and it was working fine (now on 2.2.5).

It's still happening on 2.4.0, any idea how to fix it?

@ptfly I still have the same problem on 2.5.0.

Probably a very dirty fix. Since I don't have any experience in iOS.

I did some testing with answers from the stackoverflow page @SasjaVDD suggested.

This works for me:

  1. Open xCode
  2. Open Libraries>ReactNativeNavigation.xcodeproj
  3. Open file: UINavigationController+RNNOptions.m
  4. Replace
- (void)rnn_setNavigationBarVisible:(BOOL)visible animated:(BOOL)animated {
    [self setNavigationBarHidden:!visible animated:animated];
}
  1. With this
- (void)rnn_setNavigationBarVisible:(BOOL)visible animated:(BOOL)animated {
    [self setNavigationBarHidden:!visible animated:animated];

    // enable slide-back
    if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        self.interactivePopGestureRecognizer.enabled = YES;
        self.interactivePopGestureRecognizer.delegate = nil;
    }
}

I'm setting a delegate to nil. I don't know what the unintended consequences are.

Also seeing this issue when upgrading to 2.2.5

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.

It's not stale - I'm still having this issue

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.

This is still relevant :-) There's a PR up fixing the problem since two months, I think it deserves a review.

Is this released already?

Is this fixed? I'm on 3.0.0-alpha.10 and it seems not to work

Was this page helpful?
0 / 5 - 0 ratings

Related issues

EliSadaka picture EliSadaka  路  3Comments

kiroukou picture kiroukou  路  3Comments

tmaly1980 picture tmaly1980  路  3Comments

nbolender picture nbolender  路  3Comments

yayanartha picture yayanartha  路  3Comments