Skip to content

Conversation

@jaredmixpanel
Copy link
Collaborator

@jaredmixpanel jaredmixpanel commented Jan 16, 2026

Summary

  • Move @react-native-async-storage/async-storage from dependencies to peerDependencies to resolve duplicate native module conflicts
  • Support both v1.x (^1.15.0) and v2.x (^2.0.0) via ^1.15.0 || ^2.0.0
  • Mark as optional via peerDependenciesMeta - SDK falls back to in-memory storage if unavailable
  • Update README with AsyncStorage installation step
  • Update MixpanelExpo sample to explicitly install async-storage

Context

Expo 52+ requires @react-native-async-storage/async-storage v2.x, while mixpanel-react-native was pinning v1.x as a direct dependency. This caused expo-doctor to flag duplicate native module dependencies, which can lead to unexpected build errors.

Moving async-storage to peerDependencies allows consuming projects to use their preferred version (v1.x or v2.x), eliminating the conflict.

Breaking Change

Action Required: If your project doesn't already include async-storage, run:

npm install @react-native-async-storage/async-storage

Most Expo projects already include this package, so no additional installation is needed.

Test plan

  • All 120 unit tests pass
  • Verified npm pack --dry-run excludes async-storage from dependencies
  • Test with fresh Expo 52 project - verify no duplicate dependency warning
  • Test with React Native project using async-storage v1.x
  • Test fallback to in-memory storage when async-storage is not installed

Fixes #323
Related: #327

Move @react-native-async-storage/async-storage from dependencies to
peerDependencies to resolve duplicate native module conflicts with
Expo 52+ which requires async-storage v2.x while the SDK was pinning v1.x.

Changes:
- Move async-storage to peerDependencies (^1.15.0 || ^2.0.0)
- Mark as optional via peerDependenciesMeta
- Add to devDependencies for testing
- Update error message with clearer installation instructions
- Update README with AsyncStorage installation step
- Update MixpanelExpo sample to explicitly install async-storage
- Add CHANGELOG entry for v3.2.0

Fixes #323
Copy link

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 resolves duplicate native module conflicts with Expo 52+ by moving @react-native-async-storage/async-storage from dependencies to peerDependencies. The change supports both v1.x and v2.x versions via the range ^1.15.0 || ^2.0.0, and marks the dependency as optional with automatic fallback to in-memory storage.

Changes:

  • Moved async-storage from dependencies to peerDependencies (optional) in package.json
  • Updated error messages with clearer instructions and warnings about data persistence
  • Updated README with AsyncStorage installation step
  • Updated MixpanelExpo sample app to explicitly install async-storage v2.x
  • Added CHANGELOG entry documenting the breaking change

Reviewed changes

Copilot reviewed 22 out of 30 changed files in this pull request and generated no comments.

Show a summary per file
File Description
package.json Moves async-storage to peerDependencies (optional), adds to devDependencies for testing
package-lock.json Updates lockfile reflecting dependency structure changes and version bumps
javascript/mixpanel-storage.js Improves error messages with version requirements and persistence warnings
Samples/MixpanelExpo/package.json Explicitly installs async-storage v2.x
Samples/MixpanelExpo/yarn.lock Updates yarn lockfile for async-storage v2.x
Samples/MixpanelExpo/ios/* Generated iOS project files for Expo sample app
README.md Documents AsyncStorage installation step and peer dependency change
CHANGELOG.md Documents breaking change and migration instructions
Files not reviewed (1)
  • Samples/MixpanelExpo/ios/MixpanelExpo.xcworkspace/contents.xcworkspacedata: Language not supported

@jaredmixpanel jaredmixpanel added the enhancement New feature or request label Jan 17, 2026
@jaredmixpanel jaredmixpanel merged commit c17dfa3 into master Jan 17, 2026
9 checks passed
@jaredmixpanel jaredmixpanel deleted the feat/async-storage-peer-dependency branch January 17, 2026 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resolve duplicate dependency issue with async-storage

2 participants