Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get key from button list when pressed #400

Open
maxbeech opened this issue Sep 17, 2018 · 0 comments
Open

Get key from button list when pressed #400

maxbeech opened this issue Sep 17, 2018 · 0 comments

Comments

@maxbeech
Copy link

maxbeech commented Sep 17, 2018

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}
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant