选择指定设备运行
查看可用的 iOS 设备
xcrun simctl list devices

指定设备运行
react-native run-ios --simulator "iPhone Xs Max"
如何注释
写代码不能注释肯定浑身难受
例子1:
var content = (
<Nav>
{/* 一般注释, 用 {} 包围 */}
<Person
/* 多
行
注释 */
name={window.isLoggedIn ? window.name : ''} // 行尾注释
/>
</Nav>
);
例子2:
type Props = {};
export default class App extends Component<Props> { //每个类对应页面
render() { //渲染函数
return (
<View style={styles.container}>
{/* 合法注释 */}
<Text style={styles.welcome}>我的第二个React Native应用!</Text>
<Text style={styles.instructions}>To get started, edit App.js</Text>
<Text style={styles.instructions}>{instructions}</Text>
</View>
);// 合法注释
}
}
const styles = StyleSheet.create({
container: {
flex: 1, //合法注释
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
值得注意:
>后注释一般用 {/* */},如果不在任何标签内,可以用 //, } 后注释用.>后使用 // 作为注释要注意,注释内容必须不在任何 html 标签里,否则会当成要显示的文本内容
参考:React Native -- 注释问题
网友评论