美文网首页
React Native学习(三)---完成Hello Worl

React Native学习(三)---完成Hello Worl

作者: 偶心依旧来 | 来源:发表于2018-06-07 21:12 被阅读12次

官方教程

React Native 中文网

阮一峰的ECMAScript 6 入门

将工程中app.js修改为如下保存,用xcode 打开工程跑起来了

import React, { Component } from 'react';
import {
  Platform,
  StyleSheet,
  Text,
  View
} from 'react-native';

const instructions = Platform.select({
  ios: 'Hello World iOS',
  android: 'Hello World android',
});

type Props = {};
export default class App extends Component<Props> {
  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.instructions}>
          {instructions}
        </Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});

相关文章

网友评论

      本文标题:React Native学习(三)---完成Hello Worl

      本文链接:https://www.haomeiwen.com/subject/noynsftx.html