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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Header Icon Button #1989
Comments
Can you post what you've tried? You can use static navigationOptions = ({ navigation }) => ({
headerLeft: <MyCustomComponent>
}); |
@matthamil Seizing this issue, when I set a custom button in the headerLeft in a StackNavigator, the back button is no longer displayed. How can I add a button in headerLeft and keep the back button when a new view is pushed? |
closing since the original question is a duplicate of #145 |
how to add onpress event to that this was added to headerLeft? |
how to add functionality to it |
@lylest , check out this page in the docs: https://reactnavigation.org/docs/en/header-buttons.html#adding-a-button-to-the-header. Here's an example of adding an class YourScreenComponent extends React.Component {
static navigationOptions = ({ navigation }) => {
return {
headerLeft: (
<Button
onPress={navigation.getParam('onPressHeaderButton')}
/>
),
};
};
componentDidMount() {
this.props.navigation.setParams({ onPressHeaderButton: this.showAlert });
}
showAlert = () => {
Alert.alert('Huzzah!', 'You pressed a button in the header!')
};
render() {
// ...
} |
Hey,
I need to put an Icon in the left corner of my Header but, how can i link onPress with a method of my Component ?
I've tried a lot of code but nothing work!
So, if you have already did that, if you have some code piece 馃憤
Thanks :)
The text was updated successfully, but these errors were encountered: