-
-
Notifications
You must be signed in to change notification settings - Fork 238
Feat/add hook support #472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Introduces a comprehensive React hooks API for secure storage, including new hooks in src/hooks.ts, shared utilities in src/hook-utils.ts, and error helpers in src/errors.ts. Updates the README with documentation and usage examples for the new hooks, adds a detailed HOOKS.md, and refactors the example app to use the new hooks-based API. Also updates ESLint config for improved compatibility and disables the 'import/extensions' rule.
Replaces Bun with Yarn for dependency management and scripts in Android, iOS, and release GitHub Actions workflows. Updates lockfile and Xcode project to reflect new dependency versions and NitroModules upgrade.
Changed the TypeScript compiler option 'noEmit' from false to true to prevent emitting output files during compilation. This is useful for type-checking only workflows.
Replaces legacy hooks implementation with modular, strongly-typed hooks in the src/hooks directory. Introduces a new core storage API in src/core/storage.ts and updates usage in example/App.tsx. Removes deprecated files and reorganizes internal modules for better maintainability. Adds babel-plugin-react-compiler to dev dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a comprehensive React hooks API for react-native-sensitive-info, providing a modern, reactive interface with automatic memory management, loading states, and error handling. The implementation refactors the existing imperative API into a modular architecture while maintaining backward compatibility.
Key changes:
- Added six new React hooks (
useSecretItem,useSecret,useHasSecret,useSecureStorage,useSecurityAvailability,useSecureOperation) with automatic cleanup and memory leak prevention - Refactored core storage logic into a modular structure separating internal utilities, native bridge, and public API
- Migrated the example app from imperative API to hooks-based implementation
Reviewed Changes
Copilot reviewed 26 out of 30 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/hooks/*.ts | New hook implementations with lifecycle management and async state handling |
| src/internal/*.ts | Extracted shared utilities for options normalization, native instance management, and error handling |
| src/core/storage.ts | Refactored imperative API with cleaner structure and improved documentation |
| src/index.ts | Updated main entry point to export both imperative API and hooks |
| example/App.tsx | Converted example app to use new hooks API |
| docs/HOOKS.md | Comprehensive documentation for the hooks API |
| package.json | Added React Compiler plugin |
| babel.config.js | Enabled React Compiler plugin |
| *.yml | Migrated CI from Bun to Yarn |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.