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

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

Open

Description

@nikolasalgoritme

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"

Activity

  1. jpedroschmitz commented on Sep 28, 2020

    @jpedroschmitz
    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.

  2. changed the title [-]DefaultValue não funciona com react-native-masked-text[/-] [+]DefaultValue not woking with react-native-masked-text[/+] on Sep 28, 2020
  3. nikolasalgoritme commented on Sep 28, 2020

    @nikolasalgoritme
    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

  4. giusousa commented on Oct 14, 2020

    @giusousa

    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!!

  5. dededavida commented on Dec 4, 2020

    @dededavida

    I did it, but my field came without the mask

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions