peterp / react-native-tags

Tag input component for React Native
MIT License
288 stars 75 forks source link

The library doesn't support to update the tags in the input box if I pass tags as props or mutate those tags #106

Open rhythm-sharma opened 2 years ago

rhythm-sharma commented 2 years ago

Currently, the library supports only initialTags prop, The initial tags are functioning properly on the component mounting.

My usecase requires that, the tags should be shown to the input box both by typing manually and by sending them as props.

If you require more explanation of my usecase or anything else, let me know.

For this feature, I can also quickly create a pull request.

@peterp

peterp commented 2 years ago

Hey @rhythm-sharma I'm not 100% sure I'm following, do you think this is something that others may appreciate? Perhaps it's possible to do without modifying the RN-tags package?

rhythm-sharma commented 2 years ago

Hi @peterp,

Yes, others will value this and it will be beneficial.

This gives the user better flexibility to use the library because they can controls the tags from the outside of the library.

  1. What is my use case ? When a button is pressed, all I want to do is add tags to the input field, however the library does not currently support this.

  2. do others may appreciate ? Yes, as it offers developers the freedom to manage the tags array from outside of the library component. There are many operation that can be done from the outside to mutate the tags array.

  3. How to implement ? To support this feature, We can create a props name tags, and assign this value in the state and using componentWillReceiveProps check for the latest value of tags(prop). The implement would be more clear in the PR.

Let me know if you're convinced, and I'll quickly create PR.

Thanks