Skip to content

Commit a980691

Browse files
committed
refactor: mark async storage as optional peer dependency
Context: segmentio/sovran-react-native#44
1 parent c0a5895 commit a980691

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,19 @@ The hassle-free way to add Segment analytics to your React-Native app.
5050

5151
## Installation
5252

53-
Install `@segment/analytics-react-native`, [`@segment/sovran-react-native`](https://github.com/segmentio/sovran-react-native) and [`react-native-async-storage/async-storage`](https://github.com/react-native-async-storage/async-storage):
53+
Install `@segment/analytics-react-native`, [`@segment/sovran-react-native`](https://github.com/segmentio/sovran-react-native):
5454

5555
```sh
56-
yarn add @segment/analytics-react-native @segment/sovran-react-native @react-native-async-storage/async-storage
56+
yarn add @segment/analytics-react-native @segment/sovran-react-native
5757
# or
58-
npm install --save @segment/analytics-react-native @segment/sovran-react-native @react-native-async-storage/async-storage
58+
npm install --save @segment/analytics-react-native @segment/sovran-react-native
59+
```
60+
61+
If using default persistor for the Segment Analytics client, install [`react-native-async-storage/async-storage`](https://github.com/react-native-async-storage/async-storage) (for more context, check <a href="#client-options">Client Options's `storePersistor`</a>):
62+
```sh
63+
yarn add @react-native-async-storage/async-storage
64+
# or
65+
npm install --save @react-native-async-storage/async-storage
5966
```
6067

6168
For iOS, install native modules with:

packages/core/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,22 @@
4646
},
4747
"homepage": "https://github.com/segmentio/analytics-react-native#readme",
4848
"dependencies": {
49-
"@react-native-async-storage/async-storage": "^1.15.17",
5049
"@segment/sovran-react-native": "^0.4.5",
5150
"deepmerge": "^4.2.2",
5251
"js-base64": "^3.7.2",
5352
"promise.allsettled": "^1.0.5",
5453
"react-native-uuid": "^2.0.1"
5554
},
5655
"peerDependencies": {
56+
"@react-native-async-storage/async-storage": "*",
5757
"react": "*",
5858
"react-native": "*"
5959
},
60+
"peerDependenciesMeta": {
61+
"@react-native-async-storage/async-storage": {
62+
"optional": true
63+
}
64+
},
6065
"devDependencies": {
6166
"@babel/core": "^7.12.9",
6267
"@babel/runtime": "^7.12.5",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export default from '@react-native-async-storage/async-storage/jest/async-storage-mock';
1+
export default '@react-native-async-storage/async-storage/jest/async-storage-mock';

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2256,7 +2256,7 @@
22562256
dependencies:
22572257
"@octokit/openapi-types" "^12.10.0"
22582258

2259-
"@react-native-async-storage/async-storage@^1.15.15", "@react-native-async-storage/async-storage@^1.15.17":
2259+
"@react-native-async-storage/async-storage@^1.15.15":
22602260
version "1.17.7"
22612261
resolved "https://registry.yarnpkg.com/@react-native-async-storage/async-storage/-/async-storage-1.17.7.tgz#f9213e8cc6202a8c29df5a4da1db588f3b0fa8a9"
22622262
integrity sha512-mDtWhCcpxzrZhA95f6zi0pnBsjBEZW1LKZWfxVXG0UfaWpPxDBCKowNk2xjRTytckZeVhjmPJPtBU+8QNQcR0A==

0 commit comments

Comments
 (0)