Warning: flattenChildren(...)警告解决方案

出现警告:Warning: flattenChildren(…): Encountered two children with the same key, .1:$4. Child keys must be unique; when two children share a key, only the first child will be used.
原因key出现问题了哪那边出现问题了呢一般出现的比较多的就是flatlist.list等控件
比如我的

  //flatlist布局
    renderView() {
        return (
            <View style={{ flex: 1 }}>
                <FlatList

                    data={this.state.dataArray}
                    //es6写法,es5写法:this.renderRow
                    renderItem={this.renderRow.bind(this)}
                    //头部试图
                    // ListHeaderComponent={this.listHeaderComponet}
                    //分割线
                    //ItemSeparatorComponent={this._separator}
                    //下拉刷新
                    onRefresh={() => this._onRefresh()}
                    refreshing={this.state.isRefresh}
                    //加载更多
                    onEndReached={() => this._onLoadMore()}

                    onEndReachedThreshold={0.1}
                    //多列布局
                    numColumns={3}
                    //多列布局分割线
                    //columnWrapperStyle={{borderWidth:2,borderColor:'black',paddingLeft:20}}
                    keyExtractor={this.keyExtractor}
                />
            </View>
        );
    };

  keyExtractor(item: Object, index: number) {
        return item.thumb
    };

我的item中没有’thumb‘这个字段所以我把它当初了key所以会报错key为空的错误,值哟改一下你的数据源中有的并且不唯一久好了.

警告 React Native--Animated:`useNativeDriver`is not supported because the native animated module is missing.

解决方法
如果你是手动集成的把node_modules中的react-native中的Libraies文件夹中的NativeAnimation中的RCTAnimation.xcodeproj拖入到项目中,然后把.a文件导入到Link Binary With Libaraies中如果不报错运行久没有警告了
如果时cocoapods集成直接在Podfile文件中加入‘RCTAnimation’然后pod install
如果报错

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值