码迷,mamicode.com
首页 > Web开发 > 详细

react native 的js 文件从哪里获取

时间:2016-02-01 15:45:40      阅读:178      评论:0      收藏:0      [点我收藏+]

标签:

 

 /**
   * Loading JavaScript code - uncomment the one you want.
   *
   * OPTION 1
   * Load from development server. Start the server from the repository root:
   *
   * $ npm start
   *
   * To run on device, change `localhost` to the IP address of your computer
   * (you can get this by typing `ifconfig` into the terminal and selecting the
   * `inet` value under `en0:`) and make sure your computer and iOS device are
   * on the same Wi-Fi network.
   */

  jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];

  /**
   * OPTION 2
   * Load from pre-bundled file on disk. To re-generate the static bundle
   * from the root of your project directory, run
   *
   * $ react-native bundle --minify
   *
   * see http://facebook.github.io/react-native/docs/runningondevice.html
   */

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

  翻译下就是:

(1)通过本地的npm start 直接运行,需要编译,首次运行会比较慢

(2)获取jsbundle 的文件,直接运行。发布模式,也可以通过js 在线更新了。

            

react native 的js 文件从哪里获取

标签:

原文地址:http://www.cnblogs.com/likwo/p/5175116.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!