react native 的js 文件从哪里获取
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了react native 的js 文件从哪里获取相关的知识,希望对你有一定的参考价值。
/** * 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 文件从哪里获取的主要内容,如果未能解决你的问题,请参考以下文章
从Webview获取(THREE.js)3D模型到我的Native-React(增强现实)应用程序
在 Xcode 中打开我的 React Native 项目,我的代码在哪里?