Skip to main content
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;
};
Call this method to clear the existing biometric registration stored on device. This method is useful for removing a user from a given device.

Response

request_id
string
Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
status_code
number
The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.