Expo Local Authentication

Viewed 15

I'm trying to implement a login with biometrics using expo-local-authentication but I'm having a problem. When I tap on the biometric fingerprint the app is minimized, which is the default behavior of the device's biometrics button. Is there any way to change the behavior of the device's biometrics button?

  // BIOMETRIA
  const biometricLogin = async () => {
    // VERIFICAR COMPATIBILIDADE DO DISPOSITIVO
    const compatible = await LocalAuthentication.hasHardwareAsync();
    if (compatible) {
      // MOSTRAR PROMPT BIOMÉTRICO
      const biometricAuth = await LocalAuthentication.authenticateAsync({
        promptMessage: "Login com biometria",
        fallbackLabel: "Enter Password",
        disableDeviceFallback: true,
        cancelLabel: "Cancelar",
      });
      if (biometricAuth.success) {
        const savedBiometrics = await LocalAuthentication.isEnrolledAsync();
        if (!savedBiometrics) return Alert.alert("Registro biométrico não encontrado", "Por favor, verifique sua identidade com sua senha", "OK", () => console.log("cancel"));
      }
      console.log("biometricAuth", biometricAuth.success);
    }
    setIsBiometricSupported(compatible);
  };
  // BIOMETRIA

0 Answers
Related