### Run the example app Source: https://github.com/sectiontn/react-native-otpkit/blob/main/CONTRIBUTING.md Start Metro and build/launch the example app on Android, iOS, or web. The first Android/iOS run creates native folders with expo prebuild. ```sh yarn example start yarn example android yarn example ios yarn example web ``` -------------------------------- ### Install Playwright browsers and run web e2e Source: https://github.com/sectiontn/react-native-otpkit/blob/main/CONTRIBUTING.md Install Chromium and WebKit browsers once, then export the example and run e2e tests on web targets. ```sh npx playwright-core install chromium webkit yarn e2e:web:build yarn e2e --target web yarn e2e --target web-webkit ``` -------------------------------- ### Direct Consumption Example Source: https://github.com/sectiontn/react-native-otpkit/blob/main/_autodocs/api-reference/native-module.md Shows how to use the NativeOTPKit module directly, checking availability and starting a consent session. This is not part of the public API; the recommended approach is to use useSmsCode and getAppHash. ```tsx import NativeOTPKit from 'react-native-otpkit/src/specs/NativeOTPKit'; if (NativeOTPKit?.isAvailable()) { const message = await NativeOTPKit.startConsent(null); // user taps Allow } ``` -------------------------------- ### useResendTimer(seconds, { autoStart }) Source: https://github.com/sectiontn/react-native-otpkit/blob/main/README.md Counts down for a resend button and returns an object with remaining, canResend, and restart. It starts on mount unless autoStart is false. ```APIDOC ## useResendTimer(seconds, { autoStart }) ### Description Counts down for a resend button and returns `{ remaining, canResend, restart }`. It starts on mount unless `autoStart` is `false`. Time in the background counts. ### Parameters - **seconds** (number) - Required - The countdown duration in seconds. - **autoStart** (boolean) - Optional - Whether to start the timer on mount. Defaults to true. ### Returns - **remaining** (number) - The remaining seconds. - **canResend** (boolean) - Whether the resend button can be pressed. - **restart** (function) - Restarts the countdown. ``` -------------------------------- ### Manual start with autoStart false Source: https://github.com/sectiontn/react-native-otpkit/blob/main/_autodocs/api-reference/useResendTimer.md Creates a timer with autoStart: false so the button starts enabled ('Send code') and only becomes disabled after the user taps it, which calls sendCode() and timer.restart(). ```tsx const timer = useResendTimer(60, { autoStart: false });