Skip to content

Instantly share code, notes, and snippets.

@anosikeosifo
Last active January 21, 2018 16:46
Show Gist options
  • Save anosikeosifo/526288e386ee2a12ea8160fd56cc3672 to your computer and use it in GitHub Desktop.
Save anosikeosifo/526288e386ee2a12ea8160fd56cc3672 to your computer and use it in GitHub Desktop.
//imports the navigators we've defined for our app
import ApplicationNavigator from "../navigators";
//used in connecting the app's navigation data to redux
import { addNavigationHelpers } from "react-navigation";
//takes the navigation slice of state and maps it to a prop, so we can used it around the application.
const mapStateToProps = state => ({
navigation: state.navigationData
});
const mapDispatchToProps = dispatch => ({ dispatch });
class ApplicationNavigatorContainer extends Component {
.
.
.
render() {
return (
<ApplicationNavigator
navigation={addNavigationHelpers({
dispatch: this.props.dispatch,
state: this.props.navigation
})}
/>
);
}
}
export default connect(mapStateToProps, mapDispatchToProps)(
ApplicationNavigatorContainer
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment