Consumer Authentication

/

Mobile SDKs

/

React Native SDK reference

/

Biometrics

/

Remove registration

Remove registration

Clears the existing biometric registration stored on device. This method is useful for removing a user from a given device.

import { useStytch } from '@stytch/react-native';
import React, { useCallback, useEffect, useState } from 'react';
import { Text, TouchableOpacity, View } from 'react-native';

export const RemoveRegistration = () => {
  const stytch = useStytch();

  const [isBiometricsAvailable, setIsBiometricsAvailable] = useState(false);

  useEffect(() => {
    const checkBiometricsAvailability = async () => {
      if (stytch) {
        try {
          const available = await stytch.biometrics.isRegistrationAvailable();
          setIsBiometricsAvailable(available);
        } catch {
          setIsBiometricsAvailable(false);
        }
      } else {
        setIsBiometricsAvailable(false);
      }
    };

    checkBiometricsAvailability();
  }, [stytch]);

  const removeBiometricsRegistration = useCallback(() => {
    stytch.biometrics.removeRegistration();
  }, [stytch]);

  return isBiometricsAvailable ? (
    <View>
      <TouchableOpacity onPress={removeBiometricsRegistration}>
        <Text>Delete Biometric Factor</Text>
      </TouchableOpacity>
    </View>
  ) : null;
};