Skip to content

Releases: gre/react-native-view-shot

v5.1.0

03 May 19:38
@gre gre

Choose a tag to compare

Highlights

iOS

  • iOS 17 compatibility: migrated to UIGraphicsImageRenderer (fixes deprecated APIs).
  • New XCTest target with releaseCapture + encoding tests.

Android

  • Fix: snapshotContentContainer now correctly captures off-screen content.
  • Expanded JUnit coverage for static / package helpers.

Windows

  • Working example-windows on RNW 0.76.17 with full demo screen suite (Basic, FS, FullScreen, Image, Modal, Rendering, ScrollView, StyleFilters, Transparency).
  • Native module fixes (RNViewShotModule, ViewShot, Helpers).
  • New native C# unit tests (RNViewShot.Tests).
  • CI: real Windows build + dotnet unit tests on GitHub Actions, app package uploaded as artifact.

Examples / Tests

  • New style-filters repro screen (#578).
  • New snapshotContentContainer ScrollView capture demo.
  • All Detox e2e specs wired into CI via Jest testMatch.

Full Changelog: v5.0.1...v5.1.0

v5.0.1

02 May 10:14
@gre gre

Choose a tag to compare

Patch release fixing an Android crash that hit users capturing GL / SurfaceView / TextureView roots directly.

What changed

  • fix(android) Guard applyTransformations against NullPointerException and ClassCastException when the captured view is itself a non-ViewGroup (e.g. a SurfaceView captured directly with handleGLSurfaceView: true). The original parent walk ran past root and either dereferenced a null parent or tried to cast a ViewRootImpl to View. The walk is now extracted into a walkAncestors helper that short-circuits when child == root, stops on null, and stops on non-View ViewParent. Closes #488. (#631)
  • test(android) First JUnit + Mockito unit tests for the library, wired into the existing build-android CI job via ./gradlew :react-native-view-shot:testDebugUnitTest. Covers the three failure modes plus happy paths. (#631)

Contributors

Full changelog: v5.0.0...v5.0.1

v5.0.0

01 May 17:06
@gre gre

Choose a tag to compare

First stable release of the 5.x line. This is a major version bump covering the New Architecture migration, a project-wide cleanup, and a long list of cross-platform fixes accumulated since v4.0.3. If you're upgrading from 4.x, please read the Breaking changes section below.

Highlights

  • New Architecture (Fabric + TurboModules) supported across iOS, Android, Web, Windows.
  • React Native peer dep bumped to >=0.76.0. Tested up to 0.84.1.
  • JS/TS layer migrated to TypeScript (src/ is now .ts/.tsx).
  • Android capture path hardened: view.draw() and view resolution now run on the UIManager queue with a hard timeout, cancellation, exception propagation, and a CAS-based bitmap pool handoff so canvas-backing bitmaps cannot be recycled mid-draw.
  • iOS updated for RCTScrollView removal in RN 0.84 (runtime UIScrollView detection covering both Paper and Fabric), plus a Privacy Manifest.
  • Web got several fixes around captureRef, JPG output, releaseCapture, and CORS image handling.
  • Example apps rebooted with 11 organized test screens; new Expo example added; new Detox + Playwright E2E coverage; CI now builds downloadable example APK.

Breaking changes

  • Minimum React Native is 0.76.0. Lower versions are no longer supported.
  • The library is now built from TypeScript. The public API is unchanged but generated .d.ts files now ship alongside lib/ (the package.json main still points to lib/index.js, the react-native field points to src/index.tsx).
  • Internal RNViewShot.web.js was renamed to RNViewShot.web.ts. Metro and webpack still resolve *.web.ts automatically.
  • The Android module exposes a TurboModule spec under src/specs/NativeRNViewShot.ts. The runtime detects old vs. new arch via global.__turboModuleProxy so consumers do not need to choose explicitly.

What changed

New Architecture / RN 0.84

  • #580 Stack update: RN 0.81.4 + Fabric + TurboModules, TypeScript migration, example reboot, CI bootstrapped.
  • #587 Upgrade example to React Native 0.84.1 and fix the removal of RCTScrollView on iOS by switching to runtime UIScrollView detection (subview walk + respondsToSelector:) that works under both Paper and Fabric.
  • #621 Restore Android autolinking and runtime on RN 0.84 with the new arch enabled.
  • #620 Fix react-native.config.js so the library is correctly linked on Android.

Android

  • #628 (refactor(android)) UI-thread-safe view capture with hardened bitmap lifecycle:
    • view.draw() now runs on the UIManager queue instead of the capture executor.
    • runOnUiThreadBlocking posts work to the main looper with a hard 5s timeout (UiThreadBlockTimeoutException) so a stuck UI thread cannot hang capture forever.
    • State machine (STATE_QUEUED/RUNNING/DONE) with CAS between caller (timeout) and runnable (entry) so exactly one side owns cleanup.
    • Bitmap recycling split between caller and UI runnable via AtomicReference<Bitmap> + getAndSet(null) so the canvas-backing bitmap cannot be returned to the pool while view.draw() is still drawing into it.
    • handler.post() return value checked, Throwable thrown inside the UI runnable is captured and rethrown on the caller thread (surfaces as promise.reject(...) instead of crashing the UI thread).
    • Layer-marking scaffolding for translucent ViewGroup subtrees (kept inert in practice, see PR for context).
  • #630 (fix(android)) Resolve view on the UIManager queue before posting capture work to the executor (cherry-pick of #556 by @wfern), with a try/catch so currentActivity == null (app backgrounded) or a throw inside resolveView rejects the promise instead of crashing the UIManager queue.

iOS

  • #587 ScrollView capture works on RN 0.84 again: detects UIScrollView via subview walk and respondsToSelector:@selector(scrollView) so both RCTScrollViewComponentView (Fabric) and legacy RCTScrollView (Paper) are covered with no compile-time __has_include branches.
  • #600 Add iOS Privacy Manifest (PrivacyInfo.xcprivacy).

Web

  • #599 Fix captureRef crash on web by skipping findNodeHandle (not supported).
  • #601 Enable useCORS for html2canvas to fix cross-origin image capture.
  • #602 Fix JPG format and base64 preview.
  • #604 Fix releaseCapture crash on web (now a no-op since there are no temp files to clean up) and add a ViewShot component example.

Examples, tests, CI

  • #580 Example app rebooted with 11 organized test cases (Basic, Media, Advanced).
  • #603 Add unit tests for the JS/TS layer.
  • #605 Add a dedicated Expo example app for testing with Expo + the New Architecture.
  • #617 New CI workflow: build a downloadable example APK on every PR.
  • #627 New "RENDERING CORRECTNESS" test card screen for visual regression checks across borderRadius/overflow:hidden, transforms, z-index, scrolled ScrollView, padding+bg+border, nested opacity, and Skia comparator.
  • Detox iOS E2E + Playwright web E2E running on CI.
  • #629 Refresh example apps lockfiles to in-range latest.

Docs

Dependency updates

Numerous dependabot bumps in example/example-web/example-windows/example-expo (lodash, minimatch, fast-xml-parser, node-forge, picomatch, handlebars, brace-expansion, follow-redirects, flatted, terser-webpack-plugin, copy-webpack-plugin, serve, serialize-javascript). The library itself has no new runtime dependencies.

Closed PRs of note (superseded or already-on-master)

These were closed during this release cycle in favor of the consolidated work above:

  • #531 (UiThreadUtil) superseded by the surgical UI-thread moves in #628 + #630.
  • #540 (manual recursion view-cuts-off rewrite) superseded by the view.draw()-preserving approach.
  • #563 (web releaseCapture throwing) addressed on master.
  • #584 (RN 0.84 ScrollView iOS) addressed on master via #587.

Contributors

Thanks to everyone who contributed to this release:

Full changelog: v4.0.3...v5.0.0

v3.8.0

19 Oct 14:15
@gre gre
4fef0d0

Choose a tag to compare

v3.7.0

19 Jun 16:12
@gre gre
013a0d8

Choose a tag to compare

v3.4.0

20 Aug 19:36
@gre gre

Choose a tag to compare

  • Support capture SurfaceView on Android (#427) thanks @jhen0409 and @CAMOBAP
  • fix referenced react-native-cameraroll link error (#436) thanks @rxliuli
  • add fileName typing to Capture options (#423) thanks @steo-ml
  • Update index.d.ts (#419) thanks @dancixx
  • Fixes #291: Android: width/height options are absolute dimensions (#414)
  • Android target API level 30 – fixes #373 (#415)

v3.3.0

28 May 10:05
@gre gre
8d04ba4

Choose a tag to compare

Maintenance release supporting latest version of iOS / Android and react native.

Fixes

Features

  • Android: snapshot in background (#317) thanks @gdoudeng
  • Android: add custom file name props (#318) thanks @LkyYuen
  • Added UI dispatcher usage in the Windows implementation (#376) thanks @qmatteoq
  • iOS: Add option to use renderInContext method to eliminate issue with blank captures for large views (#350) thanks @Crhaj

v3.0.2

10 Aug 04:24
@gre gre
02bb1d8

Choose a tag to compare

  • Fixes <ViewShot> that was recently broken. (props captureMode check)
  • better error checks and errors cases. (e.g. when module is not properly configured or when you pass an deferenced ref)

v3.0.1

10 Aug 04:19
@gre gre
81d78ac

Choose a tag to compare

  • Fix next props call

v3.0.0

10 Aug 04:19
@gre gre
8f57a98

Choose a tag to compare

  • Fixes compile error in metro package
  • fix the bug that deposit the wrong bitmap to buffer