Skip to content

Commit 185cd00

Browse files
committed
Documentation edits made through Mintlify web editor
1 parent bc3de4f commit 185cd00

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

client-sdk-references/react-native-and-expo/react-native-web-support.mdx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,20 @@ title: "React Native Web Support"
77
Support for React Native Web is available since versions 1.12.1 of the [PowerSync React Native SDK](/client-sdk-references/react-native-and-expo) and 1.8.0 if the [JavaScript/Web SDK](/client-sdk-references/javascript-web), and is currently in a **beta** release.
88

99
A demo app showcasing this functionality is available here:
10-
<Card
11-
title="powersync-js/demos/react-native-web-supabase-todolist"
12-
icon="github"
13-
href="https://github.com/powersync-ja/powersync-js/tree/main/demos/react-native-web-supabase-todolist"
14-
horizontal
15-
/>
10+
11+
<Card title="powersync-js/demos/react-native-web-supabase-todolist" icon="github" href="https://github.com/powersync-ja/powersync-js/tree/main/demos/react-native-web-supabase-todolist" horizontal />
1612

1713
## Configuring PowerSync in your React Native for Web project
1814

1915
To ensure that PowerSync features are fully supported in your React Native Web project, follow the below steps. This documentation covers necessary web worker configurations, database instantiation, and multi-platform implementations.
2016

21-
### 1\. Install Web SDK
17+
### 1. Install Web SDK
2218

2319
The [PowerSync Web SDK](/client-sdk-references/javascript-web), alongside the [PowerSync React Native SDK](/client-sdk-references/react-native-and-expo), is required for Web support.
2420

2521
See installation instructions [here](https://www.npmjs.com/package/@powersync/web).
2622

27-
### 2\. Configure Web Workers
23+
### 2. Configure Web Workers
2824

2925
For React Native for Web, workers need to be configured when instantiating `PowerSyncDatabase`. An example of this is available [here](https://github.com/powersync-ja/powersync-js/blob/main/demos/react-native-web-supabase-todolist/library/powersync/system.ts).
3026

@@ -33,11 +29,12 @@ To do this, copy the contents of `node_modules/@powersync/web/dist` to the root
3329
The [`@powersync/web`](https://github.com/powersync-ja/powersync-js/tree/main/packages/web) package includes a CLI utility which can copy the required assets to the `public` directory (configurable with the `--output` option).
3430

3531
```bash
36-
npx powersync-web copy-assets # Places assets into public/@powersync by default. Override with `--output path/from_current_working_dir`.
32+
# Places assets into public/@powersync by default. Override with `--output path/from_current_working_dir`.
33+
npx powersync-web copy-assets
3734
# or pnpm powersync-web copy-assets
3835
```
3936

40-
### 3\. Instantiate Web Workers
37+
### 3. Instantiate Web Workers
4138

4239
The example below demonstrates how to instantiate the workers (PowerSync requires a database and a sync worker) when instantiating `PowerSyncDatabase`. You can either specify a path to the worker (they are available in the `worker` directory of the `dist` contents), or provide a factory function to create the worker.
4340

@@ -83,7 +80,7 @@ this.powersync = new PowerSyncDatabaseWeb({
8380

8481
This `PowerSyncDatabaseWeb` database will be used alongside the native `PowerSyncDatabase` to support platform-specific implementations. See the [Instantiating PowerSync](/client-sdk-references/react-native-and-expo/react-native-web-support#implementations) section below for more details.
8582

86-
### 4\. Enable multiple platforms
83+
### 4. Enable multiple platforms
8784

8885
To target both mobile and web platforms, you need to adjust the Metro configuration and handle platform-specific libraries accordingly.
8986

@@ -193,6 +190,7 @@ export async function prompt(
193190
```
194191

195192
Which can then be used agnostically in a component.
193+
196194
```js
197195
import { Button } from 'react-native';
198196
import { prompt } from 'util/prompt';
@@ -215,15 +213,17 @@ import { prompt } from 'util/prompt';
215213
}}
216214
/>;
217215
```
218-
### 5\. Configure UMD target
216+
217+
### 5. Configure UMD target
219218

220219
React Native Web requires the UMD target of `@powersync/web` (available at `@powersync/web/umd`). To fully support this target version, configure the following in your project:
221220

222221
1. Add `config.resolver.unstable_enablePackageExports = true;` to your `metro.config.js` file.
222+
223223
2. TypeScript projects: In the `tsconfig.json` file specify the `moduleResolution` to be `Bundler`.
224224

225225
```json
226226
"compilerOptions": {
227227
"moduleResolution": "Bundler"
228228
}
229-
```
229+
```

0 commit comments

Comments
 (0)