我不能得到这个简单的NavigatorIOS测试工作。控制台登录在我的视图触发器,如果我跳过NavigatorIOS组件,我可以让它渲染,并直接渲染MyView。但是,当MyView从NavigatorIOS组件中的组件触发时,它不会呈现“My NavigatorIOS test”以外的任何内容。
原文链接:https://www.f2er.com/react/302651.htmlvar React = require('react-native'); var { AppRegistry,StyleSheet,NavigatorIOS,Text,View,} = React; var navigation = React.createClass ({ render: function() { return ( <NavigatorIOS initialRoute={{ component: MyView,title: 'My NavigatorIOS test',passProps: { myProp: 'foo' },}}/> ); },}); var MyView = React.createClass({ render: function(){ console.log('My View render triggered'); return ( <View style={styles.container}> <Text style={styles.welcome}> Hello there,welcome to My View </Text> </View> ); } }); var styles = StyleSheet.create({ container: { flex: 1,justifyContent: 'center',alignItems: 'center',backgroundColor: '#F5FCFF',},welcome: { fontSize: 20,textAlign: 'center',margin: 10,} }); AppRegistry.registerComponent('navigation',() => navigation);