Initial value
nab39all opened this issue · 2 comments
nab39all commented
Can I use initial values for MaskedTextInput?
akinncar commented
Yes, you can use defaultValue
prop.
<MaskedTextInput
mask="AAA-9999"
defaultValue="abc1234"
onChangeText={(text, rawText) => {
console.log(text);
console.log(rawText);
}}
style={styles.input}
/>
SandroDamasceno commented
I tried using defaultValue to load a dynamic initial value from a state, but the value is not displayed. Only an initial value defined as a string is displayed.
In this case, is it possible to use the initial value from the content of a useState state variable?