react-native-otp-verify icon indicating copy to clipboard operation
react-native-otp-verify copied to clipboard

Fix OTP listener registration race

Open Arunsiva003 opened this issue 6 months ago • 0 comments

Summary

  • Register the JS OTP listener before starting SMS Retriever.
  • Return the created subscription after SMS Retriever starts and remove it if startup fails.
  • Add focused tests for listener ordering and cleanup.

Why

This prevents an OTP event from being emitted before the JS listener has been attached.

Fixes #141

Tests

  • npm test -- --runInBand
  • npx eslint src/index.tsx src/tests/index.test.tsx
  • npm run typescript (fails: existing unused variables in example/src/App.tsx:16)
  • npm run lint (fails: existing formatting/lint errors in dist/index.*, example/src/App.tsx, scripts/bootstrap.js)

Arunsiva003 avatar May 27 '26 15:05 Arunsiva003