React-native-router-flux: How to hide/disable back button text?

Created on 5 Nov 2017  路  9Comments  路  Source: aksonov/react-native-router-flux

Version

Tell us which versions you are using:

  • react-native-router-flux v4.0.0-beta.22 (v3 is not supported)
  • react-native v0.45.1

Expected behaviour

Hide back button text by using backTitle=""

Actual behaviour

Still displays back button title

Steps to reproduce

For non-obvious bugs, please fork this component, modify Example project to reproduce your issue and include link here.
1.
2.
3.

question

Most helpful comment

As told in https://github.com/aksonov/react-native-router-flux/issues/2219, passing the prop backTitle = " " (_space in quotes_; NOT empty string) does the job

All 9 comments

Just use left={()=>null} to hide whole left/back button or just backTitle=' ' to make back button text invisible

@aksonov when I do backTitle=' ' , the back button always displays, including when there isn't a scene to navigate back to

As told in https://github.com/aksonov/react-native-router-flux/issues/2219, passing the prop backTitle = " " (_space in quotes_; NOT empty string) does the job

@y2k-shubham when I do that , the back button always displays, including when there isn't a scene to navigate back to

y2k-shubham's trick worked for me with:

"react-native": "0.53.3",
"react-native-router-flux": "^4.0.0-beta.28",

@g4laura this solution is meant to hide only the text along-side the back button and not the back button itself. While I haven't tried hiding the back button, see if https://github.com/aksonov/react-native-router-flux/issues/1509 can help. Better yet, give a try to @aksonov's solution by setting prop left={()=>null}

I'm having the same problem as @g4laura. I want to remove the back button titles but when I add backTitle = " " the back button start showing in every screen even if there wasn't one before adding that property. Is there any solution in which the back button doesn't show when is not suppose to?

@y2k-shubham how could I change it dynamically, I want to disable back button when some progress is on loading, and after progress is done, I show it again?

my workaround for hide/show dynamically is changing navigation setParams property which related to the react-navigation is:

useEffect(() => {
    props.navigation.setParams({
      left:
        state.sync.isSending || state.uploadPhotos.isUploading ? null : (
          <RenderBackButton />
        ),
    });
  }, [state.sync.isSending, state.uploadPhotos.isUploading]);

RenderBackButton component:

export const RenderBackButton = () => (
  <TouchableOpacity onPress={() => Actions.pop()}>
    <View style={styles.backButtonWrapper}>
      <Icon type="Ionicons" name="ios-arrow-back" style={styles.icon} />
      <Text style={styles.text}>Lista Impianti</Text>
    </View>
  </TouchableOpacity>
);
Was this page helpful?
0 / 5 - 0 ratings

Related issues

basdvries picture basdvries  路  3Comments

VictorK1902 picture VictorK1902  路  3Comments

vinayr picture vinayr  路  3Comments

xnog picture xnog  路  3Comments

YouYII picture YouYII  路  3Comments