• React Native知识点


    1. Live Reload和Hot Reloading的区别:

    相同点:都是你只要保存一下原文件,那么App就会实时刷新。

    区别:Live Reload是全局刷新,而Hot Reloading是局部刷新。

    2. 有时候我们修改了代码,在手机上并不会实时更新代码。

    解决的办法就是打开文件(是下面2个路径中的一个):

    app_name ode_modules eact-nativepackager eact-packagersrc ode-hasteFileWatcherindex.js

    或 app_name ode_modules eact-native ode_modules ode-hastelibFileWatcherindex.js 

    修改变量MAX_WAIT_TIME:

    // var MAX_WAIT_TIME = 120000;
    var MAX_WAIT_TIME = 360000;

    3. ScrollView组件的样式不能用 style={} 来写,需要用 contentContainerStyle={}。

    <ScrollView contentContainerStyle={[styles.flex1,styles.h_v_center]}>

    4.由于react native没有br标签,需要换行只能将换行符插入:

    {'
    '}

    在字符串中用 来代替。 

    5.有时候实现垂直居中,需要给元素加flex:1;这个样式。

    6.不要给ScrollView加flex:1;这个样式,否则无法出现滚动条。

    7.获得当前路由的名字(如果当前路由是首页,点击首页,不跳转):

    _jumpToHome(){
        const {navigator} = this.props;
        const routers = navigator.getCurrentRoutes();
        // routers[0].component.name:获取当前路由名字
        // 如果当前路由是首页FirstPage,点击首页,不跳转
        if(navigator && routers[0].component.name != "FirstPage"){
            navigator.push({
                name:'FirstPage',
                component:FirstPage
            })
        }
    }    

    8.windows目录:C:Usersxxx.gradle 里没有 gradle.properties 文件时,需要手动创建。

    9.

  • 相关阅读:
    服务器 防Dos攻击
    多浏览器 div 半透明
    网站工具收集
    广告平台
    ie6 position:fixed
    数据图 饼图 曲线图
    36个css框架
    css3 特效
    日ip 日pv
    网站 需求分析 收集
  • 原文地址:https://www.cnblogs.com/cag2050/p/6059179.html
Copyright © 2020-2023  润新知