1)android打包apk根据官网操作出现的错误
- Could not list contents of '/Users/xxxx/Downloads/xxxx/node_modules/node-pre-gyp/node_modules/.bin/needle'. Couldn't follow symbolic link.
- 解决方法:
根据提示路径一步步的查找最终在node-pre-gyp发现几个爆红的文件,这是找不到文件,只要把这几个找不到的文件删掉就可以了(nopt、needle、detct-libc、rc)
2)使用StatusBar后界面显示不出来
- 解决方法:
给view添加flex:1样式
3)Android使用Animated.View时动画视图显示不出来
- 解决方法:
给Animated.View进行绝对布局设置
4) 警告 Warning:setState(...):Can only update a mounted or mounting component...
- 原因:在给属性赋值(setState)时没有进行判断,可能出现赋个空值(null)的情况。
- 解决方法:
赋值前进行空值判断
5)iOS网络图片无法显示问题
- 原因:在iOS9之后,网络请求默认为Https请求,如需支持Http,修改info.plist文件添加键值对设置允许http访问。
- 解决方法:
在App Transport Security Settings中添加Allow Arbitrary Loads
设置为YES即可。
6) TextInput无法获取焦点
-
0.55 版本
TextInput
iOS无法输入中文, 0.57版本已修复 -
原因:没有给TextInput设置高度(height),当multiline={true}时不受影响
-
解决方法:
给TextInput设置高度(height)即可
7) TextInput多行输入文字居中显示问题(需求顶部对其)
- 解决方法:
设置textAlignVertical:'top'(文本垂直方向布局)属性即可实现下面效果
8) 报错 undefined is not an object (evaluating 'n.View.propTypes.style')
-
原因:If this issue is happening with RN 0.49, check for View.propTypes which no longer exists. Use ViewPropTypes instead.
-
解决方法:
使用ViewPropTypes代替View.propTypes
import PropTypes from 'prop-types';
import ViewPropTypes from 'ViewPropTypes';
static propTypes = {
style: Text.propTypes.style,
imgStyle: ViewPropTypes.style,
titleStyle: PropTypes.any,
title: PropTypes.string,
source: PropTypes.any,'
}
9) 在集成react-navigation和redux时 出现TypeError: undefined is not a function (near '...addListener...')错误.
- 解决方法:
集成该库: react-navigation-redux-helpers
10) 在集成react-navigation和redux时 出现 安卓不显示tabBar图标情况.
- 解决方法:
在tabBarOptions中添加showIcon: true如:
11) Android报错:Error:found unexpected optical bounds (red pixel) on top border at x=106.
- 解决方法:
在gradle.properties文件下添加
android.enableAapt2 = false
12) android打包错误:uncompiled PNG file passed as argument. Must be compiled first into .flat file..
- 解决方法:
添加
org.gradle.configureondemand=true
到android/gradle.properties
中
13) android 运行 报错:transformDexWithInstantRunDependenciesApkForDebug
这个问题是setting里面的设置问题:
- 解决方法
File---->Settings--->Build,Execution,Deployment---->Instant Run ---->去掉第一个条目的对钩就ok啦
网友评论