React-native-navigation: [V2] Unable to hide backButton

Created on 4 Dec 2018  路  23Comments  路  Source: wix/react-native-navigation

Issue Description

I'm unable to hide the backButton on the topBar. I don't want to make the entire topBar visible:false as suggested here: https://github.com/wix/react-native-navigation/issues/3826 as I want some rightButtons.

Steps to Reproduce / Code Snippets / Screenshots

I tried this:

options: {
        topBar: {
          backButton: { }
        }
      }

But the button was still visible and worked. As a hack/workaround I can do this as my top bar is white:

      options: {
        topBar: {
          backButton: { color: '#ffffff' }
        }
      }

But its not ideal since the buttons is still there just not visible. I would have expected backButton: {} to clear it out.


Environment

  • React Native Navigation version: 2.0.2641
  • React Native version: 0.57.0
  • Platform(s) (iOS, Android, or both?): IOS
  • Device info (Simulator/Device? OS version? Debug/Release?): Simulator
馃彋 stale

Most helpful comment

A workaround

        leftButtons: [
          {
            id: 'something',
            text: '',
          },
        ],

All 23 comments

I guess its possible to Navigation.setRoot as well but then you lose the slide effect.

If you look at the documentation, there is a style option for backButton. Link.
You can do:

topBar: {
    backButton: {
        visible: false
    }
}

Doesnt look like this works in 2.2.0 on iOS

A workaround

        leftButtons: [
          {
            id: 'something',
            text: '',
          },
        ],

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 an issue.

I second this request, this is quite a big issue. Current state: it does work on IOS but not on Android.

@kiroukou as a work around I added backgroundColor: ' transparent'.

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.

still an 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.

still an issue

Damn, I thought to find a solution on this issue here :/
The workaround with the empty leftButton is no solution because it leave the gap on the left side.

As @thinklinux mentioned, this workaround is working fine:

leftButtons: [ { id: 'something', text: '', }, ],

The thing is you need to use this when you are pushing the screen and not in mergeOptions

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.

The issue has been closed for inactivity.

This is still an issue.

Can confirm the following does not work on Android.

backButton: {
   visible: false,
},

Seems to be an issue still.

Still an issue, I don't know what's going on with wix but this is SOOO sooo bad man.
Feels like this library has ben left to rot, all the issues get closed after months of existence without anyone ever taking a look at them, and this just hurts the wix brand I think.

I believe the way to go is start looking for maintainers for this repo..

I'm using RNN 6.6.2 issue still not fixed. Any updates about this problem? @guyca

Still not fixed on Android and RNN v6.10.1. Still having this issue since v2...

Please reopen!

Hey @zabojad
I've tried hiding the back button in the Playground app both in static and merge options. Both seem to work as expected on Android.

Hiding the back button with mergeOptions

<Button
  label="Hide back button"
  onPress={() => {
    Navigation.mergeOptions(this, {
      topBar: {
        backButton: {
          visible: false,
        },
      },
    });
  }}
/>

Hiding the back button with static options

  static options(): Options {
    return {
      topBar: {
        backButton: {
          visible: false,
        },
      },
    };
  }

If this is still an issue - please open another issue and provide a reproduction. Thanks and sorry for the inconvenience.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

reganperkins picture reganperkins  路  31Comments

maurovisintin picture maurovisintin  路  101Comments

harveyconnor picture harveyconnor  路  57Comments

fuatsengul picture fuatsengul  路  40Comments

mohdabbas picture mohdabbas  路  93Comments