Answer the question
In order to leave comments, you need to log in
How to pass a variable from a local state to navigationOptions?
How to pass value from local state to
static navigationOptions = ({ navigation }) => {
return {
title: `Значение которое нужно прокинуть`,
headerLeft: <Icon
name="angle-left"
color="#FFF"
size={30}
style={{ marginLeft: 20 }}
onPress={() => navigation.navigate('Test')} />
};
};
Answer the question
In order to leave comments, you need to log in
you need to put the value in the navigator for example
this.props.navigation.setParams({isHeaderShow: <true | false>});
static navigationOptions ({navigation}) => {
return {
headerVisible: navigation.state.params.isHeaderShow
}
}
You need to use this.props.navigation.state
There is a detailed example in the dock
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question