我不能得到这个简单的NavigatorIOS测试工作。控制台登录在我的视图触发器,如果我跳过NavigatorIOS组件,我可以让它渲染,并直接渲染MyView。但是,当MyView从NavigatorIOS组件中的组件触发时,它不会呈现“My NavigatorIOS test”以外的任何内容。
var 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);
我有一个类似的问题。我在样式表中添加了以下内容:
... wrapper: { flex: 1,}...
然后给NavigatorIOS组件包装器样式。这固定了问题。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。