Skip to content

Commit 55ac361

Browse files
authored
Update migration.md
-Added additional dependencies -Added latest version number -Added destination plugin to config example
1 parent 2f796b9 commit 55ac361

File tree

1 file changed

+17
-6
lines changed
  • src/connections/sources/catalog/libraries/mobile/react-native

1 file changed

+17
-6
lines changed

src/connections/sources/catalog/libraries/mobile/react-native/migration.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@ If you’re using `analytics-react-native 1.5.1` or older, follow these steps to
77

88
1. Update the existing package:
99
```js
10-
yarn upgrade @segment/analytics-react-native@2.0
10+
yarn upgrade @segment/analytics-react-native@2.2.0
11+
```
12+
2. Install additional dependencies:
13+
```js
14+
yarn add @segment/sovran-react-native @react-native-async-storage/async-storage
1115
```
1216

13-
2. Install or update pods:
17+
3. Install or update pods:
1418
```js
1519
npx pod-install
1620
```
@@ -22,7 +26,7 @@ If you’re using `analytics-react-native 1.5.1` or older, follow these steps to
2226

2327
4. Initialize and configure the Analytics React Native 2.0 client. The package exposes a method called `createClient` which you can use to create the Segment Analytics client. This central client manages all the tracking events.
2428
```js
25-
import { createClient } from '@segment/analytics-react-native';
29+
import { createClient, AnalyticsProvider } from '@segment/analytics-react-native';
2630
2731
const segmentClient = createClient({
2832
writeKey: 'SEGMENT_API_KEY'
@@ -82,7 +86,7 @@ PODS:
8286
{% endcodeexampletab %}
8387
{% endcodeexample %}
8488

85-
### Example client configuration for `analytics-react-native 2.0.0`
89+
### Example client configuration for `analytics-react-native 2.2.0`
8690

8791
{% codeexample %}
8892
{% codeexampletab App.tsx (or .js) %}
@@ -92,13 +96,16 @@ import {
9296
AnalyticsProvider,
9397
} from '@segment/analytics-react-native';
9498
99+
import { FirebasePlugin } from '@segment/analytics-react-native-plugin-firebase';
95100
...
96101
97102
const segmentClient = createClient({
98103
writeKey: 'WRITE_KEY',
99104
trackAppLifecycleEvents: true,
100105
});
101106
107+
segmentClient.add({ plugin: new FirebasePlugin() });
108+
102109
const App = () => {
103110
...
104111
return (
@@ -116,7 +123,9 @@ const App = () => {
116123
...
117124
"nanoid": "^3.1.30",
118125
"@react-native-async-storage/async-storage": "^1.15.11",
119-
"@segment/analytics-react-native": "2.0.0"
126+
"@segment/analytics-react-native": "2.2.0",
127+
"@segment/analytics-react-native-plugin-firebase": "2.2.0",
128+
"@segment/sovran-react-native": "0.2.6",
120129
}
121130
```
122131
{% endcodeexampletab %}
@@ -127,6 +136,8 @@ PODS:
127136
...
128137
- segment-analytics-react-native (2.0.0):
129138
- React-Core
139+
- sovran-react-native (0.2.6):
140+
- React-Core
130141
}
131142
```
132143
{% endcodeexampletab %}
@@ -152,7 +163,7 @@ onSendEvent = async() => {
152163
}
153164
```
154165

155-
### Example tracking implementation for `analytics-react-native 2.0.0`
166+
### Example tracking implementation for `analytics-react-native 2.2.0`
156167
Home.tsx
157168

158169
```js

0 commit comments

Comments
 (0)