Skip to main content

Installation

Requirements​

PlatformMinimum Version
React Native0.81+

The library is a TurboModule and requires React Native's new architecture. Since version 1.0 the old architecture is not supported; apps still on it can stay on version 0.17.x.

Supported Biometric Types​

  • iOS: Face ID, Touch ID
  • Android: Fingerprint, Face Recognition, Iris Scanner
  • Fallback: Device PIN, Password, Pattern

Install the package​

npm install @sbaiahmed1/react-native-biometrics
# or
yarn add @sbaiahmed1/react-native-biometrics

Expo​

The library ships with an Expo config plugin. Instead of editing native files manually, add it to your app config — it sets NSFaceIDUsageDescription on iOS and adds the USE_BIOMETRIC / USE_FINGERPRINT permissions on Android during prebuild:

{
"expo": {
"plugins": [
[
"@sbaiahmed1/react-native-biometrics",
{
"faceIDPermission": "Allow $(PRODUCT_NAME) to use Face ID for secure authentication"
}
]
]
}
}

The library contains native code, so it does not run in Expo Go. Use a development build (npx expo run:ios, npx expo run:android, or EAS Build). In Expo Go the import still works, but calls that need the native module reject with NATIVE_MODULE_UNAVAILABLE.

Then apply the changes by regenerating the native projects with npx expo prebuild. For a full regeneration use npx expo prebuild --clean — but note it deletes the ios/ and android/ directories, including any manual native edits. npx expo run:ios / run:android only run prebuild when the native directories are missing, so they won't pick up plugin changes on an existing project by themselves.

OptionTypeDefaultDescription
faceIDPermissionstring | falseA generic Face ID messageThe iOS NSFaceIDUsageDescription text. Pass false to leave Info.plist untouched (e.g. when you manage it via ios.infoPlist).
tip

With the plugin in place, the manual iOS Setup and Android Setup permission steps below are handled for you (Expo projects only).

iOS Setup​

  1. Add permissions to Info.plist:
<key>NSFaceIDUsageDescription</key>
<string>This app uses Face ID for secure authentication</string>
  1. Install iOS dependencies:
cd ios && pod install

Swift Package Manager​

React Native 0.88 and newer can build iOS dependencies with Swift Package Manager instead of CocoaPods. The library ships a Package.swift, so React Native's SwiftPM autolinking picks it up without extra configuration.

If the app already builds with SwiftPM, sync the new dependency in place of step 2:

npx react-native spm

Moving an app from CocoaPods to SwiftPM is an app-wide migration that this library does not change. Follow the React Native SwiftPM guide, which also covers apps that keep other CocoaPods dependencies and apps that use Expo's autolinking.

The NSFaceIDUsageDescription key from step 1 is still required. Projects that stay on CocoaPods need no change.

Android Setup​

  1. Add permissions to android/app/src/main/AndroidManifest.xml:
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
  1. Ensure minimum SDK version in android/app/build.gradle:
android {
compileSdkVersion 34
defaultConfig {
minSdkVersion 23
targetSdkVersion 34
}
}
  1. Add ProGuard rules (if using ProGuard) in android/app/proguard-rules.pro:
-keep class androidx.biometric.** { *; }
-keep class com.sbaiahmed1.reactnativebiometrics.** { *; }

Importing Types on Non-Native Platforms​

The AuthType and BiometricStrength enums can be safely imported from @sbaiahmed1/react-native-biometrics/types on non-mobile platforms (e.g. web), as this entry point does not load native modules.

import { AuthType, BiometricStrength } from '@sbaiahmed1/react-native-biometrics/types';

Upgrading to 1.0​

Version 1.0 removes support for the old architecture. When upgrading from 0.17 or earlier:

  • React Native 0.81 or newer (Expo SDK 54 or newer) with the new architecture enabled is required. In Expo, remove any "newArchEnabled": false from your app config.
  • Rebuild the native app after upgrading (pod install on iOS, or npx expo prebuild --clean).
  • Biometric change detection no longer starts on its own on iOS. Subscribing with subscribeToBiometricChanges() used to start detection on iOS. Call startBiometricChangeDetection() after subscribing, as Android already required.