react-native-gifted-form icon indicating copy to clipboard operation
react-native-gifted-form copied to clipboard

SubmitWidget isDisabled if not valid

Open ScandyMark opened this issue 9 years ago • 3 comments

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

ScandyMark avatar Jan 27 '16 01:01 ScandyMark

Big thanks to Daniel!

ScandyMark avatar Feb 10 '16 16:02 ScandyMark

o/

danielweinmann avatar Feb 10 '16 22:02 danielweinmann

Code example: https://github.com/FaridSafi/react-native-gifted-form/pull/17

FaridSafi avatar Feb 13 '16 01:02 FaridSafi