ios端运行时出现下面错误。
1.Clear watchman watches: `watchman watch-del-all`.
2.Delete the `node_modules`folder: `rm -rf node_modules && npm install`.
3.Reset packager cache: `rm -fr $TMPDIR/react-*`or `npm start -- --reset-cache`.
推测是node_modeules 中缺少prop-types组件导致
执行下面命令:
npm install prop-types
然后按上面提示的3个命令重新执行一边,解决该问题。
然后出现AppRegistry问题
在到入组件的代码中加入:AppRegistry
然后注册组件:AppRegistry.registerComponent('AwesomeProject',()=>AwesomeProject);
解决AppRegistry问题。
看不见按钮title问题。
因为加了navgationbar,view从0开始。被挡到了。加上
<View style ={{flex:1,top:64,backgroundColor:'powderblue'}}>就行了。
ios navigationbar高度为64.
ios可以设置从navigationbar下面开始算坐标。rn上暂时没找到怎么设置。后面再找找