-
Notifications
You must be signed in to change notification settings - Fork 8
Update Quickstart for React Native to v5 #267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Aaron LaBeau (biozal)
wants to merge
14
commits into
main
Choose a base branch
from
da-138-update-v5-react-native
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
dc41144
feat: update React Native quickstart to Ditto SDK v5
biozal 6bd42c8
docs: add Xcode and Gradle version requirements to README
biozal 81ecbca
feat: upgrade React Native Expo quickstart to SDK 55 and fix audit vu…
biozal 9f9a07c
security: patch fast-xml-parser and postcss in React Native quickstarts
biozal 5d139cc
updated to v5
biozal 806619d
Merge remote-tracking branch 'origin/main' into da-138-update-v5-reac…
biozal d985fd8
chore: untrack react-native/ios/Podfile.lock
biozal d47ef23
Updated Yarn file
biozal 5eab750
Potential fix for pull request finding
biozal 1baf3df
Potential fix for pull request finding
biozal 08337e9
Potential fix for pull request finding
biozal fc46b97
Potential fix for pull request finding
biozal 380f6ec
updated based on PR feedback
biozal e743ec5
updated to support yarn
biozal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| # Ditto SDK v5 Migration — Expo-Specific Requirements | ||
|
|
||
| These are the changes required specifically for Expo projects when migrating from Ditto SDK v4 to v5. These are in addition to the general API migration steps (DittoConfig, auth, sync, DQL, etc.). | ||
|
|
||
| ## 1. Add `expo-build-properties` dependency | ||
|
|
||
| The v5 Ditto Expo plugin internally calls `withBuildProperties()` from `expo-build-properties`. If this package is not installed, `expo prebuild` will fail with an import error. | ||
|
|
||
| ```bash | ||
| npm install expo-build-properties@~1.0.0 | ||
| ``` | ||
|
|
||
| ## 2. Configure Kotlin version in `app.json` | ||
|
|
||
| The v5 SDK requires Kotlin 2.1.20 for Android builds. Add the `expo-build-properties` plugin to your `app.json` with the Kotlin version: | ||
|
|
||
| ```json | ||
| { | ||
| "expo": { | ||
| "plugins": [ | ||
| [ | ||
| "expo-build-properties", | ||
| { | ||
| "android": { | ||
| "kotlinVersion": "2.1.20" | ||
| } | ||
| } | ||
| ] | ||
| ] | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Without this, Android builds will fail with Kotlin compilation errors. | ||
|
|
||
| ## 3. Call `init()` before using any Ditto API | ||
|
|
||
| v5 exports an `init()` function that must be called before creating a Ditto instance. On React Native this is effectively a no-op (it only loads WebAssembly on web), but all v5 examples call it and it is the recommended pattern. | ||
|
|
||
| ```typescript | ||
| import { Ditto, DittoConfig, init } from '@dittolive/ditto'; | ||
|
|
||
| async function startDitto() { | ||
| await init(); | ||
| const config = new DittoConfig(databaseId, connectConfig); | ||
| const ditto = await Ditto.open(config); | ||
| // ... | ||
| } | ||
| ``` | ||
|
|
||
| ## 4. Regenerate native projects | ||
|
|
||
| After making the above changes, delete the existing `ios` and `android` directories and regenerate them: | ||
|
|
||
| ```bash | ||
| rm -rf ios android | ||
| npx expo prebuild | ||
| ``` | ||
|
|
||
| The v5 Expo plugin automatically handles: | ||
|
|
||
| - **iOS**: `NSBluetoothAlwaysUsageDescription`, `NSLocalNetworkUsageDescription`, Bonjour services, and background modes in `Info.plist` | ||
| - **Android**: Bluetooth/WiFi/location permissions in `AndroidManifest.xml` and `packagingOptions.pickFirsts` for native libraries (`libdittoffi.so`, `libjsi.so`, `libreact_nativemodule_core.so`, `libturbomodulejsijni.so`, `libreactnative.so`) | ||
|
|
||
| ## 5. Update `yarn.lock` (if present) | ||
|
|
||
| If your project has both `package-lock.json` and `yarn.lock`, update both after adding the new dependency: | ||
|
|
||
| ```bash | ||
| npm install | ||
| npx yarn install | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+1.65 KB
(100%)
react-native-expo/android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion
2
react-native-expo/android/gradle/wrapper/gradle-wrapper.properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.