//支持typescript
yarn add --dev typescript @types/jest @types/react @types/react-native @types/react-test-renderer

使用navigation
yarn add react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context @react-native-community/masked-view @react-navigation/native @react-navigation/stack @react-navigation/bottom-tabs

//支持base文件

yarn add  react-native-iphone-x-helper  react-native-device-info
@react-native-clipboard/clipboard


//支持剪切板
yarn add @react-native-clipboard/clipboard


//安装使用elements
yarn add  https://github.com/react-native-elements/react-native-elements

react-native-vector-icons 
//图标无法显示
// 进入android/app/build.gradle文件，添加如下内容：
project.ext.vectoricons = [
    iconFontNames: [ 'MaterialIcons.ttf', 'EvilIcons.ttf' ]
]
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

//状态栏透明
<StatusBar barStyle={'dark-content'} translucent={true} backgroundColor={'rgba(0,0,0,0)'} />
        StatusBar.setBarStyle('dark-content');修改样式

使用actionSheet
yarn add react-native-actionsheet
 <ActionSheet
    ref={o => this.ActionSheetRef = o}
    title={'Which one do you like ?'}
    options={['Apple', 'Banana', 'cancel']}
    cancelButtonIndex={2}
    destructiveButtonIndex={0}
    onPress={(index) => { /* do something */ }}
/>

//上拉刷新动画
import { RefreshNormalHeader } from 'react-native-smart-refresh';
yarn add react-native-smart-refresh
 refreshControl={
    <RefreshNormalHeader
        refreshing={refreshing}
        onRefresh={this.onRefresh}
        containerStyle={{ marginBottom: 20, alignItems: 'flex-end' }}
        titleStyle={{ fontSize: 14 }}
        timeStyle={{ fontSize: 14 }}
        leftContainerStyle={{ marginBottom: 8 }}
        activityIndicatorProps={{ color: "red" }}
    />
}

购物车左滑组件
import { SwipeListView } from 'react-native-swipe-list-view';


actionsheet
react-native-reanimated+reanimated-bottom-sheet


图片预览
react-native-image-zoom-viewer



防止手势冲突带来的scrollview下拉反馈受影响
 panResponder = PanResponder.create({

        onStartShouldSetPanResponder: () => true,

        //手势移动，激活响应   

        onMoveShouldSetPanResponder: (evt, gestureState) => {

            let { dy } = gestureState;

            //如果手指垂直距离移动小于5，则不激活，否则激活标签的响应操作。

            // 目的是：使标签里面的点击事件能够正常使用，如果没有点击事件。可直接return true;

            return Math.abs(dy) > 5 ? true : false

        },

        onPanResponderRelease: (evt, gs) => {

            if (gs.dy > 5) {//下滑
                // console.log(111111)
                
                // console.log(gs)
                // this.setState({ show_more_tab: true })

            } else if (gs.dy < -5) {//上滑
                // console.log(222222)

                // this.setState({ show_more_tab: false })

            }

        }

    })

    
使用模板创建
登录
# npm adduser --registry http://registry.npmjs.org

更新发布
# npm publish --registry http://registry.npmjs.org


//支持typescript
yarn add --dev typescript @types/jest @types/react @types/react-native @types/react-test-renderer

使用navigation
yarn add react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context 


yarn add @react-native-community/masked-view @react-navigation/native @react-navigation/stack @react-navigation/bottom-tabs



//支持base文件

yarn add  react-native-iphone-x-helper  react-native-device-info @react-native-clipboard/clipboard react-native-easy-toast

yarn add @react-native-community/async-storage
//支持剪切板
yarn add @react-native-clipboard/clipboard


//安装使用elements
yarn add  https://github.com/react-native-elements/react-native-elements

react-native-vector-icons 
//图标无法显示
// 进入android/app/build.gradle文件，添加如下内容：
project.ext.vectoricons = [
    iconFontNames: [ 'MaterialIcons.ttf', 'EvilIcons.ttf' ]
]
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

//状态栏透明
<StatusBar barStyle={'dark-content'} translucent={true} backgroundColor={'rgba(0,0,0,0)'} />
        StatusBar.setBarStyle('dark-content');修改样式

使用actionSheet
yarn add react-native-actionsheet
 <ActionSheet
    ref={o => this.ActionSheetRef = o}
    title={'Which one do you like ?'}
    options={['Apple', 'Banana', 'cancel']}
    cancelButtonIndex={2}
    destructiveButtonIndex={0}
    onPress={(index) => { /* do something */ }}
/>

//上拉刷新动画
import { RefreshNormalHeader } from 'react-native-smart-refresh';
yarn add react-native-smart-refresh
 refreshControl={
    <RefreshNormalHeader
        refreshing={refreshing}
        onRefresh={this.onRefresh}
        containerStyle={{ marginBottom: 20, alignItems: 'flex-end' }}
        titleStyle={{ fontSize: 14 }}
        timeStyle={{ fontSize: 14 }}
        leftContainerStyle={{ marginBottom: 8 }}
        activityIndicatorProps={{ color: "red" }}
    />
}

购物车左滑组件
import { SwipeListView } from 'react-native-swipe-list-view';


actionsheet
yarn add react-native-reanimated reanimated-bottom-sheet

轮播图
yarn add react-native-swiper

//滚动tabs
react-native-scrollable-tab-view

视频播放时候使用
import VideoPlayer from 'react-native-rn-videoplayer';

渐变色
react-native-linear-gradient



//pushy热更新报错
 android.support.v4.content.FileProvider.getUriForFile 找不到
 替换为import androidx.core.content.FileProvider;
 使用FileProvider.getUriForFile


code-push集成
setting.gradle 中添加
include ':app', ':react-native-code-push'
project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')

在app/build.gradlew 中添加
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

code-push access-key ls
code-push app add 在账号里面添加一个新的app
code-push app remove 或者 rm 在账号里移除一个app
code-push app rename 重命名一个存在app
code-push app list 或则 ls 列出账号下面的所有app
code-push app transfer 把app的所有权转移到另外一个账号
code-push deployment ls appname -k

updateContents

# 发布更新code-push release-react only android -d Production

# code-push release-react Mtest android --t 1.2.3 --dev false --d Production --des "1. sss\n 2. ttt" -m

# code-push release-react MtestIOS ios  --t 1.0.21 --dev false --d Production --des "1.优化操作流程" --m true

# CodePush默认是更新 Staging 环境的，如果发布生产环境的更新包，需要指定--d参数：--d Production ，如果发布的是强制更新包，需要加上 --m true强制更新
# code-push release-react Flow800-Android android --t 2.0.0 --dev false --d Production --des "1.全新页面\n2.上线流量商城\n3.已知bug修复" --m ture

https://ibambooooo.github.io/2018/08/19/codePush/#%E8%A1%A5%E4%B8%81%E6%9B%B4%E6%96%B0

https://www.shangmayuan.com/a/be1833387f58443fb62ef6da.html



code-push release-react only android -m --des "1.日常修复。\n2.修复了header。\n3.再次测试更新切换部分" --t *