Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with validator! #114

Open
ruballos opened this issue Oct 10, 2017 · 0 comments
Open

Problem with validator! #114

ruballos opened this issue Oct 10, 2017 · 0 comments

Comments

@ruballos
Copy link

ruballos commented Oct 10, 2017

I use a async func to change my state.validate=true/false every on onChangeText method in a TextInputWidget. That´s work; but my problem is when I need that my validator read the state.validate....always is a prev value than the actual value! I use it for comprobe if a username exists in my BD, but if I need to comprobe if the username 'hello1989' exists, the validator return a correct response only when I type one more character: 'hello1989h' (the hello1989 user exists)....I spend two days and cant reach this....the state.validate is passing delayed to my validator. (Sorry my bad english)

<GiftedForm
    formName='newAccountForm' // GiftedForm instances that use the same name will also share the same states
  
    validators={{

      username: {
          validator: (args) =>{

                  return this.state.usuarioExiste; //return true or false

          },
          message: 'User unavailable!'
        }]
      },

      ...
      ...

Is posible manage externally the message from a validator ?....for example, from the onSubmit() of the form...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant