oblador / react-native-collapsible

Animated collapsible component for React Native, good for accordions, toggles etc
MIT License
2.47k stars 452 forks source link

How can I get the accordion index on onLongPress event? #371

Open pdlm95 opened 4 years ago

pdlm95 commented 4 years ago

Hi! I'm trying to get the accordion item index when onLongPress is fired. I know the onChange method captures the index, but it only does when onPress fires.

<Accordion
  sections={SECTIONS}
  activeSections={this.state.activeSections}
  renderHeader={this._renderHeader}
  renderContent={this._renderContent}
  onChange={this._updateSections}
  touchableComponent={TouchableHighlight}
  touchableProps={{
  onLongPress: (index) => {
    //I want to get the index here
    someMethodToReturn(index)
   }
  }}/>

Any clues on what I might be missing?