Full SDK reference for using PowerSync in React Native clients
@powersync/react-native@1.11.0
) or HTTP streaming (before @powersync/react-native@1.11.0
). See Developer Notes for more details on connection methods and platform-specific requirements.
text
, integer
and real
. These should map directly to the values produced by the Sync Rules. If a value doesn’t match, it is cast automatically. For details on how Postgres types are mapped to the types below, see the section on Types in the Sync Rules documentation.
Example:
id
column - as PowerSync will automatically create this.null
if no result is found).
AsyncGenerator
, or with a callback.
PowerSyncDatabase.connect()
method uses WebSocket. You can optionally specify the connectionMethod
to override this:
@powersync/react-native@1.11.0
.
If you are connecting to PowerSync using HTTP streams, you require additional configuration on Android. React Native does not support streams out of the box, so we use the polyfills mentioned. There is currently an open issue where the Flipper network plugin does not allow Stream events to fire. This plugin needs to be disabled in order for HTTP streams to work.
If you are using Java (Expo < 50):
Uncomment the following from android/app/src/debug/java/com/<ProjectName>/ReactNativeFlipper.java
android/gradle.properties
onCreate
in android/app/src/main/java/com/<ProjectName>/example/MainApplication.kt
use_frameworks
(for example, because you are using Google Analytics or Firebase Analytics) will silently break the compilation process of react-native-quick-sqlite on iOS and results in the PowerSync SQLite extension not loading correctly. To solve this, add this to your Podfile: