From 19b0d8931300c32bf7da0d43be8f2c83d62b10ca Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Fri, 24 Jul 2026 17:40:46 +0300 Subject: [PATCH] Update `react-native-uitextview` (#11264) --- package.json | 2 +- pnpm-lock.yaml | 28 ++++++++++----------- src/alf/typography.tsx | 2 +- src/components/Typography.tsx | 2 +- src/lib/web-shims/codegenNativeComponent.js | 17 ------------- src/view/com/util/text/Text.tsx | 2 +- webpack.config.js | 10 -------- 7 files changed, 18 insertions(+), 45 deletions(-) delete mode 100644 src/lib/web-shims/codegenNativeComponent.js diff --git a/package.json b/package.json index 3c85f00f56..89e5d77537 100644 --- a/package.json +++ b/package.json @@ -108,6 +108,7 @@ "@bsky.app/expo-scroll-edge-effect": "^0.1.9", "@bsky.app/expo-translate-text": "^0.2.9", "@bsky.app/peek-menu": "^0.3.1", + "@bsky.app/react-native-uitextview": "^2.4.1", "@bsky.app/sift": "^0.3.9", "@bsky.app/tapper": "^0.6.1", "@bsky.app/video": "0.3.6", @@ -237,7 +238,6 @@ "react-native-screens": "4.24.0", "react-native-scroll-forwarder": "link:./modules/react-native-scroll-forwarder", "react-native-svg": "15.12.1", - "react-native-uitextview": "^2.2.0", "react-native-uuid": "^2.0.3", "react-native-view-shot": "^4.0.3", "react-native-web": "^0.21.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0319db85dd..5edf239650 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -277,6 +277,9 @@ importers: '@bsky.app/peek-menu': specifier: ^0.3.1 version: 0.3.1(expo@54.0.35(@babel/core@7.29.0)(react-native-webview@13.15.0(react-native@0.81.5(patch_hash=0a4b515f22d157816048e3181dd18fb83b1679a90fca50f715c55483aabdced4)(@babel/core@7.29.0)(@react-native/metro-config@0.86.0(@babel/core@7.29.0))(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(patch_hash=0a4b515f22d157816048e3181dd18fb83b1679a90fca50f715c55483aabdced4)(@babel/core@7.29.0)(@react-native/metro-config@0.86.0(@babel/core@7.29.0))(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(patch_hash=0a4b515f22d157816048e3181dd18fb83b1679a90fca50f715c55483aabdced4)(@babel/core@7.29.0)(@react-native/metro-config@0.86.0(@babel/core@7.29.0))(@types/react@19.1.17)(react@19.1.0))(react@19.1.0) + '@bsky.app/react-native-uitextview': + specifier: ^2.4.1 + version: 2.4.1(react-native@0.81.5(patch_hash=0a4b515f22d157816048e3181dd18fb83b1679a90fca50f715c55483aabdced4)(@babel/core@7.29.0)(@react-native/metro-config@0.86.0(@babel/core@7.29.0))(@types/react@19.1.17)(react@19.1.0))(react@19.1.0) '@bsky.app/sift': specifier: ^0.3.9 version: 0.3.9(expo@54.0.35(@babel/core@7.29.0)(react-native-webview@13.15.0(react-native@0.81.5(patch_hash=0a4b515f22d157816048e3181dd18fb83b1679a90fca50f715c55483aabdced4)(@babel/core@7.29.0)(@react-native/metro-config@0.86.0(@babel/core@7.29.0))(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(patch_hash=0a4b515f22d157816048e3181dd18fb83b1679a90fca50f715c55483aabdced4)(@babel/core@7.29.0)(@react-native/metro-config@0.86.0(@babel/core@7.29.0))(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native-safe-area-context@5.6.2(react-native@0.81.5(patch_hash=0a4b515f22d157816048e3181dd18fb83b1679a90fca50f715c55483aabdced4)(@babel/core@7.29.0)(@react-native/metro-config@0.86.0(@babel/core@7.29.0))(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(patch_hash=0a4b515f22d157816048e3181dd18fb83b1679a90fca50f715c55483aabdced4)(@babel/core@7.29.0)(@react-native/metro-config@0.86.0(@babel/core@7.29.0))(@types/react@19.1.17)(react@19.1.0))(react@19.1.0) @@ -664,9 +667,6 @@ importers: react-native-svg: specifier: 15.12.1 version: 15.12.1(patch_hash=ae309e9542214f5ae54935e253dedd236765feedac7be343f81d532d7fe09310)(react-native@0.81.5(patch_hash=0a4b515f22d157816048e3181dd18fb83b1679a90fca50f715c55483aabdced4)(@babel/core@7.29.0)(@react-native/metro-config@0.86.0(@babel/core@7.29.0))(@types/react@19.1.17)(react@19.1.0))(react@19.1.0) - react-native-uitextview: - specifier: ^2.2.0 - version: 2.2.0(react-native@0.81.5(patch_hash=0a4b515f22d157816048e3181dd18fb83b1679a90fca50f715c55483aabdced4)(@babel/core@7.29.0)(@react-native/metro-config@0.86.0(@babel/core@7.29.0))(@types/react@19.1.17)(react@19.1.0))(react@19.1.0) react-native-uuid: specifier: ^2.0.3 version: 2.0.4 @@ -1660,6 +1660,12 @@ packages: react: '*' react-native: '*' + '@bsky.app/react-native-uitextview@2.4.1': + resolution: {integrity: sha512-NM6h9m3YXPnL7Sc7dZAA/UQLbHgBR0sMf5nBSkq0DgS1+t1TpZ8/WahsdDa8//OEkP1P2RBNPoWFLtNE555wCg==} + peerDependencies: + react: '*' + react-native: '>=0.81.5' + '@bsky.app/sift@0.3.9': resolution: {integrity: sha512-EmwK6EGtxl6Mz4Z96J2EFi5aeiKeGiqueVCQHVms9C6ms6wMS0/HcqC/48RgFN+nSsM7Wr8sFCg1EcNnWyOQMQ==} peerDependencies: @@ -8031,12 +8037,6 @@ packages: react: '*' react-native: '*' - react-native-uitextview@2.2.0: - resolution: {integrity: sha512-Vbv3cTAuyfkYrfsR2YKFsOd9OYgfys+IX5yvvYY7Wd6TrOd6FSGrX93xtQHjeLXV1ds6fDJcFJsuLi3S4Ypr8A==} - peerDependencies: - react: '*' - react-native: '*' - react-native-uuid@2.0.4: resolution: {integrity: sha512-LSJNeh559qC17fgVPBsWuTSW/OygFp2dwTcf94IQBLYft5FzIQS9pCsuT36OPvyvDOMb6yiGr6TafaJDnz9PPQ==} engines: {node: '>=18.0.0', npm: '>=9.0.0'} @@ -10381,6 +10381,11 @@ snapshots: react: 19.1.0 react-native: 0.81.5(patch_hash=0a4b515f22d157816048e3181dd18fb83b1679a90fca50f715c55483aabdced4)(@babel/core@7.29.0)(@react-native/metro-config@0.86.0(@babel/core@7.29.0))(@types/react@19.1.17)(react@19.1.0) + '@bsky.app/react-native-uitextview@2.4.1(react-native@0.81.5(patch_hash=0a4b515f22d157816048e3181dd18fb83b1679a90fca50f715c55483aabdced4)(@babel/core@7.29.0)(@react-native/metro-config@0.86.0(@babel/core@7.29.0))(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)': + dependencies: + react: 19.1.0 + react-native: 0.81.5(patch_hash=0a4b515f22d157816048e3181dd18fb83b1679a90fca50f715c55483aabdced4)(@babel/core@7.29.0)(@react-native/metro-config@0.86.0(@babel/core@7.29.0))(@types/react@19.1.17)(react@19.1.0) + '@bsky.app/sift@0.3.9(expo@54.0.35(@babel/core@7.29.0)(react-native-webview@13.15.0(react-native@0.81.5(patch_hash=0a4b515f22d157816048e3181dd18fb83b1679a90fca50f715c55483aabdced4)(@babel/core@7.29.0)(@react-native/metro-config@0.86.0(@babel/core@7.29.0))(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(patch_hash=0a4b515f22d157816048e3181dd18fb83b1679a90fca50f715c55483aabdced4)(@babel/core@7.29.0)(@react-native/metro-config@0.86.0(@babel/core@7.29.0))(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native-safe-area-context@5.6.2(react-native@0.81.5(patch_hash=0a4b515f22d157816048e3181dd18fb83b1679a90fca50f715c55483aabdced4)(@babel/core@7.29.0)(@react-native/metro-config@0.86.0(@babel/core@7.29.0))(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(patch_hash=0a4b515f22d157816048e3181dd18fb83b1679a90fca50f715c55483aabdced4)(@babel/core@7.29.0)(@react-native/metro-config@0.86.0(@babel/core@7.29.0))(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)': dependencies: expo: 54.0.35(@babel/core@7.29.0)(react-native-webview@13.15.0(react-native@0.81.5(patch_hash=0a4b515f22d157816048e3181dd18fb83b1679a90fca50f715c55483aabdced4)(@babel/core@7.29.0)(@react-native/metro-config@0.86.0(@babel/core@7.29.0))(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(patch_hash=0a4b515f22d157816048e3181dd18fb83b1679a90fca50f715c55483aabdced4)(@babel/core@7.29.0)(@react-native/metro-config@0.86.0(@babel/core@7.29.0))(@types/react@19.1.17)(react@19.1.0))(react@19.1.0) @@ -17769,11 +17774,6 @@ snapshots: react-native: 0.81.5(patch_hash=0a4b515f22d157816048e3181dd18fb83b1679a90fca50f715c55483aabdced4)(@babel/core@7.29.0)(@react-native/metro-config@0.86.0(@babel/core@7.29.0))(@types/react@19.1.17)(react@19.1.0) warn-once: 0.1.1 - react-native-uitextview@2.2.0(react-native@0.81.5(patch_hash=0a4b515f22d157816048e3181dd18fb83b1679a90fca50f715c55483aabdced4)(@babel/core@7.29.0)(@react-native/metro-config@0.86.0(@babel/core@7.29.0))(@types/react@19.1.17)(react@19.1.0))(react@19.1.0): - dependencies: - react: 19.1.0 - react-native: 0.81.5(patch_hash=0a4b515f22d157816048e3181dd18fb83b1679a90fca50f715c55483aabdced4)(@babel/core@7.29.0)(@react-native/metro-config@0.86.0(@babel/core@7.29.0))(@types/react@19.1.17)(react@19.1.0) - react-native-uuid@2.0.4: {} react-native-view-shot@4.0.3(patch_hash=a2457dc30a82cc8c21f371a6f860d9396d450a2a1b4265b1a4ee13bdb24d3268)(react-native@0.81.5(patch_hash=0a4b515f22d157816048e3181dd18fb83b1679a90fca50f715c55483aabdced4)(@babel/core@7.29.0)(@react-native/metro-config@0.86.0(@babel/core@7.29.0))(@types/react@19.1.17)(react@19.1.0))(react@19.1.0): diff --git a/src/alf/typography.tsx b/src/alf/typography.tsx index 9b750f1537..d1e9f96e99 100644 --- a/src/alf/typography.tsx +++ b/src/alf/typography.tsx @@ -4,7 +4,7 @@ import { type TextProps as RNTextProps, type TextStyle, } from 'react-native' -import {UITextView} from 'react-native-uitextview' +import {UITextView} from '@bsky.app/react-native-uitextview' import createEmojiRegex from 'emoji-regex' import {type Alf, applyFonts, atoms, flatten} from '#/alf' diff --git a/src/components/Typography.tsx b/src/components/Typography.tsx index b105ffbb8c..aab4751020 100644 --- a/src/components/Typography.tsx +++ b/src/components/Typography.tsx @@ -1,4 +1,4 @@ -import {UITextView} from 'react-native-uitextview' +import {UITextView} from '@bsky.app/react-native-uitextview' import {logger} from '#/logger' import {atoms as a, type TextStyleProp, useAlf, useTheme, web} from '#/alf' diff --git a/src/lib/web-shims/codegenNativeComponent.js b/src/lib/web-shims/codegenNativeComponent.js deleted file mode 100644 index 4c50f5cd87..0000000000 --- a/src/lib/web-shims/codegenNativeComponent.js +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Web stub for `react-native/Libraries/Utilities/codegenNativeComponent`. - * - * Deep `react-native/*` imports bypass the `react-native$ -> react-native-web` - * alias and drag RN core into the web bundle, where its platform-extension - * modules (e.g. Libraries/Utilities/Platform.js) resolve to themselves and - * throw a TDZ error at startup. Packages that import codegen specs - * unconditionally (react-native-uitextview) guard the native component behind - * a `Platform.OS === 'ios'` check, so nothing ever renders this on web. - */ -module.exports = function codegenNativeComponent(componentName) { - return function UnimplementedNativeComponent() { - throw new Error( - `Native component "${componentName}" was rendered on web. It has no web implementation.`, - ) - } -} diff --git a/src/view/com/util/text/Text.tsx b/src/view/com/util/text/Text.tsx index 88682d9172..b703efa405 100644 --- a/src/view/com/util/text/Text.tsx +++ b/src/view/com/util/text/Text.tsx @@ -1,6 +1,6 @@ import {useMemo} from 'react' import {StyleSheet, type TextProps} from 'react-native' -import {UITextView} from 'react-native-uitextview' +import {UITextView} from '@bsky.app/react-native-uitextview' import {lh, s} from '#/lib/styles' import {type TypographyVariant, useTheme} from '#/lib/ThemeContext' diff --git a/webpack.config.js b/webpack.config.js index 69a7adaab1..889a2cb83f 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -62,16 +62,6 @@ module.exports = async function (env, argv) { } config = withAlias(config, { 'react-native$': 'react-native-web', - /* - * Codegen specs import this via a deep `react-native/*` path, which skips - * the exact-match alias above and pulls RN core into the web bundle. RN - * core's platform-extension modules have no `.web` variant, so they - * resolve to themselves and blow up with a TDZ error on startup. - */ - 'react-native/Libraries/Utilities/codegenNativeComponent$': path.join( - __dirname, - 'src/lib/web-shims/codegenNativeComponent.js', - ), 'react-native-webview': 'react-native-web-webview', 'react-native-gesture-handler': false, // RNGH should not be used on web, so let's cause a build error if it sneaks in '@sentry-internal/replay': false, // not used, ~300kb of dead weight