Skip to content

fix: lazy-load native modules for Storybook compatibility#66

Open
tobiaswu wants to merge 2 commits intomainfrom
fix/storybook-init
Open

fix: lazy-load native modules for Storybook compatibility#66
tobiaswu wants to merge 2 commits intomainfrom
fix/storybook-init

Conversation

@tobiaswu
Copy link
Collaborator

Summary

  • Wrap native module imports (whisper.rn, react-native-fs, react-native-aes-gcm-crypto, @fugood/react-native-audio-pcm-stream) in try/catch lazy requires so they don't crash in Storybook (which runs without a development build)
  • Skip store initialization and Android foreground service registration when EXPO_PUBLIC_STORYBOOK_ENABLED=true
  • Fix Storybook index import path to use @/utils/log directly

Test plan

  • Run EXPO_PUBLIC_STORYBOOK_ENABLED=true npm start and verify Storybook loads without native module crashes
  • Run npm run ios / npm run android normally and verify recording, transcription, and encryption still work
  • Verify foreground service still registers on Android in non-Storybook mode

🤖 Generated with Claude Code

tobiaswu and others added 2 commits March 23, 2026 15:07
Native modules (whisper.rn, react-native-fs, react-native-aes-gcm-crypto,
audio-pcm-stream) crash in Storybook since it runs without a dev build.
Wrap these imports in try/catch lazy requires so Storybook can render
components without native dependencies. Skip store initialization and
Android foreground service registration when Storybook is enabled.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The story depends on ThreeWaveLines which requires @shopify/react-native-skia
and react-native-worklets native modules unavailable in the Storybook environment.
The RecordingButton story still covers the button component independently.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant