Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

DefaultValue not woking with react-native-masked-text #317

Open
nikolasalgoritme opened this issue Sep 24, 2020 · 4 comments
Open

DefaultValue not woking with react-native-masked-text #317

nikolasalgoritme opened this issue Sep 24, 2020 · 4 comments

Comments

@nikolasalgoritme
Copy link

nikolasalgoritme commented Sep 24, 2020

Description of bug
when i try use defaultValue with react-native-masked-text passing any value to the field is not working. the field value persist blank

To Reproduce
follow this tutorial https://unform.dev/examples/react-native-input-mask

Screenshots
image
image

Environment:

  • OS: Windows 7
  • "@unform/core": "^2.1.3"
  • "@unform/mobile": "^2.1.3"
  • "react-native": "0.63.2"
@jpedroschmitz
Copy link
Member

Hey @nikolasalgoritme, I am going to close this issue because it is not following the guidelines described here.

While contributing or interacting in any way in this project, refrain from using any language other than English.

@nikolasalgoritme nikolasalgoritme changed the title DefaultValue não funciona com react-native-masked-text DefaultValue not woking with react-native-masked-text Sep 28, 2020
@nikolasalgoritme
Copy link
Author

@jpedroschmitz hi, i'm really sorry about that. i have edited my post. can you open my issue again or i need to create a new one

@giusousa
Copy link

giusousa commented Oct 14, 2020

Hello! For me it worked like this!

In screenshot number 1

change

useEffect(() => {
    inputRef.current.value = defaultValue ;
}, [defaultValue]);

for

useEffect(() => {
    inputRef.current.value = defaultValue ;
    if (onChangeText) 
        onChangeText(defaultValue);
}, [defaultValue]);

good luck!!

@dededavida
Copy link

I did it, but my field came without the mask

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants