React Native & Android & iOS

React Native & Android & iOS

https://facebook.github.io/react-native/
https://facebook.github.io/react-native/docs/getting-started

https://github.com/facebook/react-native

# Xcode & Android Studio

# Watchman is a tool by Facebook for watching changes in the filesystem.

$ brew install watchman

$ npm i -g react-native-cli
# OR
$ yarn global add react-native-cli

yarn & global

https://yarnpkg.com/zh-Hans/docs/cli/add
https://yarnpkg.com/zh-Hans/docs/cli/global

0.59.0

Latest release

https://github.com/facebook/react-native/releases


$ react-native init AwesomeProject

# Using a specific version
$ react-native init AwesomeProject --version X.XX.X
$ react-native init AwesomeProject --version react-native@next

$ react-native init demo_app

$ react-native init demo_app  --version 0.59.0
$ react-native init demo_app  --version react-native@next

iOS & Android

# iOS
$ cd demo_app
$ react-native run-ios

# OR
$ cd demo_app && react-native run-ios

# Android
$ cd demo_app && react-native run-android

React Native Tutorial

https://www.tutorialspoint.com/react_native/index.htm
https://www.tutorialspoint.com/react_native/react_native_tutorial.pdf

https://www.raywenderlich.com/247-react-native-tutorial-building-android-apps-with-javascript
https://www.toptal.com/react-native/cold-dive-into-react-native-a-beginners-tutorial
https://school.shoutem.com/lectures/build-react-native-mobile-app-tutorial/

React

demo

https://jscomplete.com/repl/


"use strict";

/**
 *
 * @author xgqfrms
 * @license MIT
 * @copyright  React Refs
 * @description
 * @augments
 * @example
 *
 */

import React, { Component, PureComponent } from "react";
import ReactDOM from "react-dom";
import PropTypes from "prop-types";

class ReactInput extends React.Component {
    render(props) {
        return (
            <div>
                <input type="text" onChange={this.props.handleInput} />
                {/* <input type="text" ref="c" onChange={this.props.handleInput} /> */}
                <code>{this.props.message}</code>
            </div>
        );
    }
}

class ReactRefs extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            inputA: "aaa",
            inputB: "bbb",
            inputC: "ccc",
        };
        this.updateValueA = this.updateValueA.bind(this);
        this.updateValueB = this.updateValueB.bind(this);
        this.handleInput = this.handleInput.bind(this);
    }
    updateValueA(e) {
        this.setState({
            // inputA: this.refs.a.value,
            inputA: e.target.value,
            // e.target === this.refs.a
        });
    }
    updateValueB() {
        this.setState({
            inputB: this.refs.b.value,
            // this.refs.b
        });
    }
    handleInput() {
        this.setState({
            inputC: this.c.refs.input.value,
            // this.c === components (ReactInput)
        });
    }
    render() {
        return (
            <section>
                <h1>{this.props.name}</h1>
                <div>
                    <input type="text" ref="a" onChange={(e) => this.updateValueA(e)} />
                    <code>{this.state.inputA}</code>
                </div>
                <div>
                    <input type="text" ref="b" onChange={this.updateValueB} />
                    <code>{this.state.inputB}</code>
                </div>
                <ReactInput
                    ref={component => this.c = component}
                    onChange={this.handleInput}
                    message={this.state.inputC}
                />
            </section>
        );
    }
}

ReactRefs.defaultProps = {
    name: "xgqfrms",
};

ReactRefs.propTypes = {
    name: PropTypes.string.isRequired,
};

export {ReactInput, ReactRefs};
export default ReactRefs;

ReactDOM.render(<ReactRefs />, mountNode);

React and Redux

https://learn.freecodecamp.org/front-end-libraries/react/
https://learn.freecodecamp.org/front-end-libraries/redux/
https://learn.freecodecamp.org/front-end-libraries/react-and-redux/


https://learn.freecodecamp.org/front-end-libraries/react-and-redux/manage-state-locally-first

"use strict";

/**
 *
 * @author xgqfrms
 * @license MIT
 * @copyright xgqfrms
 * @created 2019-01-01
 *
 * @description react-redux
 * @augments
 * @example
 *
 */

import React, { Component, PureComponent } from "react";
// import ReactDOM from "react-dom";
// import PropTypes from "prop-types";

// class DisplayMessages extends Component {
class DisplayMessages extends React.Component {
    // change code below this line
    constructor(props) {
        super(props);
        this.state = {
            messages: [],
            input: "",
        };
        this.handleChanget = this.handleChange.bind(this);
        this.submitMessage = this.submitMessage.bind(this);
    }
    // add handleChange() and submitMessage() methods here
    handleChange(e) {
        this.setState({
            // input: this.refs.a.value,
            input: e.target.value,
            // e.target === this.refs.a
        });
    }
    submitMessage() {
        let {
            input,
            messages,
        } = this.state;
        // messages.push(input);
        // console.log(`messages =`, JSON.stringify(messages, null, 4));
        let new_messages = [...messages, input];
        console.log(`new_messages =`, JSON.stringify(new_messages, null, 4));
        this.setState({
            input: "",
            // messages: messages,
            messages: new_messages,
        });
    }
    // change code above this line
    render() {
        let {
            input,
            messages,
        } = this.state;
        return (
            <div>
                <h2>Type in a new Message:</h2>
                { /* render an input, button, and ul here */ }
                {/* <input type="text" ref="a" onChange={(e) => this.handleChange(e)} /> */}
                <input type="text" value={input} onChange={(e) => this.handleChange(e)} />
                <button onClick={this.submitMessage}>click</button>
                <ul>
                    {
                        messages.map(
                            (item, i) => {
                                return <li key={i}>{item}</li>;
                            }
                        )
                    }
                </ul>
                { /* change code above this line */ }
            </div>
        );
    }
};

