react-native-gifted-form
react-native-gifted-form copied to clipboard
SubmitWidget isDisabled if not valid
This is likely a problem with my understanding rather than program, but at a loss, so I'll make an issue. Sorry if overlooking the obvious.
Ultimate Goal: have the SubmitWidget isDisabled tied to !isValid. I don't want to have the submit button enabled unless values of TextInputWidget(s) are valid.
Disclosure: new to react, could be totally mistaken. Believe I need something like "isDisabled={this.state.foobar}" in SubmitWidget to have it change appearance when input changes.
So either use state (of ancestor), or have passed in something as dependent upon state in through prop of SubmitWidget.
Realize I can do something onSubmit checking isValid, but from the UX point of view, would prefer not to have a button that can be hit only to say don't hit button yet.
Don't see obvious, not hiding in validator way, calling callback (or whatever) to set state in TextInputWidget
Big thanks to Daniel!
o/
Code example: https://github.com/FaridSafi/react-native-gifted-form/pull/17