• 欢迎访问少将全栈,学会感恩,乐于付出,珍惜缘份,成就彼此、推荐使用最新版火狐浏览器和Chrome浏览器访问本网站。
  • 吐槽,投稿,删稿,交个朋友,商务沟通v:ai_draw
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏少将全栈吧

React Native : Unexpected view type nested under text node

Web前端 admin 8年前 (2016-10-12) 3074次浏览 已收录 0个评论 扫描二维码

class Awes extends Component {
  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>
        Welcome to React Native!  <Button>暂存</Button>
        </Text>  
        <Button>提交</Button>
        <Text style={styles.instructions}>
          To get started, edit index.android.js
        </Text>
        <Text style={styles.instructions}>
          Shake or press menu button for dev menu
        </Text>
      </View>
    );
  }
}

Text的标签下面套用Button会报如下错误。

React Native : Unexpected view type nested under text node

修改为:

class Awes extends Component {
  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>
        Welcome to React Native!  
        </Text>
        <Button>暂存</Button>
        <Button>提交</Button>
        <Text style={styles.instructions}>
          To get started, edit index.android.js
        </Text>
        <Text style={styles.instructions}>
          Shake or press menu button for dev menu
        </Text>
      </View>
    );
  }
}

参考如下:http://stackoverflow.com/questions/38327133/react-native-unexpected-view-type-nested-under-text-node

喜欢 (0)
[🍬谢谢你请我吃糖果🍬🍬~]
分享 (0)
关于作者:
少将,关注Web全栈开发、项目管理,持续不断的学习、努力成为一个更棒的开发,做最好的自己,让世界因你不同。
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址