-
-
Notifications
You must be signed in to change notification settings - Fork 37
Verify and access react-native-worklets before module installation #826
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
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 singleton AudioAPIModule class to centralize react-native-worklets verification and native module installation, improving the initialization flow and preventing potential crashes when worklets/reanimated are not properly imported.
Key changes:
- Introduces
AudioAPIModulesingleton to handle worklets verification before native module installation - Refactors worklets access throughout the codebase to use the new centralized module
- Adds semver as a production dependency (previously only used by build scripts)
Reviewed changes
Copilot reviewed 45 out of 48 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
packages/react-native-audio-api/src/AudioAPIModule/AudioAPIModule.ts |
New singleton class that verifies worklets availability and version, manages audio runtime creation, and handles native module installation |
packages/react-native-audio-api/src/AudioAPIModule/index.ts |
Barrel export for AudioAPIModule |
packages/react-native-audio-api/src/AudioAPIModule/globals.d.ts |
Global type declarations moved from api.ts for better organization |
packages/react-native-audio-api/src/utils/index.ts |
Refactored to use AudioAPIModule singleton instead of local worklets state |
packages/react-native-audio-api/src/api.ts |
Simplified to import AudioAPIModule and export public API (removed inline installation logic) |
packages/react-native-audio-api/src/core/AudioContext.ts |
Uses AudioAPIModule.getOrCreateAudioRuntime() instead of direct worklets module access |
packages/react-native-audio-api/src/core/OfflineAudioContext.ts |
Uses AudioAPIModule.getOrCreateAudioRuntime() instead of direct worklets module access |
packages/react-native-audio-api/src/core/BaseAudioContext.ts |
Uses AudioAPIModule.workletsModule for creating shareable worklets |
packages/react-native-audio-api/src/system/AudioManager.ts |
Removed native module installation logic (now handled by AudioAPIModule) |
packages/react-native-audio-api/package.json |
Added semver ^7.7.3 as a production dependency |
yarn.lock |
Lockfile update for semver dependency |
packages/react-native-audio-api/scripts/validate-worklets-version.js |
Minor formatting improvements |
apps/common-app/src/App.tsx |
Removed Animated.addWhitelistedNativeProps call and import reordering |
apps/fabric-example/ios/Podfile.lock |
Updated RNScreens dependency version |
packages/react-native-audio-api/common/cpp/**/*.h |
C++ code formatting: standardized opening brace placement for function definitions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/react-native-audio-api/src/AudioAPIModule/AudioAPIModule.ts
Outdated
Show resolved
Hide resolved
maciejmakowski2003
left a comment
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.
great job!!! could you update your clang-format version and fix formatting issues?
packages/react-native-audio-api/common/cpp/audioapi/core/analysis/AnalyserNode.h
Outdated
Show resolved
Hide resolved
61d2948 to
4f22f44
Compare
poneciak57
left a comment
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.
LGTM
packages/react-native-audio-api/src/AudioAPIModule/AudioAPIModule.ts
Outdated
Show resolved
Hide resolved
…ule.ts Co-authored-by: Kacper Poneta <94321164+poneciak57@users.noreply.github.com>
Closes #RNAA-366
Introduced changes
react-native-workletsverification as a api installation stepsemverdependency (used by build-time script)AudioAPIModuleclass as a singleton layer to interact with the native moduleChecklist