i6mi6 / react-native-alphabetlistview

A Listview with a sidebar to jump to sections directly
MIT License
456 stars 163 forks source link

onCellSelect callbak is not working #42

Open codalsrai opened 6 years ago

codalsrai commented 6 years ago
xvbo commented 6 years ago

For the same problem, there is no solution to the problem.

jankowskip commented 6 years ago

I do have same problem, i used cellProps to pass method to the CellComponent

cellProps={{onCellSelect: this.someFunction}}

elizond0 commented 6 years ago

same problem . I use render Function return the content instead of CellComponent.

yyd1142 commented 5 years ago

hello, you can refer to this example 👌

Example

class Cell extends Component {
  render() {
    return (
      <TouchableHighlight onPress={() => this.props.onSelect(this.props.item)}>
                <View style={{ height: 30 }}>
                    <Text>{this.props.item}</Text>
                </View>
       </TouchableHighlight>
    );
  }
}
//...
class MyComponent extends Component {
  someFunction(value) {
       console.log(value)
  }
  render() {
    return (
      <AlphabetListView
        data={this.state.data}
        cell={Cell}
        cellHeight={30}
        sectionListItem={SectionItem}
        sectionHeader={SectionHeader}
        sectionHeaderHeight={22.5}
        onCellSelect={(value) => this.someFunction(value)}  //<=  onCellSelect()
      />
    );
  }
}