Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. <SectionList
  2. renderItem={({item, index}) => {
  3. Alert.alert(index); // here the index is null
  4. return (
  5. <SectionListItem item={item} index={index} parentSectionList={this}>
  6. </SectionListItem>);
  7. }}
  8. sections={this.state.contacts.sort((a, b) => a.title < b.title ? -1 : 1)}
  9. />
  10.  
  11. removeItem = (deletedKey) => {
  12. this.setState({
  13. deletedRowKey : deletedKey,
  14. // here I want to remove my item with deletedKey = index, but deletedKey is null
  15. contacts: this.state.contacts.splice(1), // works, removing the 1st item from array
  16. });
  17. }
  18.  
  19. const newContact = {
  20. title: this.state.contactName.charAt(0),
  21. data: [{
  22. name: this.state.contactName,
  23. phone: this.state.contactPhone
  24. }]};
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement