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

How to hide the default backButtonIcon in NavigatorIOS? #1383

Closed
faithfe opened this issue May 23, 2015 · 7 comments
Closed

How to hide the default backButtonIcon in NavigatorIOS? #1383

faithfe opened this issue May 23, 2015 · 7 comments
Assignees
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@faithfe
Copy link

faithfe commented May 23, 2015

My code is:

<NavigatorIOS 
        ref='nav'
        style={styles.container}
        tintColor={'#FFFFFF'}
        barTintColor={'#009FDE'}
        titleTextColor={'#FFFFFF'}
        initialRoute={{
          title: 'Title',
          component: List,
          backButtonTitle: ' ',
          backButtonIcon: require('image!back_button'),
          leftButtonIcon: require('image!back_button'),
          rightButtonTitle: 'Right',
          onRightButtonPress: this._onRightButtonPress,
          onLeftButtonPress: this._onLeftButtonPress

        }}/>

I want to use my own back icon ('back_button') for backButtonIcon, but there are two back icons in the next page. How to hide the default one? tks

2015-05-23 10 56 32

@brentvatne
Copy link
Collaborator

Hi @faithfe - if you push a new route, you need to specify what the back button icon should be in that as well - not just in the initialRoute. Also, your left button looks like it also has the back button image.

If the above doesn't help, can you post a runnable example on https://rnplay.org/ please?

@brentvatne brentvatne self-assigned this May 24, 2015
@faithfe
Copy link
Author

faithfe commented May 25, 2015

thanks @brentvatne, it works!
Another question, i fail to use uri to locate the icon, but use 'require' is ok:
backButtonIcon: require('image!back_button'),
leftButtonIcon: {uri: 'http://xx/back_button.png'},

@ide
Copy link
Contributor

ide commented May 25, 2015

@faithfe, only local images are supported with NavigatorIOS.

@faithfe
Copy link
Author

faithfe commented May 25, 2015

@ide , ok, tks!

@richarddewit
Copy link

I still have this issue.

Both on my initialRoute and the next pushed route, I set the backButtonIcon to my desired image.

backButtonTitle: " ",
backButtonIcon: require('image!ButtonBack'),

But this comes out:
image

Although when I omit the Back button, and use a Left button instead, the issue is solved, but I have to make my own "Navigate back" function (this.refs.nav.pop()) which IMO shouldn't be the way it's intended.

leftButtonTitle: "",
leftButtonIcon: require("image!ButtonBack"),
onLeftButtonPress: this.refs.nav.pop,

But this way, the "Swipe to go back" functionality is gone..

@rmdort
Copy link

rmdort commented Nov 18, 2015

I am facing the same problem as @richarddewit

backButtonIcon, backButtonTitle is not working as expected. The left arrow is always visible. New routes with custom backButtonIcon or backButtonTitle doesnt show

this.props.navigator.push({
    title: 'Next',
    component: Next,
    backButtonIcon: require('./../img/Back.png')    
})

image

@ide
Copy link
Contributor

ide commented Nov 18, 2015

I believe this is how UIKit behaves, though if there's a way to override the back button icon with UINavigationController please send a PR.

@facebook facebook locked as resolved and limited conversation to collaborators May 29, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

6 participants