Releases: gre/react-native-view-shot
v5.1.0
Highlights
iOS
- iOS 17 compatibility: migrated to
UIGraphicsImageRenderer(fixes deprecated APIs). - New XCTest target with
releaseCapture+ encoding tests.
Android
- Fix:
snapshotContentContainernow correctly captures off-screen content. - Expanded JUnit coverage for static / package helpers.
Windows
- Working
example-windowson 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-filtersrepro screen (#578). - New
snapshotContentContainerScrollView capture demo. - All Detox e2e specs wired into CI via Jest
testMatch.
Full Changelog: v5.0.1...v5.1.0
v5.0.1
Patch release fixing an Android crash that hit users capturing GL / SurfaceView / TextureView roots directly.
What changed
- fix(android) Guard
applyTransformationsagainstNullPointerExceptionandClassCastExceptionwhen the captured view is itself a non-ViewGroup(e.g. aSurfaceViewcaptured directly withhandleGLSurfaceView: true). The original parent walk ran pastrootand either dereferenced a null parent or tried to cast aViewRootImpltoView. The walk is now extracted into awalkAncestorshelper that short-circuits whenchild == root, stops on null, and stops on non-ViewViewParent. Closes #488. (#631) - test(android) First JUnit + Mockito unit tests for the library, wired into the existing
build-androidCI 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
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 to0.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
RCTScrollViewremoval in RN 0.84 (runtimeUIScrollViewdetection 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.tsfiles now ship alongsidelib/(thepackage.jsonmainstill points tolib/index.js, thereact-nativefield points tosrc/index.tsx). - Internal
RNViewShot.web.jswas renamed toRNViewShot.web.ts. Metro and webpack still resolve*.web.tsautomatically. - The Android module exposes a TurboModule spec under
src/specs/NativeRNViewShot.ts. The runtime detects old vs. new arch viaglobal.__turboModuleProxyso 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
RCTScrollViewon iOS by switching to runtimeUIScrollViewdetection (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.jsso 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.runOnUiThreadBlockingposts 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 whileview.draw()is still drawing into it. handler.post()return value checked,Throwablethrown inside the UI runnable is captured and rethrown on the caller thread (surfaces aspromise.reject(...)instead of crashing the UI thread).- Layer-marking scaffolding for translucent
ViewGroupsubtrees (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 atry/catchsocurrentActivity == null(app backgrounded) or a throw insideresolveViewrejects the promise instead of crashing the UIManager queue.
iOS
- #587 ScrollView capture works on RN 0.84 again: detects
UIScrollViewvia subview walk andrespondsToSelector:@selector(scrollView)so bothRCTScrollViewComponentView(Fabric) and legacyRCTScrollView(Paper) are covered with no compile-time__has_includebranches. - #600 Add iOS Privacy Manifest (
PrivacyInfo.xcprivacy).
Web
- #599 Fix
captureRefcrash on web by skippingfindNodeHandle(not supported). - #601 Enable
useCORSforhtml2canvasto fix cross-origin image capture. - #602 Fix JPG format and base64 preview.
- #604 Fix
releaseCapturecrash on web (now a no-op since there are no temp files to clean up) and add aViewShotcomponent 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
- #536 Update Expo installation instructions (thanks @amandeepmittal).
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
releaseCapturethrowing) 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
v3.7.0
v3.4.0
- 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
Maintenance release supporting latest version of iOS / Android and react native.
Fixes
- Fix android build to support latest React Native – thanks @cristianocca
- Fix ios configuration: enable build in Xcode 12 (for iOS >= 12) (#338) thanks @LeoValentim
- Fixes captureScreen on iOS. (#407) thanks @ashfurrow
- Fix typescript(View): onLayout (#380) thanks @comanzanares
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