diff --git a/ios/NativeStarterKit.xcodeproj/project.pbxproj b/ios/NativeStarterKit.xcodeproj/project.pbxproj index d85bfcf..7959180 100644 --- a/ios/NativeStarterKit.xcodeproj/project.pbxproj +++ b/ios/NativeStarterKit.xcodeproj/project.pbxproj @@ -5,7 +5,6 @@ }; objectVersion = 46; objects = { - /* Begin PBXBuildFile section */ 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; }; 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; }; diff --git a/js/components/splashscreen/index.js b/js/components/splashscreen/index.js index 9d27ad1..ba02860 100644 --- a/js/components/splashscreen/index.js +++ b/js/components/splashscreen/index.js @@ -1,21 +1,29 @@ import React, { Component } from 'react'; import { Image } from 'react-native'; +import { connect } from 'react-redux'; +import { actions } from 'react-native-navigation-redux-helpers'; const launchscreen = require('../../../images/shadow.png'); -export default class SplashPage extends Component { +import { setIndex } from '../../actions/list'; + +const { + replaceAt, +} = actions; + +class SplashPage extends Component { static propTypes = { - navigator: React.PropTypes.shape({}), + navigation: React.PropTypes.shape({ + key: React.PropTypes.string, + }), } componentWillMount() { - const navigator = this.props.navigator; + console.log('splash, willMount, props: ', this.props); setTimeout(() => { - navigator.replace({ - id: 'login', - }); + this.props.replaceAt('splashscreen', { key: 'login' }, this.props.navigation.key); }, 1500); } @@ -25,3 +33,16 @@ export default class SplashPage extends Component { ); } } + +function bindAction(dispatch) { + return { + replaceAt: (routeKey, route, key) => dispatch(replaceAt(routeKey, route, key)), + setIndex: index => dispatch(setIndex(index)), + }; +} + +const mapStateToProps = state => ({ + navigation: state.cardNavigation, +}); + +export default connect(mapStateToProps, bindAction)(SplashPage); diff --git a/js/reducers/cardNavigation.js b/js/reducers/cardNavigation.js index 7b93c11..e41f944 100644 --- a/js/reducers/cardNavigation.js +++ b/js/reducers/cardNavigation.js @@ -6,7 +6,7 @@ const initialState = { index: 0, routes: [ { - key: 'login', + key: 'splashscreen', index: 0, }, ],