diff --git a/content/docs/expo/changelog.mdx b/content/docs/expo/changelog.mdx index 3a9a4a2..1e9bf47 100644 --- a/content/docs/expo/changelog.mdx +++ b/content/docs/expo/changelog.mdx @@ -5,6 +5,12 @@ description: "Release notes for the Superwall Expo SDK" # Changelog +## 1.1.3 + +### Patch Changes + +- a8ba5af: Add localResources resolving for expo + ## 1.1.2 ### Patch Changes diff --git a/content/docs/expo/guides/configuring.mdx b/content/docs/expo/guides/configuring.mdx index 68b8a5d..f225a2b 100644 --- a/content/docs/expo/guides/configuring.mdx +++ b/content/docs/expo/guides/configuring.mdx @@ -33,6 +33,10 @@ Expo apps inherit the native Superwall option surface. The following fields were description: "Controls when the SDK enters test mode. When active, purchases are simulated and product data is retrieved from the Superwall dashboard. Set to \"always\" during development to test your entire paywall flow without StoreKit or Play Store.", default: '"automatic"', }, + localResources: { + type: "Record", + description: "A mapping of local resource IDs to local assets. The paywall webview can reference these via the `swlocal://` URL scheme. Accepts a Metro `require()` result, a file URI string, or a `{ uri: string }` object. Resolved at configure time.", + }, }} /> diff --git a/content/docs/expo/guides/local-resources.mdx b/content/docs/expo/guides/local-resources.mdx new file mode 100644 index 0000000..35e76ed --- /dev/null +++ b/content/docs/expo/guides/local-resources.mdx @@ -0,0 +1,6 @@ +--- +title: "Local Resources" +description: "Bundle images, videos, and other assets in your app so paywalls can load them instantly from the device." +--- + +../../../shared/local-resources.mdx diff --git a/content/docs/expo/index.mdx b/content/docs/expo/index.mdx index bd5df22..6a4a61b 100644 --- a/content/docs/expo/index.mdx +++ b/content/docs/expo/index.mdx @@ -47,4 +47,4 @@ If you have feedback on any of our docs, please leave a rating and message at th If you have any issues please [open an issue on GitHub](https://github.com/superwall/expo-superwall/issues). - + diff --git a/content/docs/expo/meta.json b/content/docs/expo/meta.json index a9b82b3..fdee69c 100644 --- a/content/docs/expo/meta.json +++ b/content/docs/expo/meta.json @@ -36,6 +36,7 @@ "guides/managing-users", "guides/experimental-flags", "guides/testing-purchases", + "guides/local-resources", "guides/setting-locale", "guides/advanced", "guides/migrations", diff --git a/content/docs/expo/sdk-reference/index.mdx b/content/docs/expo/sdk-reference/index.mdx index 3ccc7f1..ef682eb 100644 --- a/content/docs/expo/sdk-reference/index.mdx +++ b/content/docs/expo/sdk-reference/index.mdx @@ -15,4 +15,4 @@ If you have feedback on any of our docs, please leave a rating and message at th If you have any issues with the SDK, please [open an issue on GitHub](https://github.com/superwall/expo-superwall/issues). - + diff --git a/content/shared/local-resources.mdx b/content/shared/local-resources.mdx index f77908e..f7ef091 100644 --- a/content/shared/local-resources.mdx +++ b/content/shared/local-resources.mdx @@ -17,6 +17,12 @@ Local resources let your paywalls load bundled assets directly from the device i ::: +:::expo + + Local resources require **Expo SDK v1.1.3+**. + +::: + ## Registering local resources Choose a stable resource ID for each asset you want to serve locally. That same ID is what you'll select in the [paywall editor](/dashboard/dashboard-creating-paywalls/paywall-editor-local-resources) when configuring image or video components. @@ -80,6 +86,37 @@ class MyApplication : Application() { ::: +:::expo +On Expo, pass `localResources` in the `options` prop on `SuperwallProvider`. Entries are resolved during configuration — Metro `require()` results are downloaded via `expo-asset` so the webview can read them from a `file://` URI. + +```tsx Expo +import * as FileSystem from "expo-file-system" +import { SuperwallProvider } from "expo-superwall" + +export function App() { + return ( + + {/* your app */} + + ) +} +``` + + + `localResources` is resolved when `SuperwallProvider` configures the SDK. Resources added later + will not be available to paywalls that already loaded. + +::: + ## Supported source types :::ios @@ -99,6 +136,16 @@ Android supports two local resource source types: | `PaywallResource.FromUri(uri)` | Files addressed by a `Uri`, such as files in app storage or content provider URLs | ::: +:::expo +Each entry in `localResources` accepts one of: + +| Type | Use for | +| ---- | ------- | +| `number` (Metro `require()`) | Bundled assets in your Expo project; resolved through `expo-asset` | +| `string` | A `file://`, `content://`, or absolute path URI | +| `{ uri: string }` | The same shape used by React Native `Image` sources | +::: + ## Choosing resource IDs Resource IDs are the contract between your app and the paywall editor. A few guidelines: @@ -130,6 +177,13 @@ If a resource ID does not appear in the editor or fails to load: ## Related +:::ios - [iOS `localResources`](/sdk/sdk-reference/localResources): SDK reference for the iOS property. +::: +:::android - [Android `localResources`](/sdk/sdk-reference/localResources): SDK reference for the Android property. +::: +:::expo +- [Configuring the SDK](/expo/guides/configuring): Where `localResources` lives in the Expo options surface. +::: - [Paywall Editor: Local Resources](/dashboard/dashboard-creating-paywalls/paywall-editor-local-resources): How to assign local resource IDs in the dashboard.