naoufal / react-native-touch-id

React Native authentication with the native Touch ID popup.
https://www.npmjs.com/package/react-native-touch-id
1.47k stars 475 forks source link

[Android] Custom fingerprint prompt #174

Open simonedavico opened 5 years ago

simonedavico commented 5 years ago

How difficult would it be to modify the android TouchID.authenticate configuration options to accept a custom prompt? This would enable customisation to make the prompt more in line with the rest of the app design.

This could be also done less imperatively by implementing a TouchId component with a render prop:

<TouchId>
{
   ({ authenticate }) => (
       // my custom prompt component will use authenticate here
   )
}
</TouchId>

This can be also refactored to a useTouchId hook once react-native supports them.

What do you think?

zibs commented 5 years ago

I think it's against Google's guidelines, and if you at like #165 - I want to move away from this implementation to a more standard UI supported by Google.

simonedavico commented 5 years ago

@zibs Actually, my goal is exactly to have something that resembles more closely the new BiometricPrompt implemented by Android P.

Unfortunately, there are a few problems with the new Biometrics API:

  1. The compat library for older Android versions is still an alpha;
  2. With the BiometricPrompt there is no way to detect the presence of hardware or if a user is enrolled in biometrics without trying to launch the prompt. This loss of functionality would break theisSupported function in this library. For more info, you can look at this issue on Google Issue Tracker.

So, we could either support a custom prompt (but I agree that it would provide a less consistent UX) or replace the current prompt with something that resembles the new BiometricsPrompt (this article suggests an implementation). I would defer the implementation of the new API to a future in which they are more stable.

devanshsadhotra25 commented 5 years ago

guys, any update over this? like if we can customize the prompt or display a modal instead of default one?