Alessio Chiffi
Alessio Chiffi

Reputation: 141

React Navigation without integration in Redux?

I am using Redux for other purposes, and I was wondering if is possible using standard React-Navigation with no integration in redux just registering the screens and using this.props.navigation.navigate as a function to navigate

This is in App.js

export default class App extends Component {
    render() {
      const Navigation = StackNavigator({
            Home: {screen: Home },
            Page: {screen: Page },
        });
        return (
            <Provider store={store}>
                <Home />
            </Provider>
        );
    }
}

and this is in home.js

<Button transparent style={{position: 'absolute', top: 0}} onPress={() => this.props.navigation.navigate("Page")}>

<Text style={{ color: '#403f3f' }}>10</Text>

 </Button>

Pressing on the button I get 'undefined is not an object(evaluate this.props.navigation.navigate)'

Upvotes: 0

Views: 222

Answers (1)

Alexander Vitanov
Alexander Vitanov

Reputation: 4141

Yes, but you have to render the whole StackNavigation, in your case <Navigation/> instead of <Home/>.

Upvotes: 2

Related Questions