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
First of all you need hook the useState when you want component updates. In this case you wanna update the state of the attribute type(type="cpf" // type="cnpj") according to the character length. You can pass 'cpf' as the initial value, because has less characters and will be the first option to check.
const [inputMask, setInputMask] = useState('cpf')
Then, in the component when onChangeText event is fired, the setInputMask function is called passing cpf or cnpj (depending on text length) as an argument, which will be the value of inputMask
In my case, I want to put a CPF and CNPJ mask in 1 input
When the person adds a number more than 11 digits, the mask turns into cpnj
I tried to add 2 mask types
`
export default function App() {
`
I wanted help on how I could create this code
Sorry my english i'm from brazil
The text was updated successfully, but these errors were encountered: