• React Native 初步


    React Native 初步

    1、Create React Native App is the easiest way to start building a new React Native application. It allows you to start a project without installing or configuring any tools to build native code - no Xcode or Android Studio installation required

      npm install -g create-react-native-app

    2、Then run the following commands to create a new React Native project called "AwesomeProject":

      create-react-native-app App

      

      If you want to run your app on the iOS Simulator or an Android Virtual Device, please refer to the instructions for building projects with native code to learn how to install Xcode and set up your Android development environment. 然后按上述命令:

      npm run ios 或 npm run android

      

    3、Install the Expo client app on your iOS or Android phone and connect to the same wireless network as your computer. Using the Expo app, scan the QR code from your terminal to open your project.

      Expo下载地址:https://expo.io/tools

    4、警告

      1)使用create-react-native-app创建的项目,没有编译任何Native Code,无法添加自定义antive模块。

         只能使用 react-native api以及expo提供的 components。

      2)eject用于将create-react-native-app创建的应用转移成为react-native应用,过程不可逆。

    5、拥有独特的 react-native 库

      

    6、AppRegistry

      The AppRegistry just tells React Native which component is the root one for the whole application.

    // skip this line if using Create React Native App
    AppRegistry.registerComponent('AwesomeProject', () => HelloWorldApp);

    7、Image 的使用

    render() {
        let pic = {
          uri: 'https://upload.wikimedia.org/wikipedia/commons/d/de/Bananavarieties.jpg'
        };
        return (
          <Image source={pic} style={{ 193, height: 110}}/>
        );
      }
    View Code

    8、View

      A View is useful as a container for other components, to help control style and layout.

    <View style={{alignItems: 'center'}}>
            <Greeting name='Rexxar' />
            <Greeting name='Jaina' />
            <Greeting name='Valeera' />
          </View>
    View Code

    参考:

    http://facebook.github.io/react-native/docs/props.html

  • 相关阅读:
    Js五子棋游戏
    换肤
    jqzoom实战
    iphone开发笔记
    腾讯召实习生笔试题
    ajax( 汇率转化)
    20140805&nbsp;17:24
    加载上一级目录下的图片文件并得到加载图片的大小
    精确碰撞检测 bitmapData.hitTest
    buttonMode 与mouseChildren【替换鼠标之后不响应鼠标事件】
  • 原文地址:https://www.cnblogs.com/tekkaman/p/7587495.html
Copyright © 2020-2023  润新知