React Native学习(三)---完成Hello World教程

官方教程

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,
  },
});
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 引用的原文路径:https://www.cnblogs.com/l1pe1/p/8310757.html Reac...
    sunney0阅读 801评论 0 11
  • //两个按钮 点击那个 另一个就取消选择//也可以取消两个按钮的选择状态//也可以对单独一个按钮 进行选择和取消 ...
    博行天下阅读 838评论 0 0
  • GCD即Grand Central Dispatch,它是异步执行任务的技术之一。一般将应用程序中技术的线程管理用...
    faterman阅读 74评论 0 0
  • 从来熟悉乡间路,主邀客、相携去。未到门前天欲暮。绕过香径,更惊犬吠,挡在通幽处。 主人吆喝声如许,忙里迎宾递乡语。...
    雪窗_武立之阅读 246评论 0 7
  • 今天周日,郑州,雨。 大学就在郑州读,工作了还在郑州,只是一个东西位置之分。然而至今工作时间有半年了,期间没有约过...
    益源阅读 250评论 0 1