You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/powersync-sdk-react-native/README.md
+5-97Lines changed: 5 additions & 97 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -79,109 +79,17 @@ Add the Babel plugin to your `babel.config.js` file
79
79
};
80
80
```
81
81
82
-
##Native Projects
82
+
# Native Projects
83
83
84
84
This package uses native libraries. Create native Android and iOS projects (if not created already) with
85
85
86
86
```bash
87
87
npx expo run:android
88
+
# OR
89
+
npx expo run:ios
88
90
```
89
91
90
-
# Getting Started
92
+
# Learn More
93
+
Refer to our [full documentation](https://docs.powersync.com/client-sdk-references/react-native-and-expo) to learn more.
91
94
92
-
See our [Docs](https://docs.powersync.co/usage/installation/client-side-setup/integrating-with-your-backend#react-native-and-expo) for detailed instructions.
//location: 'optional location directory to DB file'
114
-
}).getInstance();
115
-
116
-
awaitPowerSync.init();
117
-
118
-
// Run local statements.
119
-
awaitPowerSync.execute('INSERT INTO customers(id, name) VALUES(uuid(), ?)', ['Fred']);
120
-
};
121
-
122
-
classConnector {
123
-
asyncfetchCredentials() {
124
-
// TODO logic to fetch a session
125
-
return {
126
-
endpoint:'[The PowerSync instance URL]',
127
-
token:'An authentication token',
128
-
expiresAt:'When the token expires',
129
-
userID:'User ID to associate the session with'
130
-
};
131
-
}
132
-
133
-
asyncuploadData(database) {
134
-
// Upload local changes to backend, see docs for example
135
-
}
136
-
}
137
-
138
-
exportconstconnectPowerSync=async () => {
139
-
constconnector=newConnector(); // Which was declared above
140
-
awaitPowerSync.connect(connector);
141
-
};
142
-
143
-
// Use queries in React Components
144
-
exportconstCustomerListDisplay= () => {
145
-
constcustomers=usePowerSyncWatchedQuery('SELECT * from customers');
146
-
147
-
return (
148
-
<View>
149
-
{customers.map((l) => (
150
-
<Text key={l.id}>{JSON.stringify(l)}</Text>
151
-
))}
152
-
</View>
153
-
);
154
-
};
155
-
156
-
```
157
-
158
-
Refer to our [full documentation](https://docs.powersync.co/client-sdk-references/react-native-and-expo) to learn more.
159
-
160
-
# Known Issues
161
-
162
-
## Android
163
-
The PowerSync connection relies heavily on HTTP streams. React Native does not support streams out of the box, so we use the [polyfills](#polyfills-fetch) mentioned. There is currently an open [issue](https://github.com/facebook/flipper/issues/2495) where the Flipper network plugin does not allow Stream events to fire. This plugin needs to be [disabled](https://stackoverflow.com/questions/69235694/react-native-cant-connect-to-sse-in-android/69235695#69235695) in order for HTTP streams to work.
Testing offline mode on an iOS simulator by disabling the host machine's entire internet connection will cause the device to remain offline even after the internet connection has been restored. This issue seems to affect all network requests in an application.
0 commit comments