toystars / react-native-multiple-select

Simple multi-select component for react-native
MIT License
569 stars 317 forks source link

component ref is not defined #70

Open umairda opened 6 years ago

umairda commented 6 years ago

Issue summary

I was testing the sample code from the README abbreviated below:

render() {
   const { selectedItems } = this.state;
   return (
     <View style={{ flex: 1 }}>
        <MultiSelect
          ...
          ref={(component) => { this.multiSelect = component }}
          ...
        />
        <View>
          {this.multiSelect.getSelectedItemsExt(selectedItems)}
        </View>
     </View>
   )
}

I get the following error:

TypeError: Cannot read property 'getSelectedItemsExt' of undefined

ie this.multiSelect is not defined. Is this correct? Don't I have to wait until the next clock edge (ie wrap in a setTimeout) before I can access this.multiSelect?

Library versions

react-native: 0.55.3 react-native-multiple-select: 0.4.4

toystars commented 6 years ago

@umairda please refer to #58 for a solution to this

hyperaktiv commented 3 years ago

to show all the item which you just select, you just comment or remove the "hideTags" properties of the Component

tusharsamrit93 commented 3 years ago

to show all the item which you just select, you just comment or remove the "hideTags" properties of the Component

itz true