rafaelmotta / react-native-tag-select

🏷 A simple tag component to act as radio button / checkbox
156 stars 43 forks source link

No reset the selected items after changing the property 'data'? #25

Open winglight opened 4 years ago

winglight commented 4 years ago

I supposed that it should be reset since the whole data had been changed.

Here's what I did:

  1. click one tag within data array A
  2. navigate / refresh the current page and replace the tagselect component with another data array B
  3. when I tried to click one tag, it shows the message: Max reached. That seems the last selected status hadn't be reset.

I'm not sure if I should set itemsSelected to [], but this property haven't a setter method. So my problem is how to reset the component selected items after changing the property 'data'?

Any hint will be appreciated.

marvinhlc commented 3 years ago

Hi winglight, try this: Download de proyect and edit TagSelect.js add this method:

//agregado por Marvin resetSelected = () => { let value = {} this.setState({ value }) } //

this work for my.