react-native 学习笔记

react-native 修改端口  

react-native start --port  9999

参考      React Native项目遇到的问题 -> 端口号修改_Rkatsiteli的博客-CSDN博客

调出重新加载页面 adb shell input keyevent 82

react-native arr 操作ReactNative学习笔记--JS基础使用语法_慕课手记

npm install 不动  http://blog.csdn.net/iamfreedom2011/article/details/53375245

git 提交代码的命令:

  1. git status  
  2. git pull
  1. git add --all  
  1. git commit -m <comment>  
  1. git push -u origin master  
  2. 反过来,如果希望用代码库中的文件完全覆盖本地工作版本. 方法如下:

    git reset --hard
    git pull

    其中git reset是针对版本,如果想针对文件回退本地修改,使用

    [plain]  view plain  copy
    1. git checkout HEAD file/to/restore  

找不到依赖 添加这个包



npm install babel-plugin-import --save-dev
android 打包
建assert目录,在项目根目录执行
react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/

android/app/src/main/res/
到安卓目录下运行,打包
C:\Users\xupf-c\.gradle\wrapper\dists\gradle-3.3-all\55gk2rcmfc6p2dg9u9ohc3hw9\gradle-3.3\bin\gradle assembleRelease
参考 http://blog.csdn.net/zrina1314/article/details/75452654 
http://blog.csdn.net/xiangzhihong8/article/details/70162784

ios  打包

建assert目录,在项目根目录执行

react-native bundle --entry-file index.ios.js  --platform ios --dev false --bundle-output ./ios/bundle/index.ios.jsbundle --assets-dest ./ios/bundle

jsCodeLocation  = [[NSBundle mainBundle] URLForResource:@"index.ios" withExtension:@"jsbundle"];

或者

iOS 打包方法,在package.json 同级建立release_ios ,在cmd 到package.json目录运行下面一句

 react-native bundle --entry-file index.ios.js --platform ios --dev false --bundle-output release_ios/main.jsbundle --assets-dest release_ios/

copy release_ios 中的文件到iOS 项目目录,文件夹蓝色

添加这一句在项目的AppDelegate.m中,替换原来的。

jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];

WebView 使用:

<WebView
          style={{width:width,backgroundColor:'gray'}}
          source={{uri:"http://192.168.127.188/#/app/tech/home"}}
          javaScriptEnabled={true}
          domStorageEnabled={true}
          startInLoadingState={true}
          scalesPageToFit={false}
           decelerationRate="normal"
             automaticallyAdjustContentInsets={false}
          />



react-native-vector-icons的使用

http://blog.csdn.net/yeputi1015/article/details/70331912   

react-native android WebView 视频全屏react-native-android-wv-video

react-native 0.63 以上初始化完成启动白屏,杀掉进程,重启就好了

找到 /node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js文件. 42 line
   
  if (!version.startsWith('com.apple.CoreSimulator.SimRuntime.iOS') && !version.startsWith('com.apple.CoreSimulator.SimRuntime.tvOS')){
      continue;
    }

“YES”== > true
找到 RCTModuleMethod.mm  93 行

修改

static BOOL RCTParseUnused(const char **input)
{
  return RCTReadString(input, "__unused") ||
    RCTReadString(input, "__attribute__((__unused__))") ||
    RCTReadString(input, "__attribute__((unused))");

这个函数插入 RCTReadString(input, "__attribute__((__unused__))") ||这行代码重新运行就行了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值