|
| 1 | +# Migrating to React Native SDK v1 |
| 2 | + |
| 3 | +React Native SDK v1.0.0 has a few breaking changes that you should consider when migrating from version 0.x.x. |
| 4 | + |
| 5 | +## Renamed some TypeScript definitions in the `SplitIO` namespace to avoid conflicts with other Split packages |
| 6 | + |
| 7 | +The renamed types are: |
| 8 | +- `SplitIO.ISDK` -> `SplitIO.IBrowserSDK` |
| 9 | +- `SplitIO.IClient` -> `SplitIO.IBrowserClient` |
| 10 | + |
| 11 | +For example, you should replace: |
| 12 | + |
| 13 | +```ts |
| 14 | +import { SplitFactory } from '@splitsoftware/splitio-react-native'; |
| 15 | + |
| 16 | +const config: SplitIO.IReactNativeSettings = { ... }; |
| 17 | +const factory: SplitIO.ISDK = SplitFactory(config); |
| 18 | +``` |
| 19 | + |
| 20 | +with: |
| 21 | + |
| 22 | +```ts |
| 23 | +import { SplitFactory } from '@splitsoftware/splitio-react-native'; |
| 24 | + |
| 25 | +const config: SplitIO.IReactNativeSettings = { ... }; |
| 26 | +const factory: SplitIO.IBrowserSDK = SplitFactory(config); |
| 27 | +``` |
| 28 | + |
| 29 | +## Removed the `LocalhostFromObject` export from the default import |
| 30 | + |
| 31 | +In order to simplify the SDK API, the `LocalhostFromObject` export was removed from the default import (`import { LocalhostFromObject } from '@splitsoftware/splitio-react-native'`), and it is no longer necessary to manually pass it to the `sync.localhostMode` configuration option to enable localhost mode. |
| 32 | + |
| 33 | +If you were using the `LocalhostFromObject` export, you should remove it from your code. For example, replace: |
| 34 | + |
| 35 | +```js |
| 36 | +import { SplitFactory, LocalhostFromObject } from '@splitsoftware/splitio-react-native'; |
| 37 | + |
| 38 | +const factory = SplitFactory({ |
| 39 | + core: { |
| 40 | + authorizationKey: 'localhost', |
| 41 | + key: SOME_KEY |
| 42 | + }, |
| 43 | + features: { |
| 44 | + 'feature1': 'on' |
| 45 | + }, |
| 46 | + sync: { |
| 47 | + localhostMode: LocalhostFromObject() |
| 48 | + } |
| 49 | +}); |
| 50 | +``` |
| 51 | + |
| 52 | +with: |
| 53 | + |
| 54 | +```js |
| 55 | +import { SplitFactory } from '@splitsoftware/splitio-react-native'; |
| 56 | + |
| 57 | +const factory = SplitFactory({ |
| 58 | + core: { |
| 59 | + authorizationKey: 'localhost', |
| 60 | + key: SOME_KEY |
| 61 | + }, |
| 62 | + features: { |
| 63 | + 'feature1': 'on' |
| 64 | + } |
| 65 | +}); |
| 66 | +``` |
| 67 | + |
| 68 | +## Dropped support for Split Proxy below version 5.9.0. The SDK now requires Split Proxy 5.9.0 or above |
| 69 | + |
| 70 | +If using the Split Proxy with the SDK, make sure to update it to version 5.9.0 or above. This is required due to the introduction of Large Segments matchers in the React Native SDK, which uses a new HTTP endpoint to retrieve the segments data and is only supported by Split Proxy 5.9.0. |
0 commit comments