react-native-material-kit
react-native-material-kit copied to clipboard
Get key from button list when pressed
Hi there!
I am displaying a list of Material Kit buttons (using SectionList) and what to be able to display their key (ie. their index) when they are clicked - however am struggling with the getting it working with an MK button.
Any help would be really appreciated. Thanks!
AllConnectionsItemButton = MKButton.flatButton()
.withOnPress( (key) => alert(key))
.build()
<SectionList
renderItem={({item, index, section}) => (
<AllConnectionsItemButton key={index}>
<Text>{item.name}</Text>
</AllConnectionsItemButton>
)}
renderSectionHeader={({section: {title}}) => (
<View>
<Text>{title}</Text>
</View>
)}
sections={this.state.myList}
keyExtractor={(item, index) => item + index}
/>