From af59fe5e837a2293fb0843e114026e2e99e1b668 Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Mon, 9 Feb 2026 16:20:10 -0800 Subject: [PATCH] Remove TextInlineImageNativeComponent in JS (#55434) Summary: This is used by `Image`, to render a different component when under a `TextAncestorContext`, but the underlying component is remapped by Fabric to instead be interpreted as `Image`. We can delete the code JS side safely, since it will use the existing registered View manager, Fabric will already redirect to. We can also then delete the redirection in Fabric, since the component is no longer ever used. See `componentNameByReactViewName.cpp`, where this is also removed. Changelog: [Internal] Reviewed By: mdvacca, javache, cortinico Differential Revision: D92481981 --- .../Libraries/Image/Image.android.js | 16 +----- .../Image/TextInlineImageNativeComponent.js | 49 ------------------- .../componentNameByReactViewName.cpp | 5 -- 3 files changed, 1 insertion(+), 69 deletions(-) delete mode 100644 packages/react-native/Libraries/Image/TextInlineImageNativeComponent.js diff --git a/packages/react-native/Libraries/Image/Image.android.js b/packages/react-native/Libraries/Image/Image.android.js index 63605b9eed1a40..1eb5acc0b870d7 100644 --- a/packages/react-native/Libraries/Image/Image.android.js +++ b/packages/react-native/Libraries/Image/Image.android.js @@ -17,7 +17,6 @@ import type {AbstractImageAndroid, ImageAndroid} from './ImageTypes.flow'; import flattenStyle from '../StyleSheet/flattenStyle'; import StyleSheet from '../StyleSheet/StyleSheet'; -import TextAncestorContext from '../Text/TextAncestorContext'; import ImageAnalyticsTagContext from './ImageAnalyticsTagContext'; import { unstable_getImageComponentDecorator, @@ -30,7 +29,6 @@ import NativeImageLoaderAndroid, { type ImageSize, } from './NativeImageLoaderAndroid'; import resolveAssetSource from './resolveAssetSource'; -import TextInlineImageNativeComponent from './TextInlineImageNativeComponent'; import * as React from 'react'; import {use} from 'react'; @@ -309,24 +307,12 @@ let BaseImage: AbstractImageAndroid = ({ const actualRef = useWrapRefWithImageAttachedCallbacks(forwardedRef); - const hasTextAncestor = use(TextAncestorContext); const analyticTag = use(ImageAnalyticsTagContext); if (analyticTag !== null) { nativeProps.internal_analyticTag = analyticTag; } - return hasTextAncestor ? ( - - ) : ( - - ); + return ; }; let _BaseImage = BaseImage; diff --git a/packages/react-native/Libraries/Image/TextInlineImageNativeComponent.js b/packages/react-native/Libraries/Image/TextInlineImageNativeComponent.js deleted file mode 100644 index 48ee4a554b46d3..00000000000000 --- a/packages/react-native/Libraries/Image/TextInlineImageNativeComponent.js +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict-local - * @format - */ - -'use strict'; - -import type {HostComponent} from '../../src/private/types/HostComponent'; -import type {ViewProps} from '../Components/View/ViewPropTypes'; -import type {PartialViewConfig} from '../Renderer/shims/ReactNativeTypes'; -import type {ColorValue} from '../StyleSheet/StyleSheet'; -import type {ImageResizeMode} from './ImageResizeMode'; - -import * as NativeComponentRegistry from '../NativeComponent/NativeComponentRegistry'; - -type RCTTextInlineImageNativeProps = Readonly<{ - ...ViewProps, - resizeMode?: ?ImageResizeMode, - src?: ?ReadonlyArray>, - tintColor?: ?ColorValue, - headers?: ?{[string]: string}, -}>; - -export const __INTERNAL_VIEW_CONFIG: PartialViewConfig = { - uiViewClassName: 'RCTTextInlineImage', - bubblingEventTypes: {}, - directEventTypes: {}, - validAttributes: { - resizeMode: true, - src: true, - tintColor: { - process: require('../StyleSheet/processColor').default, - }, - headers: true, - }, -}; - -const TextInlineImage: HostComponent = - NativeComponentRegistry.get( - 'RCTTextInlineImage', - () => __INTERNAL_VIEW_CONFIG, - ); - -export default TextInlineImage; diff --git a/packages/react-native/ReactCommon/react/renderer/componentregistry/componentNameByReactViewName.cpp b/packages/react-native/ReactCommon/react/renderer/componentregistry/componentNameByReactViewName.cpp index de9e32008760d8..25e3b2cb1072e1 100644 --- a/packages/react-native/ReactCommon/react/renderer/componentregistry/componentNameByReactViewName.cpp +++ b/packages/react-native/ReactCommon/react/renderer/componentregistry/componentNameByReactViewName.cpp @@ -28,11 +28,6 @@ std::string componentNameByReactViewName(std::string viewName) { return "Paragraph"; } - // TODO T63839307: remove this condition after deleting TextInlineImage from - // old renderer code - if (viewName == "TextInlineImage") { - return "Image"; - } if (viewName == "VirtualText") { return "Text"; }