toystars / react-native-multiple-select

Simple multi-select component for react-native
MIT License
566 stars 315 forks source link

getSelectedItemsExt Undefined #58

Closed AlfaIrawan closed 6 years ago

AlfaIrawan commented 6 years ago

Hey @toystars , I also have this issue. Do you have any Idea?

screen shot 2018-02-08 at 21 46 30
toystars commented 6 years ago

This happens because the method is being called before the component reference has been set. You can do something like this:

{
   this.multiselect
    ? 
   this.multiselect.getSelectedItemsExt()
    :
    null
}

This checks that the component reference has been set before invoking the method. The snippet above assumes that the ref is stored in this.multiselect

AlfaIrawan commented 6 years ago

Thx u @toystars you solve my problem

UditGlocalView commented 6 years ago

I tried to resolve this issue by following the link which is to replace: { this.multiselect ? this.multiselect.getSelectedItemsExt() : null } with: {this.multiSelect && this.multiSelect.getSelectedItemsExt(selectedItems)} and it worked for me...

ranu-patidar commented 3 years ago

how to create reference fot open other button in react-native-multiple-select

AugustoAleGon commented 3 years ago

@ranu-patidar What are you trying to achieve?