react-native-phone-number-input icon indicating copy to clipboard operation
react-native-phone-number-input copied to clipboard

Clear PhoneInput

Open sabrineayadi opened this issue 3 years ago • 4 comments

Thank you for the library. I was to clear phone Input when I click close button Capture Thanks!

sabrineayadi avatar May 28 '21 15:05 sabrineayadi

How did you achieved that ?

sayedimrandev avatar Jul 03 '21 10:07 sayedimrandev

Can phone number cleared ? Is there something by which we can achieve this ?

PreetikaSingh avatar Aug 24 '21 04:08 PreetikaSingh

@PreetikaSingh I know that this is not a good solution but this works

const phoneInput = useRef(null);

const cleanTextFields = () => {
     phoneInput.current.setState({number:''})
};

<PhoneInput ref={phoneInput}/>
  1. create the ref
  2. assign ref to the PhoneInput Component
  3. in order to clear the input field you can use the ref.current.setState({number:''})

MuhammadUsman786786 avatar Sep 16 '21 22:09 MuhammadUsman786786

Hello everyone!

I still have this question, the solution above didn't work for me. Any ideas? Thanks

ArturoTorresMartinez avatar Feb 21 '22 18:02 ArturoTorresMartinez