Closed guitexa closed 3 years ago
Hi, @guitexa! Thank you
That's happening because you're formatting value before display it, instead of formatting value before set in the state. So in your state you have latest formatted value instead of current one.
isPhone
checks if value matches phone number format in a huge range of formats, but (99) 9999-99999
isn't one of them. I can add it, but don't seems to me an used format for phone numbers, do you agree?
I've updated your example to set formatted value in the state, and it seems to work fine.
Hi @VitorLuizC, thank you so much for answering, I'm new with programming and I didn't think about that, rsrs, it's work very well here.
Have a nice day! 🙏🏼
Hi guys, I'm very proud to find a solution so good made by Brazilians.
I'm trying to use the function
isPhone
but I don't know if I'm using this wrong, but it's not working as well.When I type a mobile phone starting with 9 the mask works fine but the state not, and the validation not work because of that. 🤔
See this gif and the code working on SandBox.
https://codesandbox.io/s/shy-surf-4bo20