Skip to content

Commit 5af1a5e

Browse files
committed
docs: update readme
1 parent b5f1aa0 commit 5af1a5e

1 file changed

Lines changed: 24 additions & 5 deletions

File tree

README.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Build real-time, collaborative mobile apps that work seamlessly offline and auto
4747
- [`expo-notifications`](https://docs.expo.dev/versions/latest/sdk/notifications/)
4848
- [`expo-constants`](https://docs.expo.dev/versions/latest/sdk/constants/)
4949

50-
> **⚠️ Note:** This library is **native-only** (iOS/Android).
50+
> **Note:** This library is **native-only** (iOS/Android). Web is not supported.
5151
5252
## 📦 Installation
5353

@@ -79,7 +79,21 @@ No additional setup required. Native modules are linked automatically.
7979

8080
#### Expo
8181

82-
If using Expo, you must use **development builds** (Expo Go is not supported):
82+
If using Expo, you must use **development builds** (Expo Go is not supported).
83+
84+
**1. Set Android `minSdkVersion` to 26** (Expo defaults to 24, which will cause a build failure):
85+
86+
```bash
87+
npx expo install expo-build-properties
88+
```
89+
90+
Add to your `app.json` or `app.config.js` plugins:
91+
92+
```json
93+
["expo-build-properties", { "android": { "minSdkVersion": 26 } }]
94+
```
95+
96+
**2. Build and run:**
8397

8498
```bash
8599
# Generate native directories
@@ -101,7 +115,7 @@ npx expo run:android
101115
2. **Create a database**
102116
Follow the [database creation guide](https://docs.sqlitecloud.io/docs/create-database).
103117

104-
> Ensure your tables have identical schemas in both local and cloud databases.
118+
> Ensure your tables have identical schemas in both local and cloud databases. See [SQLite Sync Best Practices](https://docs.sqlitecloud.io/docs/sqlite-sync-best-practices) for schema requirements (e.g., all non-primary-key `NOT NULL` columns must have a `DEFAULT` value).
105119
106120
3. **Enable OffSync**
107121
Configure OffSync by following the [OffSync setup guide](https://docs.sqlitecloud.io/docs/offsync#:~:text=in%20the%20cloud.-,Configuring%20OffSync,-You%20can%20enable).
@@ -156,6 +170,7 @@ import {
156170
useOnTableUpdate,
157171
useTriggerSqliteSync,
158172
useSqliteTransaction,
173+
useSyncStatus,
159174
} from '@sqliteai/sqlite-sync-react-native';
160175

161176
interface Task {
@@ -186,7 +201,10 @@ function TaskList() {
186201

187202
// 3. WRITING DATA: Use transactions to trigger reactive queries
188203
const { executeTransaction } = useSqliteTransaction();
189-
const { triggerSync, isSyncing } = useTriggerSqliteSync();
204+
const { triggerSync } = useTriggerSqliteSync();
205+
206+
// 4. SYNC STATUS: Get sync state for UI indicators
207+
const { isSyncing } = useSyncStatus();
190208

191209
const addTask = useCallback(
192210
async (title: string) => {
@@ -748,7 +766,8 @@ Manually trigger a sync operation.
748766
**How it works:** This hook is a convenience wrapper that exposes the `triggerSync` function from the Provider. The actual sync logic lives in `SQLiteSyncProvider` to ensure that `isSyncing`, `lastSyncTime`, and `lastSyncChanges` state are updated correctly, allowing all hooks (`useSqliteSyncQuery`) to react properly.
749767
750768
```typescript
751-
const { triggerSync, isSyncing } = useTriggerSqliteSync();
769+
const { triggerSync } = useTriggerSqliteSync();
770+
const { isSyncing } = useSyncStatus(); // isSyncing comes from useSyncStatus
752771

753772
// Trigger sync on button press
754773
<Button

0 commit comments

Comments
 (0)