Skip to content

Conversation

@michalsek
Copy link
Member

@michalsek michalsek commented Dec 1, 2025

Closes #RNAA-366

Introduced changes

  • adds react-native-worklets verification as a api installation step
  • adds missing semver dependency (used by build-time script)
  • adds AudioAPIModule class as a singleton layer to interact with the native module

Checklist

  • Linked relevant issue
  • Updated relevant documentation
  • Added/Conducted relevant tests
  • Performed self-review of the code
  • Updated Web Audio API coverage
  • Added support for web

Copy link
Contributor

Copilot AI left a 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 AudioAPIModule singleton 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.

Copy link
Collaborator

@maciejmakowski2003 maciejmakowski2003 left a 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?

@michalsek michalsek force-pushed the fix/access-worklets-runtime branch from 61d2948 to 4f22f44 Compare December 1, 2025 13:30
@michalsek michalsek requested a review from mdydek December 1, 2025 13:36
Copy link
Contributor

@poneciak57 poneciak57 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

…ule.ts

Co-authored-by: Kacper Poneta <94321164+poneciak57@users.noreply.github.com>
@michalsek michalsek merged commit 0476840 into main Dec 1, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants