jwohlfert23 / react-native-tag-input

A simple React Native component that creates an input for tags, emails, etc.
MIT License
231 stars 104 forks source link

onChangeText not working #47

Closed nikasvan closed 6 years ago

nikasvan commented 6 years ago

onChangeText seems to not work. TagInput component prop structure is like this

<TagInput
                        value={this.state.interestsArray}
                        onChangeText={(text) => {
                          console.log(text)
                          }
                        }
                        onChange={(changedArray) => {
                            this.setState({
                              interestsArray: changedArray
                            })
                          }
                        }
                      />

onChange seems to work, but onChangeText when I would like to log it. Should it behave the same way as in TextInput 's onChangeText?

Ashoat commented 6 years ago

Going to need more details than "seems to not work", and full sentences please. Is #31 the issue?

nikasvan commented 6 years ago

@Ashoat hey just noticed it there was a word missing. That is not the issue. What I am trying to do here is to add a new tag(when user presses done on keyboard)

Ashoat commented 6 years ago

Take a look at the example: https://github.com/jwohlfert23/react-native-tag-input/blob/master/Example/src/TagInputExample.js

You need to append to this.state.interestsArray in onChangeText

nikasvan commented 6 years ago

onChangeText doesn't seem to work even after that

                      <TagInput
                        value={this.state.interestsArray}
                        onChangeText={text =>
                          this.onChangeText()
                        }
                        onChange={changedArray => {
                            this.setState({
                              interestsArray: changedArray
                            })
                          }
                        }
                      />

I have the same function body for onChangeText() as in the example but it doesn't work. onChangeText doesn't catch keyboard pressing. I just need this to make a new tag after user presses done/submit on keyboard

Ashoat commented 6 years ago

You only have 3/5 required props in that code snippet! You're missing the text parameter that sets the text!

Please, read the README (which explicitly lists all five required props), read the examples, read the code, and think through things. I don't mean to be rude, but you have to understand that the folks maintaining open source projects are very busy. I can help you, but only if you take the time to follow instructions and do as much as you can yourself.

I think you'll find that figuring things out yourself is also a lot faster...