I need to navigate between two view in React Native. But the problem is my component where the button to navigate is on an other component. I use the react-navigation.
Let me show you :
I have my component MainPage here
class MainPage extends Component {
render() {
return <View style={styles.container}>
<ComponentWithButton />
</View>
}
}
So in my component ComponentWithButton :
class ComponentWithButton extends Component {
goToComponent(){
this.props.navigation.push('Next')
}
render() {
return <View style={styles.container}>
<Button onPress={this.goToComponent.bind(this)}/>
</View>
}
}
My next component is called NextComponent
.
I have the error undefined is not an object (evaluating "this.props.navigation.push")
My stack navigator is this :
const RootStack = StackNavigator(
{
Main: {
screen: MainPage
},
Next: {
screen: NextComponent
}
},
{
initialRouteName: "Main"
},
{
navigationOptions: {
header: { visible: false }
}
}
);
I try to run my code with just one component it's working perfectly. I think there is problem because ComponentWithButton
is not called in my RootStack
or something like that. I don't know I am a newbie
So this time I have a HTML table and when I click in a anchor that is located in a tag it opens a modal, where we can change a user password. But to update the password in the users table I need to ...
So this time I have a HTML table and when I click in a anchor that is located in a tag it opens a modal, where we can change a user password. But to update the password in the users table I need to ...
I have a few html pages that share the same navbar. Therefore I wrote one html file - topnav.html and I used the following jQuery code to load it into every page. javascript <script type="text/...
I have a few html pages that share the same navbar. Therefore I wrote one html file - topnav.html and I used the following jQuery code to load it into every page. javascript <script type="text/...
Within a redux saga I am sending a half dozen fetch requests to different systems. I want to wait until all those requests return, then do some final processing on the results. To this end I have an ...
Within a redux saga I am sending a half dozen fetch requests to different systems. I want to wait until all those requests return, then do some final processing on the results. To this end I have an ...
I would like to change my navigationbar background color , but return to me : TypeError: Object is not a function(evaluating 'renderHeader'); How can i fix this error? static navigationOptions = ({...
I would like to change my navigationbar background color , but return to me : TypeError: Object is not a function(evaluating 'renderHeader'); How can i fix this error? static navigationOptions = ({...