zoukankan      html  css  js  c++  java
  • 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.

  • 相关阅读:
    nginx 禁止访问某个目录
    ssh 无法链接的解决思路
    linux 时间修改(同步到时间服务器)
    BitNami Gitlab的重启问题
    gitlab push时报错
    VirtualBox 安装centos后无法上网
    VirtualBox 创建64位系统的问题
    NOIP2010 题解
    NOIP2011 题解
    NOIP2012 题解
  • 原文地址:https://www.cnblogs.com/cag2050/p/6059179.html
Copyright © 2011-2022 走看看