如果您打开默认应用程序,则可以看到app.js文件看起来像
import React from 'react'; import { StyleSheet, Text, View } from 'react-native'; export default class App extends React.Component { render() { return ( <View style = {styles.container}> <Text>Open up App.js to start working on your app!</Text> <Text>Changes you make will automatically reload.</Text> <Text>Shake your phone to open the developer menu.</Text> </View> ); } } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#fff', alignItems: 'center', justifyContent: 'center', }, });
要显示一条简单的消息“ Welcome to Learnfk”,请删除CSS部件,然后将要打印的消息插入<view> </ view>内的<text> </ text>标签包裹,如下所示。
import React from 'react'; import { StyleSheet, Text, View } from 'react-native'; export default class App extends React.Component { render() { return ( <View> <Text>Welcome to Learnfk</Text> </View> ); } }
这一章《React Native - 应用程序》你学到了什么?在下面做个笔记吧!做站不易,你的分享是对我们最大的支持
获取 TypeError:this.InnerNativeModule.configureProps 不是 ma...
Property body[41] of BlockStatement expected node to be of a...
React-native,iOS模拟器停止响应CMD + D
如何修复 npm start “cannot determine native SDK version”错误...
如何在 React Navigation 5 中将父函数传递给子屏幕?