I am using Flatlist, I have 2 different components such as FriendsChat and EmptyChat. When I hit the particular list value it should go either one, this is working properly but Only Friend Item component has it value but Empty chat component couldn't get that value. It shows undefined
Friends = () => (
<View style={[styles.container]}>
<FlatList
style={styles.setListStyle}
data={this.props.searchQuery == '' ? this.props.friendsList : this.props.searchList}
refreshing={false}
keyExtractor={item => item.name}
listKey={listKey}
renderItem={itemData => (
<SafeAreaView forceInset={{ bottom: 'never', top: 'never' }}>
{console.log("Friend list console "+itemData.item.name)}
<ChatItem
ChatItem={itemData.item}
view={Strings.friends}
addFriend={this.props.addFriend}
onTouch={() =>
!this.props.addFriend &&
this.onTouchChat(itemData.item) &&
this.loadEmptyChat(itemData.item) &&
<EmptyChatView
chatItem = {itemData.item.name}
//ind={index}
//isFirstMessage={true}
/>
}
/>
<View style={{ backgroundColor: Colors.searchBackGround }}>
<View style={styles.listSeparator} />
</View>
</SafeAreaView>
)}
/>
</View>
);