
React Native 入门与实战
蓝枫amy
Android开发工程师、HarmonyOS开发工程师
展开
-
React Native之样式
import React, {Component} from 'react';import {AppRegistry, StyleSheet, Text, View} from 'react-native';class HelloAndroid extends Component { render() { return ( <View>翻译 2017-04-10 10:35:30 · 315 阅读 · 0 评论 -
React Native第三方图片轮播库react-native-swiper的使用
1.首先执行命令行yarn add react-native-swiper2.执行成功后package.json文件中显示如下"dependencies": { "react": "16.6.3", "react-native": "0.58.4", "react-native-swiper": "^1.5.14" },3原创 2019-03-04 16:02:50 · 1525 阅读 · 1 评论 -
React Native第三方Dialog库react-native-popup-dialog
1.首先执行命令行yarn add react-native-popup-dialog2.执行成功后package.json文件中显示如下"dependencies": { "react": "16.6.3", "react-native": "0.58.4", "react-native-popup-dialog": "^0.17.0&q原创 2019-03-04 16:31:56 · 3251 阅读 · 1 评论 -
State(状态)
BlinkApp.js/** * Created by zhoujian on 2019/4/9. */import React, {Component} from 'react';import {Text, View} from 'react-native';import Blink from '../js/Blink'export default class Blin...翻译 2019-04-10 16:49:24 · 474 阅读 · 0 评论 -
高度与宽度
指定宽高FixedDimensionsBasics.js/** * Created by zhoujian on 2019/4/9. */import React, {Component} from 'react';import {AppRegistry, View,StyleSheet} from 'react-native';export default class ...翻译 2019-04-10 16:59:38 · 316 阅读 · 0 评论 -
处理文本输入
PizzaTranslator.js/** * Created by zhoujian on 2019/4/9. */import React, {Component} from 'react';import {AppRegistry, Text, TextInput, View} from 'react-native';export default class PizzaT...翻译 2019-04-10 17:04:24 · 124 阅读 · 0 评论 -
处理触摸事件
显示一个简单的按钮ButtonBasics.js/** * Created by zhoujian on 2019/4/9. */import React, {Component} from 'react';import {Alert, AppRegistry, Button, StyleSheet, View} from 'react-native';export de...翻译 2019-04-10 19:17:14 · 261 阅读 · 0 评论 -
使用滚动视图
Scrolled.js/** * Created by zhoujian on 2019/4/9. */import React, { Component } from 'react';import { AppRegistry, ScrollView, Image, Text } from 'react-native';export default class Scroll...翻译 2019-04-10 19:22:51 · 167 阅读 · 0 评论 -
使用长列表
FlatListFlatListBasics.js/** * Created by zhoujian on 2019/4/9. */import React, {Component} from 'react';import {FlatList, StyleSheet, Text, View} from 'react-native';export default clas...翻译 2019-04-10 19:31:50 · 380 阅读 · 0 评论 -
网络
FetchExample.js/** * Created by zhoujian on 2019/4/9. */import React, {Component} from 'react';import {FlatList, ActivityIndicator, Text, View, Alert} from 'react-native';export default cl...翻译 2019-04-10 19:36:42 · 121 阅读 · 0 评论 -
电影列表
SampleAppMovies.js/** * Created by zhoujian on 2019/4/9. */import React, {Component} from "react";import {Image, FlatList, StyleSheet, Text, View, Alert} from "react-native";var REQUEST_U...翻译 2019-04-10 19:42:34 · 229 阅读 · 0 评论 -
组件和API
/** * Created by zhoujian on 2019/4/9. */import React, {Component} from 'react';import {Image} from 'react-native';export default class Bananas extends Component{ //一、基础组件 //(1) View:...翻译 2019-04-10 19:46:02 · 877 阅读 · 0 评论 -
React Native中Modal的使用
DialogModal.js/** * Created by zhoujian on 2019/4/9. */import React, {Component} from 'react';import { StyleSheet, Text, View, Modal, TouchableOpacity} from 'react-native...翻译 2019-04-11 11:08:30 · 3741 阅读 · 0 评论 -
示例教程:Hello World
App.js/** * Sample React Native App * https://github.com/facebook/react-native * * @format * @flow * @lint-ignore-every XPLATJSCOPYRIGHT1 */import React, {Component} from 'react';import ...翻译 2019-04-09 20:42:47 · 148 阅读 · 0 评论 -
Navigator is deprecated and has been removed from this package
React Native 版本升级到0.43以后,Navigator不能直接从react-native里面获取了解决方案:yarn addreact-native-deprecated-custom-components成功后,在package.json文件中 "dependencies": { "react": "16.6.3", "react-nat...原创 2019-03-07 08:37:34 · 457 阅读 · 0 评论 -
React Native命令行
1. sudo lsof -i:8081 查看端口8081被哪个进程占用2.kill -9 48547 杀死占用端口的进程485473.adb reverse tcp:8081 tcp:8081 反向代理8081端口4.react-native --version //查看当前reactNative版本5.npm install //给下载的普通工程下载安装RN环境,根据配置的p...原创 2019-02-14 19:38:29 · 794 阅读 · 1 评论 -
React Native之指定宽高
import React, {Component} from 'react';import {AppRegistry, View} from 'react-native';class HelloAndroid extends Component { render() { return ( <View> <View sty翻译 2017-04-10 13:55:05 · 649 阅读 · 0 评论 -
React Native 之弹性(Flex)宽高
弹性(Flex)宽高 在组件样式中使用flex可以使其在可利用的空间中动态地扩张或收缩。 一般而言我们会使用flex:1来指定某个组件扩张以撑满所有剩余的空间。如果有多个并列的子组件使用了flex:1,则这些子组件会平分父容器中剩余的空间,如果这些并列的子组件的flex值不一样,则谁的值更大,谁占据剩余空间的比例就更大(即占据剩余空间的比等于并列组件间flex值的比)。import React,翻译 2017-04-10 14:13:10 · 1224 阅读 · 0 评论 -
React Native 之 Flexbox 布局
1.flexDirection水平方向import React, {Component} from 'react';import {AppRegistry, View} from 'react-native';class HelloAndroid extends Component { render() { return ( //flexDirecti翻译 2017-04-10 15:56:41 · 555 阅读 · 0 评论 -
React Native简介及开发环境配置
React Native简介React Native是Facebook 在2015 大会上推出的基于 JavaScript 的开源框架。React Native 结合了 Web 应用和 Native 应用的优势,可以使用 JavaScript 来开发 iOS 和 Android 原生应用。开发者只需学习一种语言就能轻易为任何平台高效地编写代码。React Native着力于提高多平台开发的开发效率翻译 2017-04-07 11:37:04 · 700 阅读 · 0 评论 -
React Native之编写Hello World
index.android.js//查看8081端口占用情况:lsof -i tcp:8081//去除占用:kill pid(具体数字)//ES2015的特性:import、from、class、extends、() =>等import React, {Component} from 'react';import {AppRegistry, Text} from 'react-native'翻译 2017-04-10 09:24:52 · 508 阅读 · 0 评论 -
React Native之Props属性
props属性:组件在创建的时候可以使用各种参数来进行定制,用于定制的这些参数称为props属性import React, {Component} from 'react';//Image 图片组件import {AppRegistry, Image} from 'react-native';class HelloAndroid extends Component { render()翻译 2017-04-10 09:48:31 · 351 阅读 · 0 评论 -
React Native 之State状态
import React, {Component} from 'react';import {AppRegistry, Text, View} from 'react-native';class MyComponent extends Component { constructor(props) { super(props); // 初始化 state翻译 2017-04-10 10:01:02 · 356 阅读 · 0 评论 -
React Native之处理触摸事件
import React, {Component} from 'react';import { AppRegistry, Image, View, Text, TextInput, Alert, StyleSheet,Button} from 'react-native';// sudo lsof -i :8081//kill -9 48547export default c...翻译 2018-12-26 19:50:23 · 256 阅读 · 0 评论 -
React Native之处理文本输入
import React, {Component} from 'react';import { AppRegistry, Image, View, Text, TextInput} from 'react-native';export default class HelloWorld extends Component { constructor(props) { ...翻译 2018-12-25 20:15:24 · 473 阅读 · 0 评论 -
React Native之长列表:FlatList
import React, {Component} from 'react';import { AppRegistry, View, Text, StyleSheet, FlatList} from 'react-native';export default class HelloWorld extends Component { rend...翻译 2019-01-02 11:38:18 · 664 阅读 · 0 评论 -
React Native长列表之SectionList
import React, {Component} from 'react';import { AppRegistry, View, Text, StyleSheet, FlatList, SectionList} from 'react-native';export default class HelloWorld extends Com...翻译 2019-01-02 14:15:27 · 235 阅读 · 0 评论 -
React Native之使用滚动视图
import React, {Component} from 'react';import { AppRegistry, Text, ScrollView} from 'react-native';export default class HelloWorld extends Component { render() { return (...翻译 2019-01-02 14:25:18 · 528 阅读 · 0 评论 -
React Native网络之Fetch
import React, {Component} from 'react';import { AppRegistry, Text, View, FlatList, ActivityIndicator} from 'react-native';export default class HelloWorld extends Component {...翻译 2019-01-02 15:19:29 · 144 阅读 · 0 评论 -
Props(属性)
Bananas.js/** * Created by zhoujian on 2019/4/9. */import React, {Component} from 'react';import {Image} from 'react-native';export default class Bananas extends Component{ //以常见的基础组件Ima...翻译 2019-04-09 20:50:01 · 922 阅读 · 0 评论