Tell us which versions you are using:
Since android already has a back button, is it possible to completely remove the leftButton (back etc)?
I've tried renderBackButton={null} and hideBackImage={false} and they didn't work.
I was going to reply here and ask how you solved this issue, then i realized you had tried hideBackImage={false} where it SHOULD be hideBackImage={true} or simply: hideBackImage.
<Scene key='myScreenWithNoBackButton' component={MyScreenWithNoBackButton} hideBackImage />
@markrickert @alexcurtis I am using hideBackImage. While the image does not appear, if I press the spot where the back button would be, it still navigates back. 馃槙
Tell us which versions you are using:
@AndrewHenderson hey!
i've hacked this annoying behavior like this:
<Scene key='myScreenWithNoBackButton'
component={MyScreenWithNoBackButton}
hideBackImage onBack={() => null}/>
hope it helps you 馃槂
have a good one!
import { BackAndroid } from 'react-native';
componentWillMount() {
BackAndroid.addEventListener('hardwareBackPress', () => {return true});
}
Use:
import { ... BackAndroid } from 'react-native';
componentDidMount() {
BackAndroid.addEventListener('hardwareBackPress', () => { return true });
...
}
componentWillMount() {
BackAndroid.removeEventListener('hardwareBackPress', () => { return true });
...
}
@vnhnhm A quite note to say that your event handler won't be removed in the code you posted. You're creating a new instance of a closure and passing it to removeEventListener.
We use:
constructor(props) {
....
this.handleBackAndroid = () => true;
}
componentDidMount() {
BackAndroid.addEventListener('hardwareBackPress', this.handleBackAndroid);
...
}
componentWillMount() {
BackAndroid.removeEventListener('hardwareBackPress', this.handleBackAndroid);
...
}
Thanks @benvium, I haven't noticed it.
Most helpful comment
@AndrewHenderson hey!
i've hacked this annoying behavior like this:
<Scene key='myScreenWithNoBackButton' component={MyScreenWithNoBackButton} hideBackImage onBack={() => null}/>hope it helps you 馃槂
have a good one!