组件不会在NavigatorIOS – React Native中呈现

我不能得到这个简单的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组件包装器样式。这固定了问题。

相关文章

react 中的高阶组件主要是对于 hooks 之前的类组件来说的,如...
我们上一节了解了组件的更新机制,但是只是停留在表层上,例...
我们上一节了解了 react 的虚拟 dom 的格式,如何把虚拟 dom...
react 本身提供了克隆组件的方法,但是平时开发中可能很少使...
mobx 是一个简单可扩展的状态管理库,中文官网链接。小编在接...
我们在平常的开发中不可避免的会有很多列表渲染逻辑,在 pc ...