@userflow-tech/react-native 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -54
- package/docs/troubleshooting.md +29 -23
- package/expo-plugin/hostDependencyWarnings.d.ts +5 -2
- package/expo-plugin/hostDependencyWarnings.d.ts.map +1 -1
- package/expo-plugin/hostDependencyWarnings.js +12 -2
- package/expo-plugin/hostDependencyWarnings.js.map +1 -1
- package/lib/commonjs/authoring/capturePickerScreenshot.js +9 -1
- package/lib/commonjs/authoring/capturePickerScreenshot.js.map +1 -1
- package/lib/commonjs/evalJs/getWebView.js +5 -13
- package/lib/commonjs/evalJs/getWebView.js.map +1 -1
- package/lib/commonjs/hostAppVersion.js +6 -1
- package/lib/commonjs/hostAppVersion.js.map +1 -1
- package/lib/commonjs/installCheck.js +61 -29
- package/lib/commonjs/installCheck.js.map +1 -1
- package/lib/commonjs/nativeModules.js +44 -0
- package/lib/commonjs/nativeModules.js.map +1 -0
- package/lib/commonjs/network.js +20 -7
- package/lib/commonjs/network.js.map +1 -1
- package/lib/commonjs/pairing/tokenStorage.js +17 -4
- package/lib/commonjs/pairing/tokenStorage.js.map +1 -1
- package/lib/commonjs/surfaces/BannerSurface.js +3 -1
- package/lib/commonjs/surfaces/BannerSurface.js.map +1 -1
- package/lib/commonjs/surfaces/safeArea.js +6 -0
- package/lib/commonjs/surfaces/safeArea.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/authoring/capturePickerScreenshot.js +9 -1
- package/lib/module/authoring/capturePickerScreenshot.js.map +1 -1
- package/lib/module/evalJs/getWebView.js +5 -13
- package/lib/module/evalJs/getWebView.js.map +1 -1
- package/lib/module/hostAppVersion.js +6 -1
- package/lib/module/hostAppVersion.js.map +1 -1
- package/lib/module/installCheck.js +56 -26
- package/lib/module/installCheck.js.map +1 -1
- package/lib/module/nativeModules.js +40 -0
- package/lib/module/nativeModules.js.map +1 -0
- package/lib/module/network.js +20 -7
- package/lib/module/network.js.map +1 -1
- package/lib/module/pairing/tokenStorage.js +17 -4
- package/lib/module/pairing/tokenStorage.js.map +1 -1
- package/lib/module/surfaces/BannerSurface.js +3 -1
- package/lib/module/surfaces/BannerSurface.js.map +1 -1
- package/lib/module/surfaces/safeArea.js +5 -0
- package/lib/module/surfaces/safeArea.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/commonjs/src/authoring/capturePickerScreenshot.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/evalJs/getWebView.d.ts +2 -1
- package/lib/typescript/commonjs/src/evalJs/getWebView.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/hostAppVersion.d.ts +1 -1
- package/lib/typescript/commonjs/src/hostAppVersion.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/installCheck.d.ts +18 -3
- package/lib/typescript/commonjs/src/installCheck.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/nativeModules.d.ts +13 -0
- package/lib/typescript/commonjs/src/nativeModules.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/network.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/pairing/tokenStorage.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/surfaces/BannerSurface.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/surfaces/safeArea.d.ts +2 -0
- package/lib/typescript/commonjs/src/surfaces/safeArea.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/version.d.ts +1 -1
- package/lib/typescript/module/src/authoring/capturePickerScreenshot.d.ts.map +1 -1
- package/lib/typescript/module/src/evalJs/getWebView.d.ts +2 -1
- package/lib/typescript/module/src/evalJs/getWebView.d.ts.map +1 -1
- package/lib/typescript/module/src/hostAppVersion.d.ts +1 -1
- package/lib/typescript/module/src/hostAppVersion.d.ts.map +1 -1
- package/lib/typescript/module/src/installCheck.d.ts +18 -3
- package/lib/typescript/module/src/installCheck.d.ts.map +1 -1
- package/lib/typescript/module/src/nativeModules.d.ts +13 -0
- package/lib/typescript/module/src/nativeModules.d.ts.map +1 -0
- package/lib/typescript/module/src/network.d.ts.map +1 -1
- package/lib/typescript/module/src/pairing/tokenStorage.d.ts.map +1 -1
- package/lib/typescript/module/src/surfaces/BannerSurface.d.ts.map +1 -1
- package/lib/typescript/module/src/surfaces/safeArea.d.ts +2 -0
- package/lib/typescript/module/src/surfaces/safeArea.d.ts.map +1 -1
- package/lib/typescript/module/src/version.d.ts +1 -1
- package/package.json +13 -8
- package/src/authoring/capturePickerScreenshot.ts +10 -1
- package/src/evalJs/getWebView.ts +6 -13
- package/src/hostAppVersion.ts +7 -1
- package/src/installCheck.ts +67 -33
- package/src/nativeModules.ts +48 -0
- package/src/network.ts +27 -11
- package/src/pairing/tokenStorage.ts +23 -7
- package/src/surfaces/BannerSurface.tsx +7 -5
- package/src/surfaces/safeArea.ts +5 -0
- package/src/version.ts +1 -1
- package/vendor/core/package.json +1 -1
- package/vendor/protocol/package.json +1 -1
- package/docs/webview-custom-banner-poc.md +0 -64
package/README.md
CHANGED
|
@@ -4,37 +4,55 @@ Official Userflow SDK for React Native and Expo. Deliver guided flows, tooltips,
|
|
|
4
4
|
and modals authored in the Userflow dashboard — without shipping a new app
|
|
5
5
|
release for every content change.
|
|
6
6
|
|
|
7
|
-
> Early development. APIs may change.
|
|
8
|
-
> (`publishConfig.access: restricted`).
|
|
7
|
+
> Early development. APIs may change.
|
|
9
8
|
|
|
10
9
|
## Requirements
|
|
11
10
|
|
|
12
|
-
Declared minimums: React `>=18.2.0`, React Native `>=0.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
|
33
|
-
|
|
|
11
|
+
Declared minimums: React `>=18.2.0`, React Native `>=0.76.0`. React Native
|
|
12
|
+
0.74 and 0.75 cannot install this SDK: `react-native-view-shot` 5.x, which
|
|
13
|
+
Builder element selection needs, requires React Native 0.76 or later. This
|
|
14
|
+
package's test suite runs on React Native 0.81 / React 19.1. The TinyTime
|
|
15
|
+
sample app in this repo runs on Expo SDK 57 / React Native 0.86. Expo Go is
|
|
16
|
+
not supported.
|
|
17
|
+
|
|
18
|
+
`@react-native-async-storage/async-storage` is the only native module this
|
|
19
|
+
package depends on, so npm installs it. `react-native-webview` and
|
|
20
|
+
`react-native-view-shot` are required peers. npm 7+ and pnpm install required
|
|
21
|
+
peers. Yarn 1 and `npm install --legacy-peer-deps` do not, which is why the
|
|
22
|
+
install commands list WebView and view-shot explicitly.
|
|
23
|
+
`react-native-device-info` is an optional peer for bare React Native.
|
|
24
|
+
|
|
25
|
+
Install those packages in the **app** as well. Expo SDK 54 and later autolink
|
|
26
|
+
native modules found anywhere in the tree. Bare React Native, and Expo SDK 53
|
|
27
|
+
and older, only autolink packages listed in the app's own `package.json`. A
|
|
28
|
+
direct install also picks a version that matches the app's React Native, inside
|
|
29
|
+
the ranges below.
|
|
30
|
+
|
|
31
|
+
| Package | Kind | Why | If missing |
|
|
32
|
+
| ------------------------------------------------------- | -------------------------------- | ----------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
33
|
+
| `react`, `react-native` `>=0.76.0` | Required peers | Host runtime. | The app cannot load the SDK. React Native older than 0.76 fails install (`ERESOLVE`) because view-shot 5.x requires it. |
|
|
34
|
+
| `@react-native-async-storage/async-storage` `>=1.23 <3` | Dependency | Anonymous user id and the pairing device id. | `identifyAnonymous()` throws. Pairing keeps a device id in memory for the session. A dev-only warning is logged from `Userflow.init`. |
|
|
35
|
+
| `react-native-device-info` `>=11 <16` | Optional peer, bare React Native | Host app `app_version` / `app_build`. Expo reads `expo-application` / `expo-constants` instead. | Those attributes are omitted. A dev-only warning is logged on bare React Native. |
|
|
36
|
+
| `react-native-view-shot` `^5.0.0` | Required peer | Builder element-selection screenshots. | The picker has no screenshot. A dev-only warning is logged from `Userflow.init`. Version 6.x is outside the tested range and requires React Native 0.80 or later. |
|
|
37
|
+
| `react-native-webview` `>=13.8.0 <14` | Required peer | Evaluate JavaScript and WebView banners. | Those surfaces do not run. A dev-only warning is logged from `Userflow.init`. |
|
|
38
|
+
| `react-native-safe-area-context` `>=4 <6` | Optional peer | Insets for banners, flow cards, and Builder bars. | In development, `Userflow.init` warns once. Those surfaces draw under the status bar and home indicator. With the package installed but no `<SafeAreaProvider>`, cards use the device's initial insets and log a separate warning. |
|
|
39
|
+
| `@react-navigation/native` | Optional peer | Screen tracking and NAVIGATE routing (React Navigation). | Report screens yourself with `updateScreen` / `useUserflowScreen`. |
|
|
40
|
+
| `expo-router` | Optional peer | Screen tracking and NAVIGATE routing (Expo Router). | Report screens yourself with `updateScreen` / `useUserflowScreen`. |
|
|
41
|
+
| `@react-native-community/netinfo` `>=11 <13` | Optional peer | Instant offline→online reconnect. | Recovery still runs on the heartbeat and when the app returns to the foreground. If the JavaScript package is installed but `RNCNetInfo` is not in the binary, the SDK skips it instead of showing a red screen. |
|
|
42
|
+
| `expo-secure-store` | Optional peer | Persist the Builder pairing JWT in Keychain/Keystore. | The pairing token stays in memory and is lost when the process ends. The SDK loads it only when the `ExpoSecureStore` native module is registered. |
|
|
34
43
|
|
|
35
44
|
Optional peers are declared `optional: true` in `peerDependenciesMeta`, so
|
|
36
|
-
package managers
|
|
37
|
-
|
|
45
|
+
package managers do not warn if you skip them.
|
|
46
|
+
|
|
47
|
+
npm 7+ and pnpm install required peers (`react-native-webview`,
|
|
48
|
+
`react-native-view-shot`) automatically. Yarn 1 and
|
|
49
|
+
`npm install --legacy-peer-deps` do not install peers, and they bury the
|
|
50
|
+
missing-peer warnings among unrelated ones. That is why the install commands
|
|
51
|
+
list WebView and view-shot explicitly. A clean npm install prints no warning
|
|
52
|
+
about optional peers, so install `react-native-safe-area-context` and NetInfo
|
|
53
|
+
yourself when you want the behavior in the table. An app that already depends
|
|
54
|
+
on an older major (view-shot 4.0.3, NetInfo 9.x, safe-area 3.x, WebView 13.6.x
|
|
55
|
+
or 14.x) fails install with `ERESOLVE`.
|
|
38
56
|
|
|
39
57
|
### Expo Go is not supported
|
|
40
58
|
|
|
@@ -47,23 +65,7 @@ Use an **Expo development build** (or bare React Native). In development,
|
|
|
47
65
|
|
|
48
66
|
## Install
|
|
49
67
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
Packages publish to the private `@userflow-tech` npm org. Userflow adds the
|
|
53
|
-
client's npm user or organization to a **read-only team** on that org. The
|
|
54
|
-
client then creates a **granular access token** on npm (Read-only, limited to
|
|
55
|
-
`@userflow-tech`). A `404` from `npm install` or `npm view @userflow-tech/react-native`
|
|
56
|
-
means the token is missing, or that user or org is not on the team. npm uses
|
|
57
|
-
404 for a private package the caller cannot see.
|
|
58
|
-
|
|
59
|
-
### npm, Yarn, and CI
|
|
60
|
-
|
|
61
|
-
npm and Yarn 1 read `.npmrc`. Do not commit the token:
|
|
62
|
-
|
|
63
|
-
```ini
|
|
64
|
-
@userflow-tech:registry=https://registry.npmjs.org/
|
|
65
|
-
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
|
|
66
|
-
```
|
|
68
|
+
The package is public on npm; no token or `.npmrc` setup is needed.
|
|
67
69
|
|
|
68
70
|
Yarn 2 and later ignore `.npmrc`. Add this to `.yarnrc.yml` instead:
|
|
69
71
|
|
|
@@ -88,11 +90,25 @@ npm install @userflow-tech/react-native @react-native-async-storage/async-storag
|
|
|
88
90
|
cd ios && pod install
|
|
89
91
|
```
|
|
90
92
|
|
|
91
|
-
`react-native-view-shot`
|
|
92
|
-
|
|
93
|
+
`react-native-webview` and `react-native-view-shot` (`^5.0.0`) are **required
|
|
94
|
+
peers**. npm 7+ and pnpm install them. Yarn 1 and
|
|
95
|
+
`npm install --legacy-peer-deps` do not, so the commands above install them in
|
|
96
|
+
the app. Both are native modules — rebuild after install (a Metro reload is not
|
|
97
|
+
enough). On Expo SDK 54,
|
|
93
98
|
unpinned `npx expo install react-native-view-shot` resolves **4.0.3**, which
|
|
94
|
-
does not satisfy the peer. Pin `^5.0.0` as in the command above. If
|
|
95
|
-
|
|
99
|
+
does not satisfy the peer. Pin `^5.0.0` as in the command above. If the app
|
|
100
|
+
already depends on 4.0.3, that same command is what fixes it: installing the
|
|
101
|
+
SDK alone fails with
|
|
102
|
+
|
|
103
|
+
```text
|
|
104
|
+
npm error Found: react-native-view-shot@4.0.3
|
|
105
|
+
npm error peer react-native-view-shot@"^5.0.0" from @userflow-tech/react-native
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Do not retry with `--force` or `--legacy-peer-deps`. That installs the SDK and
|
|
109
|
+
leaves 4.0.3 in place. If that already happened, `Userflow.init` warns in
|
|
110
|
+
development and names the installed version. If `expo doctor`
|
|
111
|
+
reports the `^5.0.0` pin, exclude it from Expo's version check:
|
|
96
112
|
|
|
97
113
|
```json
|
|
98
114
|
{
|
|
@@ -546,10 +562,14 @@ Screen tracking ≠ action routing. React Navigation apps need
|
|
|
546
562
|
## Install diagnostics
|
|
547
563
|
|
|
548
564
|
In development, the first `Userflow.init` checks native module registration and
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
565
|
+
whether `react-native-safe-area-context` is installed. Missing native modules
|
|
566
|
+
share one warning. A missing safe-area package gets its own warning, because
|
|
567
|
+
flows still run and draw under the status bar. It does not `require` an
|
|
568
|
+
unlinked package (including NetInfo, whose import throws when `RNCNetInfo` is
|
|
569
|
+
absent). Rebuild the native app after fixing a native-module line; a Metro
|
|
570
|
+
reload is not enough. Installing safe-area-context also needs a rebuild, then a
|
|
571
|
+
`<SafeAreaProvider>` around the app. The warnings look like this (only the
|
|
572
|
+
missing lines are included):
|
|
553
573
|
|
|
554
574
|
```text
|
|
555
575
|
[Userflow] Native setup is incomplete. Flows may not run until you fix the following, then rebuild the app (a Metro reload is not enough):
|
|
@@ -557,7 +577,12 @@ are included):
|
|
|
557
577
|
- react-native-view-shot is not linked, so Builder element selection gets no screenshot. Install react-native-view-shot@^5.0.0 and rebuild. On Expo SDK 54, pin ^5.0.0; an unpinned npx expo install resolves 4.0.3.
|
|
558
578
|
- react-native-webview is not linked. Evaluate JavaScript and WebView banners will not run. Install it (npx expo install react-native-webview) and rebuild.
|
|
559
579
|
- react-native-device-info is not linked, so app_version and app_build are not sent. npm install react-native-device-info, then rebuild.
|
|
560
|
-
See docs/troubleshooting.md.
|
|
580
|
+
See node_modules/@userflow-tech/react-native/docs/troubleshooting.md.
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
```text
|
|
584
|
+
[Userflow] react-native-safe-area-context is not installed, so banners, flow cards, and Builder bars draw under the status bar and home indicator. Install it (npx expo install react-native-safe-area-context) and wrap the app in <SafeAreaProvider>.
|
|
585
|
+
See node_modules/@userflow-tech/react-native/docs/troubleshooting.md.
|
|
561
586
|
```
|
|
562
587
|
|
|
563
588
|
Passing an environment secret key as `clientToken` throws:
|
|
@@ -572,8 +597,11 @@ Pairing stays on `https://e.userflow.com`.
|
|
|
572
597
|
|
|
573
598
|
`expo prebuild` warns when the config plugin has no `schemeId`, when
|
|
574
599
|
`react-native-view-shot` is missing or older than 5, and (on Expo SDK 53 and
|
|
575
|
-
older) when AsyncStorage or
|
|
576
|
-
|
|
600
|
+
older) when AsyncStorage, WebView, or safe-area-context is not a direct
|
|
601
|
+
dependency. Expo SDK 54 and later autolink safe-area-context when another
|
|
602
|
+
package such as Expo Router brought it in, so prebuild stays quiet in that
|
|
603
|
+
case. `Userflow.init` still warns when the package itself cannot be loaded.
|
|
604
|
+
Passing an environment UUID as `schemeId` fails the prebuild:
|
|
577
605
|
|
|
578
606
|
```text
|
|
579
607
|
[@userflow-tech/react-native] schemeId "550e8400-e29b-41d4-a716-446655440000" looks like an environment id. Pass the scheme_id value that starts with userflow- (an opaque id from the dashboard), not the environment UUID.
|
package/docs/troubleshooting.md
CHANGED
|
@@ -5,29 +5,35 @@ Messages are quoted exactly so you can search logs for them.
|
|
|
5
5
|
|
|
6
6
|
## Install
|
|
7
7
|
|
|
8
|
-
| Symptom / log message
|
|
9
|
-
|
|
|
10
|
-
| `404` from `npm install` or `npm view @userflow-tech/react-native`
|
|
11
|
-
| Yarn 2+ still 404s with a valid `.npmrc`
|
|
12
|
-
| EAS or CI install 404s while local install works
|
|
13
|
-
| `expo doctor` reports `react-native-view-shot`
|
|
14
|
-
| `Unable to resolve module` for an optional peer (`netinfo`, `expo-secure-store`, `expo-router`, safe-area, navigation)
|
|
15
|
-
| `
|
|
16
|
-
|
|
|
17
|
-
| react-native-
|
|
18
|
-
| `
|
|
19
|
-
|
|
|
20
|
-
| `
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
|
|
|
25
|
-
|
|
|
26
|
-
| `[Userflow]
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
8
|
+
| Symptom / log message | Likely cause | Fix |
|
|
9
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
10
|
+
| `404` from `npm install` or `npm view @userflow-tech/react-native` | The npm token is missing, or the npm user or org is not on the read-only `@userflow-tech` team. npm returns 404 for a private package the caller cannot see. | Ask Userflow to add the npm user or org to the read-only team, then create a granular read-only token limited to `@userflow-tech`. |
|
|
11
|
+
| Yarn 2+ still 404s with a valid `.npmrc` | Yarn 2 and later ignore `.npmrc`. | Set `npmScopes.userflow-tech.npmRegistryServer` and `npmAuthToken` in `.yarnrc.yml`. |
|
|
12
|
+
| EAS or CI install 404s while local install works | `NPM_TOKEN` is not available to that environment. | Add `NPM_TOKEN` as an EAS secret or CI secret. The `.npmrc` line `//registry.npmjs.org/:_authToken=${NPM_TOKEN}` reads it at install time. |
|
|
13
|
+
| `expo doctor` reports `react-native-view-shot` | The app pins `^5.0.0` and Expo SDK 54's expected version is 4.0.3. | Keep the pin. Add `"react-native-view-shot"` to `expo.install.exclude`. |
|
|
14
|
+
| `Unable to resolve module` for an optional peer (`netinfo`, `expo-secure-store`, `expo-router`, safe-area, navigation) | A custom Metro config does not extend `getDefaultConfig`, so `allowOptionalDependencies` is off. | Extend `getDefaultConfig` from `expo/metro-config` or `@react-native/metro-config`. |
|
|
15
|
+
| `ERESOLVE` while installing `@userflow-tech/react-native` | The app already has a version outside a peer range: view-shot 4.0.3 (what unpinned `npx expo install` installs on Expo SDK 54), NetInfo 9.x, safe-area-context 3.x, WebView 13.6.x or 14.x, or React Native older than 0.76. | Move that package into the range in the package README. For view-shot, npm prints `Found: react-native-view-shot@4.0.3` and `peer react-native-view-shot@"^5.0.0" from @userflow-tech/react-native`. Install the SDK and `react-native-view-shot@^5.0.0` in one command, then add `"react-native-view-shot"` to `expo.install.exclude` on Expo SDK 54. Do not retry with `--force` or `--legacy-peer-deps`; that leaves 4.0.3 installed. Raise React Native to 0.76 or later when that is the conflict. |
|
|
16
|
+
| Yarn 1 or `npm install --legacy-peer-deps` succeeded, but `react-native-webview` or `react-native-view-shot` is not installed | Those installs do not fetch peers. WebView and view-shot are required peers, not dependencies. | Install `react-native-webview` and `react-native-view-shot@^5.0.0` in the app, then rebuild native. |
|
|
17
|
+
| Banners, flow cards, or Builder bars draw under the status bar, notch, or home indicator. Development logs `[Userflow] react-native-safe-area-context is not installed, so banners, flow cards, and Builder bars draw under the status bar and home indicator. Install it (npx expo install react-native-safe-area-context) and wrap the app in <SafeAreaProvider>.` | `react-native-safe-area-context` is not installed, so insets are zero. | Install the package and wrap the tree in `<SafeAreaProvider>`. |
|
|
18
|
+
| `Uncaught Error` / `NativeModule.RNCNetInfo is null` as soon as `Userflow.init` runs | On SDK 0.3.1 and earlier, NetInfo's JavaScript was loaded while its native module was not in the binary. Debug builds show a red screen. Dismissing it leaves the app running; a release build can crash. | Link `@react-native-community/netinfo` and rebuild, or remove it. Current versions skip NetInfo when `RNCNetInfo` is not registered and log one dev warning instead. |
|
|
19
|
+
| `[@userflow-tech/react-native] schemeId "…" looks like an environment id. Pass the scheme_id value that starts with userflow- (an opaque id from the dashboard), not the environment UUID.` | The config plugin received the environment UUID. | Pass the `scheme_id` (`userflow-…`) from the dashboard. |
|
|
20
|
+
| `No schemeId was passed, so the plugin left the native config unchanged. Builder preview and pairing links will not open this app. Pass the environment scheme_id (userflow-...) from the Userflow dashboard as the plugin schemeId.` | `expo prebuild` ran the plugin without `schemeId`. | Add `{ "schemeId": "userflow-…" }` and rebuild native. |
|
|
21
|
+
| react-native-view-shot is not a direct dependency. Builder element selection needs >=5.0.0. On Expo SDK 54, an unpinned `npx expo install react-native-view-shot` resolves 4.0.3. Pin ^5.0.0. If expo doctor reports a version mismatch, add "react-native-view-shot" to expo.install.exclude. | Prebuild did not find view-shot in the app `package.json`. | `npx expo install react-native-view-shot@^5.0.0` and rebuild. |
|
|
22
|
+
| `react-native-safe-area-context is not listed in the app package.json. Expo SDK 53 does not autolink native modules that the app only receives indirectly. Without the native module, banners, flow cards, and Builder bars draw under the status bar and home indicator. Install it in the app (npx expo install react-native-safe-area-context) and wrap the app in <SafeAreaProvider>.` | Expo SDK older than 54, and safe-area-context is not a direct dependency, so its native module is not autolinked. | `npx expo install react-native-safe-area-context` and wrap the tree in `<SafeAreaProvider>`. |
|
|
23
|
+
| `[Userflow] react-native-view-shot@4.0.3 is older than 5.0.0, so Builder element selection may not get a screenshot.` The installed version is filled in. The warning also says not to retry with `--force` or `--legacy-peer-deps`. | view-shot 4.x is installed, usually because an `ERESOLVE` was retried with `--force` or `--legacy-peer-deps`, or Expo SDK 54's default 4.0.3 was left in place. | Install `react-native-view-shot@^5.0.0` in the same command as the SDK and rebuild. On Expo SDK 54, add `"react-native-view-shot"` to `expo.install.exclude`. |
|
|
24
|
+
| `react-native-view-shot@4.0.3 is older than 5.0.0. Expo SDK 54's default is 4.0.3, which does not work with this SDK. Pin ^5.0.0 and add "react-native-view-shot" to expo.install.exclude if expo doctor complains.` | The app has view-shot 4.x. | Pin `^5.0.0` and rebuild. |
|
|
25
|
+
| `@react-native-async-storage/async-storage is not listed in the app package.json. Expo SDK 53 does not autolink native modules that the app only receives indirectly. Install it in the app (npx expo install @react-native-async-storage/async-storage) and rebuild.` | Expo SDK older than 54, and AsyncStorage is only a transitive dependency. The WebView line is the same shape with `react-native-webview`. | Install that package in the app and rebuild. |
|
|
26
|
+
| `[Userflow] Native setup is incomplete. Flows may not run until you fix the following, then rebuild the app (a Metro reload is not enough):` | Dev-only check on the first `Userflow.init`. Following lines name each missing native module. A missing safe-area package is a separate warning, because flows still run. | Install the named packages and rebuild. The footer is `See node_modules/@userflow-tech/react-native/docs/troubleshooting.md.` |
|
|
27
|
+
| `- @react-native-async-storage/async-storage is not linked. Anonymous users and Builder pairing will not persist. Add it to the app package.json (npx expo install @react-native-async-storage/async-storage), run pod install on iOS, and rebuild.` | AsyncStorage's native module is not in this binary. | Add it to the app `package.json`, run `pod install` on iOS, and rebuild. |
|
|
28
|
+
| `- react-native-view-shot is not linked, so Builder element selection gets no screenshot. Install react-native-view-shot@^5.0.0 and rebuild. On Expo SDK 54, pin ^5.0.0; an unpinned npx expo install resolves 4.0.3.` | `RNViewShot` is not registered. | Install `react-native-view-shot@^5.0.0` and rebuild. |
|
|
29
|
+
| `- react-native-webview is not linked. Evaluate JavaScript and WebView banners will not run. Install it (npx expo install react-native-webview) and rebuild.` | The WebView native module is not registered. | Install `react-native-webview` and rebuild. |
|
|
30
|
+
| `- react-native-device-info is not linked, so app_version and app_build are not sent. npm install react-native-device-info, then rebuild.` | Bare React Native, and `RNDeviceInfo` is not registered. Expo apps that have `expo-constants` do not log this line. | `npm install react-native-device-info` and rebuild. |
|
|
31
|
+
| `[Userflow] This app is running in Expo Go, which cannot load the SDK native modules. Builder preview links will not open the app. Use a development build (npx expo run:ios / npx expo run:android).` | The app is the Expo Go store client. | Use a development build. |
|
|
32
|
+
| `[Userflow] UserflowProvider is not inside a <SafeAreaProvider>, so flow cards use the device's initial safe-area insets. Wrap your app in <SafeAreaProvider> from react-native-safe-area-context.` | `UserflowProvider` has no `SafeAreaProvider` ancestor. The app does not crash. Cards use `initialWindowMetrics`, or zero insets when those are unavailable. | Wrap the tree in `SafeAreaProvider`. |
|
|
33
|
+
| `Userflow.identifyAnonymous() needs @react-native-async-storage/async-storage, which is not linked in this native build. Add it to your app's package.json, run pod install, and rebuild.` | `identifyAnonymous()` ran without a linked AsyncStorage native module. | Install and rebuild, then call it again. |
|
|
34
|
+
| `clientToken is an environment secret key (esk_...). That key must never ship in the app. Pass the client token (ct_...) from Settings → Environments instead.` | `init` was given an `esk_` secret key. | Pass the `ct_…` client token. |
|
|
35
|
+
| `For EU-hosted environments pass serverEndpoint: 'https://e.eu.userflow.com'.` | The default US host rejected the token with `invalid_client_token`. This sentence is appended to that error. It is omitted when `serverEndpoint` was set explicitly. | For an EU environment, pass `serverEndpoint: 'https://e.eu.userflow.com'`. Pairing stays on `https://e.userflow.com`. |
|
|
36
|
+
| `[Userflow] Userflow.init() already ran with different options. The new clientToken, serverEndpoint, and pairingEndpoint are ignored because init runs once per process. Userflow.reset() does not apply new credentials. Restart the app to change them.` | A later `init` passed a different token or endpoint while a previous `init` is in flight or has succeeded. | Restart the app after a successful init. `reset()` clears the user and does not apply new credentials. If the previous `init` rejected, call `init` again with the corrected token or endpoint. |
|
|
31
37
|
|
|
32
38
|
## Init / identify / group
|
|
33
39
|
|
|
@@ -9,8 +9,11 @@ export interface HostDependencyWarning {
|
|
|
9
9
|
*
|
|
10
10
|
* `react-native-view-shot` must be at least 5. Expo SDK 54's unpinned install
|
|
11
11
|
* resolves 4.0.3. Expo SDK 53 and older only autolink native modules listed in
|
|
12
|
-
* the app's own package.json, so AsyncStorage
|
|
13
|
-
* dependencies there.
|
|
12
|
+
* the app's own package.json, so AsyncStorage, WebView, and safe-area-context
|
|
13
|
+
* have to be direct dependencies there. Expo SDK 54 and later autolink
|
|
14
|
+
* safe-area-context when Expo Router or React Navigation brought it in, so
|
|
15
|
+
* prebuild does not warn about it on those SDKs. `Userflow.init` warns when
|
|
16
|
+
* the package itself cannot be loaded.
|
|
14
17
|
*/
|
|
15
18
|
export declare function hostDependencyWarnings(projectRoot: string | undefined, sdkVersion: string | null | undefined): HostDependencyWarning[];
|
|
16
19
|
/** Called from inside the iOS and Android config-plugin steps, so it runs at prebuild. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hostDependencyWarnings.d.ts","sourceRoot":"","sources":["../plugin/hostDependencyWarnings.ts"],"names":[],"mappings":"AAKA,kFAAkF;AAClF,eAAO,MAAM,sBAAsB,wOACoM,CAAC;AAExO,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;
|
|
1
|
+
{"version":3,"file":"hostDependencyWarnings.d.ts","sourceRoot":"","sources":["../plugin/hostDependencyWarnings.ts"],"names":[],"mappings":"AAKA,kFAAkF;AAClF,eAAO,MAAM,sBAAsB,wOACoM,CAAC;AAExO,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAcD;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACpC,qBAAqB,EAAE,CA+CzB;AAED,0FAA0F;AAC1F,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,KAAK,GAAG,SAAS,EAC3B,QAAQ,EAAE,MAAM,GAAG,IAAI,GACtB,IAAI,CAaN"}
|
|
@@ -9,6 +9,7 @@ const config_plugins_1 = require("@expo/config-plugins");
|
|
|
9
9
|
/** Printed from the iOS and Android prebuild steps when `schemeId` is omitted. */
|
|
10
10
|
exports.MISSING_SCHEME_WARNING = 'No schemeId was passed, so the plugin left the native config unchanged. Builder preview and pairing links will not open this app. Pass the environment scheme_id (userflow-...) from the Userflow dashboard as the plugin schemeId.';
|
|
11
11
|
const VIEW_SHOT = 'react-native-view-shot';
|
|
12
|
+
const SAFE_AREA = 'react-native-safe-area-context';
|
|
12
13
|
const TRANSITIVE_NATIVE_MODULES = [
|
|
13
14
|
'@react-native-async-storage/async-storage',
|
|
14
15
|
'react-native-webview',
|
|
@@ -18,8 +19,11 @@ const TRANSITIVE_NATIVE_MODULES = [
|
|
|
18
19
|
*
|
|
19
20
|
* `react-native-view-shot` must be at least 5. Expo SDK 54's unpinned install
|
|
20
21
|
* resolves 4.0.3. Expo SDK 53 and older only autolink native modules listed in
|
|
21
|
-
* the app's own package.json, so AsyncStorage
|
|
22
|
-
* dependencies there.
|
|
22
|
+
* the app's own package.json, so AsyncStorage, WebView, and safe-area-context
|
|
23
|
+
* have to be direct dependencies there. Expo SDK 54 and later autolink
|
|
24
|
+
* safe-area-context when Expo Router or React Navigation brought it in, so
|
|
25
|
+
* prebuild does not warn about it on those SDKs. `Userflow.init` warns when
|
|
26
|
+
* the package itself cannot be loaded.
|
|
23
27
|
*/
|
|
24
28
|
function hostDependencyWarnings(projectRoot, sdkVersion) {
|
|
25
29
|
if (!projectRoot) {
|
|
@@ -48,6 +52,12 @@ function hostDependencyWarnings(projectRoot, sdkVersion) {
|
|
|
48
52
|
}
|
|
49
53
|
const sdkMajor = leadingMajor(sdkVersion ?? '');
|
|
50
54
|
if (sdkMajor != null && sdkMajor < 54) {
|
|
55
|
+
if (!dependencies[SAFE_AREA]) {
|
|
56
|
+
warnings.push({
|
|
57
|
+
property: SAFE_AREA,
|
|
58
|
+
message: `react-native-safe-area-context is not listed in the app package.json. Expo SDK ${sdkMajor} does not autolink native modules that the app only receives indirectly. Without the native module, banners, flow cards, and Builder bars draw under the status bar and home indicator. Install it in the app (npx expo install react-native-safe-area-context) and wrap the app in <SafeAreaProvider>.`,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
51
61
|
for (const name of TRANSITIVE_NATIVE_MODULES) {
|
|
52
62
|
if (!dependencies[name]) {
|
|
53
63
|
warnings.push({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hostDependencyWarnings.js","sourceRoot":"","sources":["../plugin/hostDependencyWarnings.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"hostDependencyWarnings.js","sourceRoot":"","sources":["../plugin/hostDependencyWarnings.ts"],"names":[],"mappings":"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"}
|
|
@@ -6,7 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.capturePickerScreenshot = capturePickerScreenshot;
|
|
7
7
|
exports.resetViewShotWarningForTests = resetViewShotWarningForTests;
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
+
var _nativeModules = require("../nativeModules.js");
|
|
9
10
|
const MAX_CAPTURE_WIDTH = 480;
|
|
11
|
+
const VIEW_SHOT_MODULE = 'RNViewShot';
|
|
10
12
|
const MISSING_VIEW_SHOT_WARNING = '[Userflow] Required peer react-native-view-shot is not installed; ' + 'skipping picker screenshot. Install react-native-view-shot (>=5.0.0) and rebuild native.';
|
|
11
13
|
let didWarnMissingViewShot = false;
|
|
12
14
|
function warnMissingViewShot() {
|
|
@@ -18,8 +20,14 @@ function warnMissingViewShot() {
|
|
|
18
20
|
}
|
|
19
21
|
}
|
|
20
22
|
function loadViewShot() {
|
|
23
|
+
// view-shot 4 calls TurboModuleRegistry.getEnforcing at import. Metro reports
|
|
24
|
+
// that throw as fatal before this try/catch can see it.
|
|
25
|
+
if (!(0, _nativeModules.isNativeModuleLinked)(VIEW_SHOT_MODULE)) {
|
|
26
|
+
warnMissingViewShot();
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
21
29
|
try {
|
|
22
|
-
// Required peer; degrade if
|
|
30
|
+
// Required peer; degrade if the JS package is missing.
|
|
23
31
|
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports
|
|
24
32
|
return require('react-native-view-shot');
|
|
25
33
|
} catch {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","MAX_CAPTURE_WIDTH","MISSING_VIEW_SHOT_WARNING","didWarnMissingViewShot","warnMissingViewShot","__DEV__","console","warn","loadViewShot","capturePickerScreenshot","rect","viewShot","captureScreen","window","Dimensions","get","winW","width","winH","height","captureWidth","Math","min","round","captureHeight","max","dataUrl","format","quality","result","length","sx","sy","targetX1","x","targetY1","y","targetX2","targetY2","resetViewShotWarningForTests"],"sourceRoot":"../../../src","sources":["authoring/capturePickerScreenshot.ts"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAKA,
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_nativeModules","MAX_CAPTURE_WIDTH","VIEW_SHOT_MODULE","MISSING_VIEW_SHOT_WARNING","didWarnMissingViewShot","warnMissingViewShot","__DEV__","console","warn","loadViewShot","isNativeModuleLinked","capturePickerScreenshot","rect","viewShot","captureScreen","window","Dimensions","get","winW","width","winH","height","captureWidth","Math","min","round","captureHeight","max","dataUrl","format","quality","result","length","sx","sy","targetX1","x","targetY1","y","targetX2","targetY2","resetViewShotWarningForTests"],"sourceRoot":"../../../src","sources":["authoring/capturePickerScreenshot.ts"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AAKA,MAAME,iBAAiB,GAAG,GAAG;AAC7B,MAAMC,gBAAgB,GAAG,YAAY;AAErC,MAAMC,yBAAyB,GAC7B,oEAAoE,GACpE,0FAA0F;AAY5F,IAAIC,sBAAsB,GAAG,KAAK;AAElC,SAASC,mBAAmBA,CAAA,EAAS;EACnC,IAAID,sBAAsB,EAAE;EAC5BA,sBAAsB,GAAG,IAAI;EAC7B,IAAIE,OAAO,EAAE;IACX;IACAC,OAAO,CAACC,IAAI,CAACL,yBAAyB,CAAC;EACzC;AACF;AAEA,SAASM,YAAYA,CAAA,EAA0B;EAC7C;EACA;EACA,IAAI,CAAC,IAAAC,mCAAoB,EAACR,gBAAgB,CAAC,EAAE;IAC3CG,mBAAmB,CAAC,CAAC;IACrB,OAAO,IAAI;EACb;EACA,IAAI;IACF;IACA;IACA,OAAON,OAAO,CAAC,wBAAwB,CAAC;EAC1C,CAAC,CAAC,MAAM;IACNM,mBAAmB,CAAC,CAAC;IACrB,OAAO,IAAI;EACb;AACF;;AAEA;AACA;AACA;AACA;AACA;AACO,eAAeM,uBAAuBA,CAC3CC,IAAa,EAC4B;EACzC,MAAMC,QAAQ,GAAGJ,YAAY,CAAC,CAAC;EAC/B,IAAI,CAACI,QAAQ,EAAEC,aAAa,EAAE,OAAO,IAAI;EAEzC,IAAI;IACF,MAAMC,MAAM,GAAGC,uBAAU,CAACC,GAAG,CAAC,QAAQ,CAAC;IACvC,MAAMC,IAAI,GAAGH,MAAM,CAACI,KAAK,IAAI,CAAC;IAC9B,MAAMC,IAAI,GAAGL,MAAM,CAACM,MAAM,IAAI,CAAC;IAC/B,MAAMC,YAAY,GAAGC,IAAI,CAACC,GAAG,CAACD,IAAI,CAACE,KAAK,CAACP,IAAI,CAAC,EAAEjB,iBAAiB,CAAC;IAClE,MAAMyB,aAAa,GAAGH,IAAI,CAACI,GAAG,CAAC,CAAC,EAAEJ,IAAI,CAACE,KAAK,CAACL,IAAI,IAAIE,YAAY,GAAGJ,IAAI,CAAC,CAAC,CAAC;IAE3E,MAAMU,OAAO,GAAG,MAAMf,QAAQ,CAACC,aAAa,CAAC;MAC3Ce,MAAM,EAAE,KAAK;MACbC,OAAO,EAAE,IAAI;MACbC,MAAM,EAAE,UAAU;MAClBZ,KAAK,EAAEG,YAAY;MACnBD,MAAM,EAAEK;IACV,CAAC,CAAC;IACF,IAAI,OAAOE,OAAO,KAAK,QAAQ,IAAIA,OAAO,CAACI,MAAM,KAAK,CAAC,EAAE,OAAO,IAAI;IAEpE,MAAMC,EAAE,GAAGX,YAAY,GAAGJ,IAAI;IAC9B,MAAMgB,EAAE,GAAGR,aAAa,GAAGN,IAAI;IAC/B,OAAO;MACLQ,OAAO;MACPT,KAAK,EAAEG,YAAY;MACnBD,MAAM,EAAEK,aAAa;MACrBS,QAAQ,EAAEZ,IAAI,CAACE,KAAK,CAACb,IAAI,CAACwB,CAAC,GAAGH,EAAE,CAAC;MACjCI,QAAQ,EAAEd,IAAI,CAACE,KAAK,CAACb,IAAI,CAAC0B,CAAC,GAAGJ,EAAE,CAAC;MACjCK,QAAQ,EAAEhB,IAAI,CAACE,KAAK,CAAC,CAACb,IAAI,CAACwB,CAAC,GAAGxB,IAAI,CAACO,KAAK,IAAIc,EAAE,CAAC;MAChDO,QAAQ,EAAEjB,IAAI,CAACE,KAAK,CAAC,CAACb,IAAI,CAAC0B,CAAC,GAAG1B,IAAI,CAACS,MAAM,IAAIa,EAAE;IAClD,CAAC;EACH,CAAC,CAAC,MAAM;IACN,OAAO,IAAI;EACb;AACF;;AAEA;AACO,SAASO,4BAA4BA,CAAA,EAAS;EACnDrC,sBAAsB,GAAG,KAAK;AAChC","ignoreList":[]}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getEvalJsWebView = getEvalJsWebView;
|
|
7
7
|
exports.isEvalJsWebViewNativeLinked = isEvalJsWebViewNativeLinked;
|
|
8
8
|
exports.resetEvalJsWebViewCacheForTests = resetEvalJsWebViewCacheForTests;
|
|
9
|
-
var
|
|
9
|
+
var _nativeModules = require("../nativeModules.js");
|
|
10
10
|
/**
|
|
11
11
|
* Minimal surface of `react-native-webview` this spike uses.
|
|
12
12
|
* Defined locally so the package root never statically imports the optional peer.
|
|
@@ -18,20 +18,11 @@ let warnedMissing = false;
|
|
|
18
18
|
/**
|
|
19
19
|
* True when the native `react-native-webview` binary is linked. Do not
|
|
20
20
|
* `require('react-native-webview')` before this passes — the JS entry calls
|
|
21
|
-
* `TurboModuleRegistry.getEnforcing('RNCWebViewModule')` and
|
|
21
|
+
* `TurboModuleRegistry.getEnforcing('RNCWebViewModule')` and Metro reports that
|
|
22
|
+
* throw as fatal before try/catch.
|
|
22
23
|
*/
|
|
23
24
|
function isEvalJsWebViewNativeLinked() {
|
|
24
|
-
|
|
25
|
-
if (typeof _reactNative.TurboModuleRegistry?.get === 'function') {
|
|
26
|
-
if (_reactNative.TurboModuleRegistry.get('RNCWebViewModule') != null) {
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
const legacy = _reactNative.NativeModules.RNCWebViewModule;
|
|
31
|
-
return legacy != null;
|
|
32
|
-
} catch {
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
25
|
+
return (0, _nativeModules.isNativeModuleLinked)('RNCWebViewModule');
|
|
35
26
|
}
|
|
36
27
|
|
|
37
28
|
/**
|
|
@@ -66,6 +57,7 @@ function getEvalJsWebView() {
|
|
|
66
57
|
function warnMissing(reason) {
|
|
67
58
|
if (warnedMissing) return;
|
|
68
59
|
warnedMissing = true;
|
|
60
|
+
if (!__DEV__) return;
|
|
69
61
|
if (reason === 'native') {
|
|
70
62
|
console.warn('Userflow: react-native-webview is listed in package.json but RNCWebViewModule is not in ' + 'this native build. Run npx expo install react-native-webview (or npm install), then ' + 'rebuild the dev client (expo prebuild + run:ios / run:android — not Expo Go). ' + 'Evaluate JavaScript and WebView banners will not run until then.');
|
|
71
63
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_nativeModules","require","cached","warnedMissing","isEvalJsWebViewNativeLinked","isNativeModuleLinked","getEvalJsWebView","undefined","warnMissing","mod","component","WebView","default","reason","__DEV__","console","warn","resetEvalJsWebViewCacheForTests"],"sourceRoot":"../../../src","sources":["evalJs/getWebView.ts"],"mappings":";;;;;;;;AAEA,IAAAA,cAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;;AAmCA,IAAIC,MAAiD;AACrD,IAAIC,aAAa,GAAG,KAAK;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,2BAA2BA,CAAA,EAAY;EACrD,OAAO,IAAAC,mCAAoB,EAAC,kBAAkB,CAAC;AACjD;;AAEA;AACA;AACA;AACA;AACO,SAASC,gBAAgBA,CAAA,EAAkC;EAChE,IAAIJ,MAAM,KAAKK,SAAS,EAAE,OAAOL,MAAM;EAEvC,IAAI,OAAOD,OAAO,KAAK,UAAU,EAAE;IACjCC,MAAM,GAAG,IAAI;IACbM,WAAW,CAAC,aAAa,CAAC;IAC1B,OAAON,MAAM;EACf;EAEA,IAAI,CAACE,2BAA2B,CAAC,CAAC,EAAE;IAClCF,MAAM,GAAG,IAAI;IACbM,WAAW,CAAC,QAAQ,CAAC;IACrB,OAAON,MAAM;EACf;EAEA,IAAI;IACF;IACA,MAAMO,GAAG,GAAGR,OAAO,CAAC,sBAAsB,CAGzC;IACD,MAAMS,SAAS,GAAGD,GAAG,EAAEE,OAAO,IAAIF,GAAG,EAAEG,OAAO;IAC9CV,MAAM,GAAGQ,SAAS,IAAI,IAAI,GAAGA,SAAS,GAAG,IAAI;EAC/C,CAAC,CAAC,MAAM;IACNR,MAAM,GAAG,IAAI;EACf;EAEA,IAAIA,MAAM,IAAI,IAAI,EAAE;IAClBM,WAAW,CAAC,IAAI,CAAC;EACnB;EACA,OAAON,MAAM;AACf;AAEA,SAASM,WAAWA,CAACK,MAAuC,EAAQ;EAClE,IAAIV,aAAa,EAAE;EACnBA,aAAa,GAAG,IAAI;EACpB,IAAI,CAACW,OAAO,EAAE;EACd,IAAID,MAAM,KAAK,QAAQ,EAAE;IACvBE,OAAO,CAACC,IAAI,CACV,0FAA0F,GACxF,sFAAsF,GACtF,gFAAgF,GAChF,kEACJ,CAAC;IACD;EACF;EACAD,OAAO,CAACC,IAAI,CACV,sFAAsF,GACpF,oFAAoF,GACpF,yBACJ,CAAC;AACH;;AAEA;AACO,SAASC,+BAA+BA,CAAA,EAAS;EACtDf,MAAM,GAAGK,SAAS;EAClBJ,aAAa,GAAG,KAAK;AACvB","ignoreList":[]}
|
|
@@ -17,11 +17,12 @@ exports.resetCachedHostAppVersionForTests = resetCachedHostAppVersionForTests;
|
|
|
17
17
|
exports.resolveHostAppVersion = resolveHostAppVersion;
|
|
18
18
|
exports.resolveHostAppVersionForInit = resolveHostAppVersionForInit;
|
|
19
19
|
exports.resolveHostAppVersionFromSources = resolveHostAppVersionFromSources;
|
|
20
|
+
var _nativeModules = require("./nativeModules.js");
|
|
20
21
|
/**
|
|
21
22
|
* Read the host app's native marketing version (store version), not the
|
|
22
23
|
* SDK package version. React Native does not expose the store version on
|
|
23
24
|
* `Platform`; Expo hosts may use optional expo modules; bare RN reads
|
|
24
|
-
* `NativeModules.RNDeviceInfo` constants from the
|
|
25
|
+
* `NativeModules.RNDeviceInfo` constants from the device-info native
|
|
25
26
|
* module (after autolink + rebuild). The OS name is `Platform.OS`.
|
|
26
27
|
*
|
|
27
28
|
* Do not `require('react-native-device-info')` — that package throws at import
|
|
@@ -45,6 +46,10 @@ function unwrapModule(mod) {
|
|
|
45
46
|
return record;
|
|
46
47
|
}
|
|
47
48
|
function tryRequireExpoApplication() {
|
|
49
|
+
// expo-application calls requireNativeModule('ExpoApplication') at import.
|
|
50
|
+
// Skip the require when that module is not registered so a missing binary
|
|
51
|
+
// cannot surface as a fatal error.
|
|
52
|
+
if (!(0, _nativeModules.isNativeModuleLinked)('ExpoApplication')) return undefined;
|
|
48
53
|
try {
|
|
49
54
|
// Optional on bare RN — Metro requires a string literal.
|
|
50
55
|
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
|