0

我遇到过这个问题Encountered two children with the same key, `11`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version

问题是我检查了我的fetch,在那里我得到了 FlatList 的数组,我没有任何项目,id=11而且根本没有这样id的项目。

这是我的FlatList组件:

<FlatList
         horizontal
         showsHorizontalScrollIndicator={false}
         style={styles.myPatientsList}
         data={clients}
         renderItem={({ item }) => (
           <MyPatientsCard {...item} goToScreen={this.goToScreen} />
          )}
         keyExtractor={item => item.id.toString()}
         ListEmptyComponent={
            <Text style={styles.noClientsText}>
              {I18n.t('expertScreen.noPatients')}
            </Text>
           }
/>
4

0 回答 0