资源:html
1. Redux 中文文档node
Redux 中文文档react
2. Atom文本编辑工具android
Atom文本编辑工具git
3. React-native 官方文档github
问题:redux
1. npm并非每个version均可以安装react-native, 以前安装的时候发现最新版并不能安装,后来使用另外一个工具(待回忆)安装了npm的5.9.x的某个版本以后才能够安装。目前我使用的6.2.2也是能够的。react-native
2. mac上会出现react-native指令不识别问题。bash
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. */@Overrideprotected String getMainComponentName() { return "HybirdTest";}