编写第一个 React Native 程序
warning:
这篇文章距离上次修改已过182天,其中的内容可能已经有所变动。
import React from 'react';
import { Text, View } from 'react-native';
export default class MyApp extends React.Component {
render() {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text>Hello, React Native!</Text>
</View>
);
}
}
这段代码创建了一个简单的React Native应用程序,它在屏幕上居中显示文本“Hello, React Native!”。这是学习React Native的一个很好的起点,因为它演示了如何设置项目,以及React Native组件的基本结构。
评论已关闭