Native Modules

Skill: Native Module Integration

sawrus Updated

File contents

Skill: Native Module Integration

When to load

When integrating device APIs, bridging to native SDKs, or debugging platform-specific behavior.

When to Use Native Modules

Use Native Module:
- Device hardware (camera, accelerometer, NFC, Bluetooth)
- Cryptographic operations (device secure enclave)
- Computation-intensive tasks (image processing, on-device ML)
- Third-party SDKs without JS wrapper

Stay in JS/React Native:
- UI rendering and interactions
- Network requests
- State management
- Business logic not requiring device APIs

Biometric Authentication

import ReactNativeBiometrics from 'react-native-biometrics';

export async function authenticateWithBiometrics(): Promise<boolean> {
  const rnBiometrics = new ReactNativeBiometrics({ allowDeviceCredentials: true });
  const { biometryType } = await rnBiometrics.isSensorAvailable();
  if (!biometryType) return authenticateWithPin();

  const { success } = await rnBiometrics.simplePrompt({
    promptMessage: biometryType === 'FaceID' ? 'Confirm with Face ID' : 'Confirm with fingerprint'
  });
  return success;
}

sawrus/agent-guides/tree/main/areas/software/mobile/skills/native-modules commit 1b64b7fbd1

Frequently asked questions

npx skillmds@latest add sawrus/native-modules