bietkul / react-reactive-form

Angular like reactive forms in React.
MIT License
309 stars 32 forks source link

markAsTouched not emmit event change state #15

Closed duongvanha closed 6 years ago

duongvanha commented 6 years ago

markAsTouched should trigger stateChanges to rerender field

hexetia commented 6 years ago

oh, some minutes ago I faced that bug too

we can use the sync & async validation example to reproduce the bug

https://codesandbox.io/s/qq8xq7j2w

try to put some a char in password field and immediately delete the char, then click outside the field

expected behavior: the field has marked as touched

current behavior: the field remains untouched

duongvanha commented 6 years ago

yep =)). I hope he knows different between angular and react. Because many functions missing it

bietkul commented 6 years ago

@duongvanha Thanks for reporting the issue, I'll look in to it. Actually markAsTouched doesn't call the stateChanges when call explicitly.

@saculbr That example uses the old one reactiveForm api which is no longer recommended, with Field components it works perfectly. You can try it with that example https://codesandbox.io/s/4rxokpr270.