日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

React-Native学习笔记

發布時間:2024/1/17 编程问答 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 React-Native学习笔记 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

資源:

1. Redux 中文文檔

  Redux 中文文檔

2. Atom文本編輯工具

? ??Atom文本編輯工具

3. React-native 官方文檔

? ??React-native 官方文檔

?

問題:

1. npm并不是每一個version都可以安裝react-native, 之前安裝的時候發現最新版并不能安裝,后來使用另一個工具(待回憶)安裝了npm的5.9.x的某個版本之后才可以安裝。目前我使用的6.2.2也是可以的。

2. mac上會出現react-native指令不識別問題。

 react-native: command not found:

 首先用npm install -g react-native-cli得到react-native的安裝路徑,如下

Enter: npm install -g react-native-cli output: /usr/local/Cellar/node/6.1.0/libexec/npm/bin/react-native ->/usr/local/Cellar/node/6.1.0/libexec/npm/lib/node_modules/react-native-cli/index.js/usr/local/Cellar/node/6.1.0/libexec/npm/lib └── react-native-cli@0.2.0

? 再在bash里面輸入:export PATH="/usr/local/Cellar/node/6.1.0/libexec/npm/bin:$PATH"
? 就可以正常使用react-native的命令了。
? 至于其他大神說的.bashrc .bashprofile等等,我也是剛開始用imac,沒找到也沒搞清楚到底怎么弄。

 參考:http://stackoverflow.com/questions/33282545/bash-react-native-command-not-found 

?

?

學習筆記:

和已有app的集成:

主要參考Integration With Existing Apps:http://facebook.github.io/react-native/releases/next/docs/integration-with-existing-apps.html

也有一些這里面沒提及到的問題需要處理

1. npm相關命令是在項目根目錄的上一級目錄執行,而不是在根目錄中執行。

2. "start": "node node_modules/react-native/local-cli/cli.js start" 注意跟前面其他內容加一個,號?

3. ?For debug, 在Manifest里加入<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />

4. ?在Application中實現ReactApplication

public class MainApplication extends Application implements ReactApplication {

private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
protected boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}

@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage()
);
}
};

@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
}

5. 在繼承的ReactActivity中需要指定MainComponentName:

/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "HybirdTest";
}

轉載于:https://www.cnblogs.com/infinitechance/p/5888039.html

總結

以上是生活随笔為你收集整理的React-Native学习笔记的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。