I am trying to setup react navigation v3 with redux. In the react navigation docs I can successfully set up my navigation and it works fine without redux added. However, when I attempt to add my redux class App extends React.Component{...} and hook up my actions it throws the following error:
Invariant Violation: Invariant Violation: Could not find "store" in the context of "Connect(AuthScreen)". Either wrap the root component in a , or pass a custom React context provider to and the corresponding React context consumer to Connect(AuthScreen) in connect options.
App.js
const MainNavigator = createBottomTabNavigator({
welcome: { screen: WelcomeScreen },
auth: { screen: AuthScreen },
main: {
screen: createBottomTabNavigator({
map: { screen: MapScreen },
deck: { screen: DeckScreen },
review: {
screen: createStackNavigator({
review: { screen: ReviewScreen },
settings: { screen: SettingsScreen }
})
}
})
}
});
const AppContainer = createAppContainer(MainNavigator);
class App extends React.Component {
render() {
return (
<Provider store={store}>
<AppContainer />
</Provider>
);
}
}
export default AppContainer;
Here is my AuthScreen I want to connect redux to:
class AuthScreen extends Component {
componentDidMount(){
console.log('This is this.props in AuthScreen:')
console.log(this.props);
this.props.facebookLogin();
}
render(){
return(
<View>
<Text>AuthScreen</Text>
</View>
)
}
}
export default connect(null, actions)(AuthScreen);
I suspect I am not allowed to wrap the <Provider> tags around the app container like this, can someone give some insight on how this could be done?