help

refs

https://zh-hans.reactjs.org/docs/error-decoder.html/?invariant=254&args[]=a

https://fb.me/react-refs-must-have-owner
https://reactjs.org/warnings/refs-must-have-owner.html

update state & ...arr

https://www.freecodecamp.org/forum/search?q=manage-state-locally-first

https://www.freecodecamp.org/forum/t/manage-state-locally-first-having-trouble/192075

https://www.freecodecamp.org/forum/t/manage-state-locally-first/190958

https://www.freecodecamp.org/forum/t/manage-state-locally-first/245357


React Native 中文文档

0.59

https://reactnative.cn/docs/

Android SDK

React Native & Android & iOS的更多相关文章

  1. React Native & Android & iOS & APK

    React Native & Android & iOS & APK https://play.google.com/apps/publish/signup/ $ 25 bui ...

  2. react-native —— 在Windows下搭建React Native Android开发环境

    在Windows下搭建React Native Android开发环境 前段时间在开发者头条收藏了 @天地之灵_邓鋆 分享的<在Windows下搭建React Native Android开发环 ...

  3. React native android 最常见的10个问题

    这里逐条记录下最容易遇到的React native android 相关case: 1. app启动后,红色界面,unable load jsbundle : 解决办法:一般来说就是,你是用dev-s ...

  4. React Native Android原生模块开发实战|教程|心得|怎样创建React Native Android原生模块

    尊重版权,未经授权不得转载 本文出自:贾鹏辉的技术博客(http://blog.csdn.net/fengyuzhengfan/article/details/54691503) 告诉大家一个好消息. ...

  5. react-native —— 在Mac上配置React Native Android开发环境排坑总结

    配置React Native Android开发环境总结 1.卸载Android Studio,在终端(terminal)执行以下命令: rm -Rf /Applications/Android\ S ...

  6. Windows 10 & React Native & Android

    Windows 10 & React Native & Android https://facebook.github.io/react-native/docs/getting-sta ...

  7. React Native Android启动白屏的一种解决方案上

    我们用RN去开发Android应用的时候,我们会发现一个很明显的问题,这个问题就是启动时每次都会有1~3秒的白屏时间,直到项目加载出来 为什么会出现这个问题? RN开发的应用在启动时,首先会将js b ...

  8. React Native Android 环境搭建

    因为工作需要,最近正在学习React Native Android.温故而知新,把学习的内容记录下来巩固一下知识,也给有需要的人一些帮助. 需要说明的是,我刚接触React Native也不久,对它的 ...

  9. React Native & Android & Text Input

    React Native & Android & Text Input react native clear input value https://stackoverflow.com ...

随机推荐

  1. 【转】iOS 音频-AVAudioSession

    1. AVAudioSession 概述 最近一年一直在做IPC Camera的iOS客户端开发.和音频打交道,必须要弄清楚 AVAudioSession. 先看下苹果的官方图:   Audio Se ...

  2. 11 python初学 (文件)

    对文件的操作分为 3 步: 打开文件: f = open('望月怀古', 'r', encoding='utf8') # 路径可以写绝对路径,也可以写相对路径: 操作 关闭文件: f.close() ...

  3. pytorch torch.Storage学习

    tensor分为头信息区(Tensor)和存储区(Storage) 信息区主要保存着tensor的形状(size).步长(stride).数据类型(type)等信息,而真正的数据则保存成连续数组,存储 ...

  4. Luogu P3378 【模板】堆

    ((^ 0.0 ^)    )~ 堆是一个完全二叉树,对于小根堆,所有父节点<=子节点,下标就和线段树是一样的 在STL里就是优先队列 只有堆顶元素可以操作(询问或弹出). 加入新元素时x,he ...

  5. oracle impdp将导出用户的所有对象导入至另一个用户下,生成的触发器语句问题处理

    问题产生的操作步骤及详细说明: 1)操作的数据库是oracle 11g,先通过命令将用户GAS_NEW的数据导出,命令语句如下: expdp GAS_NEW/GAS_NEW@ORCL schemas= ...

  6. VBS弹出来的对话框如何置顶!--果然技巧

    msgbox 第二参数+4096 mshta vbscript:msgbox("提示内容6",6,"提示窗口6")(window.close)

  7. EntityFramework Core并发深挖详解,一纸长文,你准备好看完了吗?

    前言 之前有关EF并发探讨过几次,但是呢,博主感觉还是有问题,为什么会觉得有问题,其实就是理解不够透彻罢了,于是在项目中都是用的存储过程或者SQL语句来实现,利用放假时间好好补补EF Core并发的问 ...

  8. 一篇 SpringData+JPA 总结

    概述 SpringData,Spring 的一个子项目,用于简化数据库访问,支持 NoSQL 和关系数据库存储 SpringData 项目所支持 NoSQL 存储 MongDB(文档数据库) Neo4 ...

  9. XenServer 5.5 断电重启虚拟机磁盘丢失的修复

    1.现象 公司云平台使用的是XenServer 5.5,版本比较老了.最近几天因为机房改造,导致云环境断电,重启之后发现有2台机器无法ping到,所以再次重启,登录修复网卡,最后发现无法用XenCen ...

  10. Mysql的使用,常用的SQL语句

    一.启动mysql服务 启动mysql服务: systemctl start mysqld.service root用户登录mysql: 修改root 密码: alter user 'root'@'l ...