在React-native中获取props.navigation未定义

时间:2017-07-27 08:10:25

标签: react-native

在我的主应用页面中:

const App = StackNavigator({ sign-up: { screen: Signup }, });
注册页面上的

const { navigate } = this.props.navigation;

<Text onPress={() => navigate(‘sign-up’)} Sign Up</Text>

我错过了什么?

1 个答案:

答案 0 :(得分:4)

this github问题评论中提到的那样使用它:

const SimpleApp = StackNavigator({
  Home: { screen: HomeScreen }, 
});

AppRegistry.registerComponent('SimpleApp', () => SimpleApp);