-
Notifications
You must be signed in to change notification settings - Fork 332
POC react native support #774
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
base: main
Are you sure you want to change the base?
Conversation
|
Just added initial iOS build proof of concept. PGLite runs on android and ios as a native C library! |
|
🚀 subscribed |
|
Fixed a bunch of bugs with the shared memory communication between react native and pglite. The basic tests in the example app seem to work properly now on both iOS and Android when setting up a new db or loading an existing one. |
|
The basics seem to work now, I think this is proof of concept achieved. To make it production usable there's still some todos:
|
|
Can we have progress for pglite-react-native? |
(very) WIP react native support.
Warning: this is definitely not complete or entirely correct. It is proof-of-concept level. There is a lot of leftover verbose logging and incorrect/unused code from iterating upon this. I don't have much C/C++ experience so I used claude code to help write and debug this.
This adds a pglite-react-native package and at least the beginnings of the changes needed for pglite to run on react native. See react-native.md in the corresponding postgres-pglite PR for an overview.
So far the following works:
The following needs work:
To try it out
pnpm installandpnpm build(first time only)npm installinpackages/pglite-react-native/examplenpx expo run:androidinpackages/pglite-react-native/exampleto start an android emulator, then ctrl+c to stop the rest./rebuild-mobile.shinpackages/pglite-react-native/exampleto compile everything, build the mobile app, and install it on the simulatornpx expo start -cto start dev serverThe rebuild-mobile.sh script automates a lot of the following steps, but you can do these manually if you have problems
postgres-pgliterunPLATFORM=android ABI=arm64-v8a PG_BRANCH=REL_17_5_WASM ./mobile-build/build-mobile.shto build pglite static libs for android. You need nix installed.packages/pglite-react-nativedopnpm installpackages/pglite-react-native/examplenpm installto install deps (first run only)npx expo run:androidto start android sim (first run only)rm -rf androidto clean generated android project (if needed)npx expo prebuild -p android --cleanto generate native android projectcd android./gradlew assembleDebugto build the apkadb install app/build/outputs/apk/debug/app-debug.apkto install on devicecd ..npx expo start -cto start the react native dev serveradb logcatto view android system logs for more detail.adb rootto get root adbadb shellto open a shell on devicerun-as com.evelant.exampleto run as app usercat files/pglite/runtime/initdb.stderr.logto see backend logsrm -rf files/pglite/pgdatato clear data for another run after a crashI hope this serves as a good starting point for robust react-native support!