deps: upgrade react-native-view-shot to v5.1.0

This commit is contained in:
Evan Kaloudis
2026-05-13 10:58:29 -04:00
parent db79af49b7
commit fcec9f322f
6 changed files with 20 additions and 84 deletions
+13 -2
View File
@@ -235,9 +235,20 @@ export default class CollapsedQR extends React.Component<
return (
<React.Fragment>
{/* Temporary QR for sharing */}
{/* Temporary QR for sharing — positioned off-screen so Fabric
doesn't render the 800px source QR over the visible UI when
a zero-sized parent fails to clip its oversized child. */}
{tempQRRef && (
<View style={{ height: 0, width: 0, overflow: 'hidden' }}>
<View
style={{
position: 'absolute',
left: -10000,
top: -10000,
width: 800,
height: 800
}}
pointerEvents="none"
>
<ForwardedQRCode
ref={tempQRRef}
value={value}
+2 -2
View File
@@ -1639,7 +1639,7 @@ PODS:
- react-native-vector-icons-fontawesome (12.4.0)
- react-native-vector-icons-material-design-icons (12.4.0)
- react-native-vector-icons-material-icons (12.4.0)
- react-native-view-shot (4.0.3):
- react-native-view-shot (5.1.0):
- hermes-engine
- RCTRequired
- RCTTypeSafety
@@ -2902,7 +2902,7 @@ SPEC CHECKSUMS:
react-native-vector-icons-fontawesome: 9b1827fc73ef619ce268bd6f0871f5a82233121f
react-native-vector-icons-material-design-icons: 76cd460b3540b80527b4a80fb7f867f7deedb498
react-native-vector-icons-material-icons: d67e485a05560416ff6b5977d5fa7e0eb6af6870
react-native-view-shot: 5fe893f10cadc5949a3b9b44d75df16633fa8ef4
react-native-view-shot: 5bf17256c542d46c02a6f2d2752fe88eb3a8d058
React-NativeModulesApple: deba264b03bd79c6bd61014fa30e40321b5e443a
React-networking: 35e6070b084f435429f85c5db40b4d5b38652fe9
React-oscompat: 64a0c7ef5441855dc6e2a6afe8ba8f92aa05075e
+1 -1
View File
@@ -144,7 +144,7 @@
"react-native-system-navigation-bar": "2.8.0",
"react-native-tor": "https://github.com/ZeusLN/react-native-tor.git#v0.2.1-zeus",
"react-native-udp": "4.1.7",
"react-native-view-shot": "4.0.3",
"react-native-view-shot": "5.1.0",
"react-native-vision-camera": "4.7.3",
"react-native-worklets": "0.8.3",
"readable-stream": "1.0.33",
-2
View File
@@ -5,7 +5,6 @@ import { patchJcenter } from './patch-jcenter.mjs';
import { patchNativeEventEmitter } from './patch-native-event-emitter.mjs';
import { patchReactNativeNotifications } from './patch-react-native-notifications.mjs';
import { patchNobleHashes } from './patch-noble-hashes.mjs';
import { patchViewShot } from './patch-view-shot.mjs';
console.log('Running postinstall patches...\n');
@@ -14,7 +13,6 @@ console.log('Running postinstall patches...\n');
patchNativeEventEmitter();
patchReactNativeNotifications();
patchNobleHashes();
patchViewShot();
console.log('\nAll patches applied successfully.');
})();
-73
View File
@@ -1,73 +0,0 @@
// Patch react-native-view-shot for RN 0.84 Fabric compatibility.
// RCTScrollView was removed in RN 0.84; use RCTScrollViewComponentView on
// Fabric builds instead.
// Based on https://github.com/gre/react-native-view-shot/pull/584
// Can be removed once react-native-view-shot ships a release with this fix.
import fs from 'fs';
export function patchViewShot() {
console.log('Patching react-native-view-shot (RN 0.84 Fabric compat)');
const filePath =
'./node_modules/react-native-view-shot/ios/RNViewShot.mm';
if (!fs.existsSync(filePath)) {
console.log(' - Skipping: RNViewShot.mm not found');
return;
}
let content = fs.readFileSync(filePath, 'utf8');
// 1. Add the Fabric/legacy scroll view typedef after the existing #ifdef block
const importAnchor = `#ifdef RCT_NEW_ARCH_ENABLED
#import <rnviewshot/rnviewshot.h>
#endif`;
const importReplacement = `#ifdef RCT_NEW_ARCH_ENABLED
#import <rnviewshot/rnviewshot.h>
#endif
#if __has_include(<React/RCTScrollViewComponentView.h>)
// Fabric available
#import <React/RCTScrollViewComponentView.h>
typedef RCTScrollViewComponentView RNSnapshotScrollViewHost;
#else
// Fallback to legacy
#import <React/RCTScrollView.h>
typedef RCTScrollView RNSnapshotScrollViewHost;
#endif`;
if (!content.includes('RNSnapshotScrollViewHost')) {
content = content.replace(importAnchor, importReplacement);
}
// 2. Remove the now-unnecessary standalone RCTScrollView import
content = content.replace('#import <React/RCTScrollView.h>\n', '');
// 3. Replace RCTScrollView usage in snapshotContentContainer logic
content = content.replace(
`if (![view isKindOfClass:[RCTScrollView class]]) {
reject(RCTErrorUnspecified, [NSString stringWithFormat:@"snapshotContentContainer can only be used on a RCTScrollView. instead got: %@", view], nil);
return;
}
RCTScrollView* rctScrollView = view;
scrollView = rctScrollView.scrollView;`,
`if (![view isKindOfClass:[RNSnapshotScrollViewHost class]]) {
reject(RCTErrorUnspecified,
[NSString stringWithFormat:@"snapshotContentContainer can only be used on a ScrollView host. instead got: %@", view],
nil);
return;
}
RNSnapshotScrollViewHost *host = (RNSnapshotScrollViewHost *)view;
UIScrollView *scrollView = host.scrollView;`
);
fs.writeFileSync(filePath, content);
console.log(' - Patched RNViewShot.mm');
}
+4 -4
View File
@@ -9609,10 +9609,10 @@ react-native-url-polyfill@2.0.0:
dependencies:
whatwg-url-without-unicode "8.0.0-3"
react-native-view-shot@4.0.3:
version "4.0.3"
resolved "https://registry.yarnpkg.com/react-native-view-shot/-/react-native-view-shot-4.0.3.tgz#9b98388fcc5228073cb66ac98ca339eda35767ac"
integrity sha512-USNjYmED7C0me02c1DxKA0074Hw+y/nxo+xJKlffMvfUWWzL5ELh/TJA/pTnVqFurIrzthZDPtDM7aBFJuhrHQ==
react-native-view-shot@5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/react-native-view-shot/-/react-native-view-shot-5.1.0.tgz#60c0728d70c941658e40cc965d9d304a8fdd8eb4"
integrity sha512-JZgElCD82aO+hejIF/leUzI7JufL9mgJ6ChzGWIcdZ2ajpaEvvSnvIcw0qD32XWkrbId8wfSbyz/4u/ulTQzQA==
dependencies:
html2canvas "^1.4.1"