1、genymotion 不能访问网络?
关闭电脑防火墙
连接模拟器 WIFI (WiredSSID)
Genymotion虚拟Android不能联网的一种解决方法
2、ListView 不能滚动
ListView 父元素添加样式
flex:1
3、StyleSheet.hairlineWidth
细如发丝 - 定义了当前平台上的最细的宽度,可以用作边框或是两个元素间的分隔线。
4、修改代码后 reload 没有效果
If you hit a ERROR Watcher took too long to load on Windows, try increasing the timeout in this file (under your node_modules/react-native/).
由于 Watcher 在 windows 花费太长时间,增加超时时间
修改 .\react-native\packager\react-packager\src\node-haste\FileWatcher
目录下的 index.js
文件 MAX_WAIT_TIME
的值更大
参考:
http://bbs.reactnative.cn/topic/998/reload-js%E5%92%8Chot-reloading/3
https://github.com/facebook/react-native/issues/7257#issuecomment-215344719
http://facebook.github.io/react-native/docs/getting-started.html#testing-your-react-native-installation
5、修改 ToolbarAndroid actions 颜色
https://github.com/facebook/react-native/issues/3865
修改文件 /android/app/src/main/res/values/styles.xml
如下
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:textColorSecondary">@android:color/white</item>
<item name="android:actionMenuTextColor">@android:color/white</item>
</style>
6、how-to-reset-the-state-of-a-redux-store
const appReducer = combineReducers({
/* your app’s top-level reducers */
})
const rootReducer = (state, action) => {
if (action.type === 'USER_LOGOUT') {
state = undefined
}
return appReducer(state, action)
}
reducers clear their state
http://stackoverflow.com/questions/35622588/how-to-reset-the-state-of-a-redux-store
7、模拟器问题
- visual Studio Emulator
Menu键:通常在右Ctrl的左边 或者左Windows键旁边 - Hyper-V 管理器
程序和功能 > 启用或关闭 Windows 功能
8、真机调试
- InstallException: Unable to upload some APKs
将 android/build.gradle 第 8 行的版本号改成 1.2.3 即可
魅族手机摇一摇,没有出现开发者菜单
原因是应用的“悬浮窗”的权限被禁止了,在应用管理选择应用打开。
如果真实设备白屏但没有弹出任何报错,可以在安全中心里看看是不是应用的“悬浮窗”的权限被禁止了。com.android.ddmlib.InstallException: Failed to establish session
这是小米手机调试的问题,我之前用魅族就没这问题
解决方法:小米手机设置里-------开发者选项---------启用MIUI优化关闭参考
React Native 坑大发
在 Android 上开始使用 React Native
Failed to establish session
Upload package to device fails
已知问题