You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RealmInputScreen: Make client-side validation errors clearer (UX and code)
Before this, we were using some React state for whether to show a
line of red error text just below the input. We didn't unset it at
the moment the error condition went away, which could be confusing.
Also, the on-submit validation logic disagreed with the logic for
whether the button was disabled: the former counted an email address
as invalid, while the latter didn't.
Also, when the submit button *was* disabled -- the input value was a
URL that doesn't parse -- you wouldn't get the validation message
when you pressed it, because we weren't passing
isPressHandledWhenDisabled to the button. You could only get the
message to appear by triggering the TextInput's onSubmitEditing,
e.g. by pressing the go/enter button on a software keyboard.
Instead, do as we do for other validated inputs, like in the compose
box: on every render, track a validation error (if any) and use it
for the submit button's disabled state and its on-press callback,
with isPressHandledWhenDisabled.
0 commit comments