selvi jp

selvi jp

  • NA
  • 323
  • 78.9k

react-native-element-dropdown unique dropdown

Nov 9 2021 8:33 AM

Hi,

   I am using react-native-element-dropdown its working fine.but if same labelfield(username).there is error.

 Warning: Encountered two children with the same key, `Ravi`. 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.

this is my code:

  <MultiSelect

               activeColor={"#a6a6a6"}

              containerStyle={{bottom:62}}

                style={styles.dropdown2}

                data={user}

                labelField="name"

                valueField="userid"

                placeholder="Select Pals"

                search

                placeholderStyle={{color:'#fff'}}

                searchPlaceholder="Search"

                value={selected}

                iconColor={'#fff'}

                selectedTextStyle={{color:"#fff"}}

                selectedStyle={{borderColor: "#fff", marginLeft:37,marginRight:-25}}

          

                onChange={item => {

                setSelected(item);

                    console.log('selected', item.toString());

                }}

                renderItem={item => _renderItem(item)}

            />

 


Answers (2)