anhnch / react-native-pin-code

A Pincode component for React Native
MIT License
27 stars 23 forks source link

How are we supposed to get the PIN ? It's keeps erroring out and resetting each time #7

Open rick427 opened 1 year ago

rick427 commented 1 year ago

I don't quite understand how this component works even after reading the docs countless times ? Each time I enter a pin I always get an error text message ("wrong pin") and the input gets reset. I would like to send the pin the user enters whether right or wrong to my server to verify, but the onEnter method doesn't trigger unless "it's the right pin" ??? so how do I go about this ?

anhnch commented 1 year ago

When you init the PinCode component, you have to get the pin from where you stored and pass the pin to the component

<PinCode pin={stored_pin_here} />

The onEnter is only triggered if the correct pin has been entered. You don't check the entered pin every time.

This is not an authentication/signin component. It's just an interface to temporarily block the content for data sensitive apps. It's convenient so that you don't have to write screens with bunch of buttons and checking pin by yourself.

Sorry if the docs is confusing! I assume that people who look for such pincode component get the idea that it's not client-server authentication.

pathaksoham2003 commented 6 months ago

@anhnch you have not added the pin prop in the types for the PinCode please add it !!

pathaksoham2003 commented 6 months ago

I don't quite understand how this component works even after reading the docs countless times ? Each time I enter a pin I always get an error text message ("wrong pin") and the input gets reset. I would like to send the pin the user enters whether right or wrong to my server to verify, but the onEnter method doesn't trigger unless "it's the right pin" ??? so how do I go about this ?

just use the pin prop it will work he has added the pops in types for the PinCode

anniewey commented 2 months ago

@anhnch is there a way to override the pin checking to use our own logic? i have the same requirement as OP, to use API to validate the pin as we don't want to store the pin in local storage.