Move @react-native-async-storage/async-storage from deps to peerDeps #327
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
While upgrading our mobile application to Expo 52, we encountered a dependency conflict.
Expo 52 requires @react-native-async-storage/async-storage v2, while mixpanel-react-native v3 depends on v1. This leads to duplicate versions of Async Storage in node_modules.
Proposed Solution
Starting from v3.0.2, mixpanel-react-native supports using a custom async storage implementation. In cases where a project provides its own storage manager, the @react-native-async-storage/async-storage package should not be installed automatically.
To address this, this PR moves @react-native-async-storage/async-storage to peerDependencies, making it the responsibility of the consuming project to install it only if needed.
Additionally, since the only breaking change in Async Storage v2 is the increased minimum React Native version (and mixpanel-react-native does not enforce a minimum version), the peer dependency range has been set to support both v1 and v2.