加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-15 06:46:28 所属栏目:百科 来源:网络整理
导读:我不能得到这个简单的NavigatorIOS测试工作。控制台登录在我的视图触发器,如果??我跳过NavigatorIOS组件,我可以让它渲染,并直接渲染MyView。但是,当MyView从NavigatorIOS组件中的组件触发时,它不会呈现“My NavigatorIOS test”以外的任何内容。 var Re
我不能得到这个简单的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组件包装器样式。这固定了问题。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读