运行react-native run-android出现com.android.builder.testing.api.DeviceException:com.android.ddmlib.InstallException: Failed to establish session错误,该怎么解决?
这个情况是由于小米手机定制android系统引起的
需要去小米手机的开发者选项中,将:启动MIUI优化关闭掉重新启动手机就可以将编译好的apk直接安装到小米手机了。
react-native android 小米手机上无法调试
小米默认是屏蔽悬浮窗权限的。在安全中心-权限管理-应用权限管理中打开悬浮窗权限
react-native-gifted-listview 用这个组件时候,报了warning!
In next release empty section headers willbe rendered. In this release you can user 'enableEmptySections' flag to renderempty section headers.
解决:找到node_modules下的react-native-gifted-listview,在ListView下 加个enableEmptySections = {true} 就可以解决了。
布局适应
React Native中使用flexbox规则来指定某个组件的子元素的布局。使用flexDirection、alignItems和 justifyContent三个样式属性。flexDirection默认值是竖直轴(column)方向。justifyContent对应的这些可选项flex-start、center、flex-end、space-around以及space-between。alignItem可选项有:flex-start、center、flex-end以及stretch。Image外面嵌套。