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
// NB: you may need to go the "imperative way" to use snapshotContentContainer with the scrollview ref instead
94
-
function ExampleCaptureOnMountSimpler {
95
-
const ref = useRef();
96
-
103
+
functionExampleCaptureScrollContent() {
97
104
constonCapture=useCallback(uri=> {
98
105
console.log("do something with ", uri);
99
106
}, []);
@@ -114,7 +121,7 @@ function ExampleCaptureOnMountSimpler {
114
121
-**`options`**: the same options as in `captureRef` method.
115
122
-**`captureMode`** (string):
116
123
- if not defined (default). the capture is not automatic and you need to use the ref and call `capture()` yourself.
117
-
-`"mount"`. Capture the view once at mount. (It is important to understand image loading won't be waited, in such case you want to use `"none"` with `viewShotRef.capture()` after `Image#onLoad`.)
124
+
-`"mount"`. Capture the view once at mount. Image loading is not awaited; omit `captureMode` and call `viewShotRef.current.capture()` after `Image#onLoad` when needed.
118
125
-`"continuous"` EXPERIMENTAL, this will capture A LOT of images continuously. For very specific use-cases.
119
126
-`"update"` EXPERIMENTAL, this will capture images each time React redraw (on did update). For very specific use-cases.
120
127
-**`onCapture`**: when a `captureMode` is defined, this callback will be called with the capture result.
@@ -140,7 +147,7 @@ Returns a Promise of the image URI.
140
147
-**`options`** may include:
141
148
-**`fileName`**_(string)_: (Android only) the file name of the file. Must be at least 3 characters long.
142
149
-**`width`** / **`height`**_(number)_: the width and height of the final image (resized from the View bound. don't provide it if you want the original pixel size).
143
-
-**`format`**_(string)_: either `png` or `jpg` or `webm` (Android). Defaults to `png`.
150
+
-**`format`**_(string)_: `png` or `jpg`, plus `webp` and `raw` on Android. Defaults to `png`. `webm` is a deprecated alias for `webp`; it produces WebP image data, not a video.
144
151
-**`quality`**_(number)_: the quality. 0.0 - 1.0 (default). (only available on lossy formats like jpg)
145
152
-**`result`**_(string)_, the method you want to use to save the snapshot, one of:
146
153
-`"tmpfile"` (default): save to a temporary file _(that will only exist for as long as the app is running)_.
@@ -232,11 +239,11 @@ Introduced a new image format RAW. it correspond a ARGB array of pixels.
232
239
233
240
Advantages:
234
241
235
-
-no compression, so its supper quick. Screenshot taking is less than 16ms;
242
+
-avoids PNG/JPEG compression; capture time still depends on the view and device.
236
243
237
244
RAW format supported for `zip-base64`, `base64` and `tmpfile` result types.
238
245
239
-
RAW file on disk saved in format: `${width}:${height}|${base64}` string.
246
+
RAW files contain an ASCII `${width}:${height}|` header followed by binary pixel bytes. The `base64` result instead returns that header followed by base64-encoded pixels; `zip-base64` returns the header followed by base64-encoded, zlib-compressed pixels.
240
247
241
248
### zip-base64
242
249
@@ -246,45 +253,60 @@ approach for capturing screen views and deliver them to the react side.
246
253
247
254
### How to work with zip-base64 and RAW format?
248
255
256
+
Capture in React Native, then send the result and format to a Node.js process for conversion. Node's `fs` and `zlib` modules are not built into React Native.
Copy file name to clipboardExpand all lines: example-web/README.md
+4-6Lines changed: 4 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -96,19 +96,17 @@ See `.github/workflows/ci.yml` - the `test-web-example` job runs all Playwright
96
96
97
97
**CI Artifacts:**
98
98
99
-
-`web-snapshots-reference`: Current reference snapshots (download to update local snapshots)
100
-
-`web-snapshots-diff`: Visual diffs when tests fail (actual vs expected)
99
+
-`web-snapshots-actual`: Actual, expected and diff images from failed comparisons
101
100
-`playwright-report`: Full HTML test report
102
101
-`playwright-test-results`: Detailed test results
103
102
104
103
**When snapshots differ:**
105
104
106
105
- The CI will show a clear message in the GitHub Actions summary
107
-
- Download the `web-snapshots-reference` artifact
108
-
- Replace `example-web/e2e/snapshots/reference/` with the downloaded files
109
-
- Commit the updated snapshots
106
+
- Run `./scripts/update-snapshots-from-ci.sh <RUN_ID>` from `example-web/` to import only the actual images from `web-snapshots-actual`
107
+
- Review every changed reference image and commit only intended visual changes
110
108
111
-
**Note:**Snapshots are platform-specific (Linux vs macOS). The CI runs on Linux, so you may need to update snapshots when running locally on macOS.
109
+
**Note:**Committed reference images are generated on Linux. Local non-Linux runs use separate platform-suffixed images; do not replace the Linux references with macOS or Windows output. See [snapshot guidance](e2e/snapshots/README.md).
0 commit comments