react native 遇到的问题及解决方案合集

一、react-native报错: Warning:In next release empty section headers will be rendered  【ListView】

bug截图

解决方案:在ListView下 加个 enableEmptySections = {true} 就可以解决了

二、React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components). Check the render method of `Navigator`.

解决方案:这种问题一般是出现undefined 或者 null 的时候,我出现这个问题就是因为出现undefined类型,如下:

修改成完它应该的值就可以了


三、React.Children.only expected to receive a single React element child.

解决方案:

源代码

TouchableWithoutFeedback只能包含一个子节点,改成如下就可以了:

四、JSON value ... of type NSMutableDictionary cannot be converted to NSString

解决方案:一般是数据格式问题,Aert.alert 的第二个参数应该是字符串,却传了个JSON

data:{title:"姓名",value:"Qqq"}

源代码





--------未完待续---------

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容