From e1fea5ad1c9461002816cd7d7e2056d6bf3236be Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Fri, 13 Feb 2026 11:10:20 -0800 Subject: [PATCH] Remove TextInlineImageNativeComponent Remnants (#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 ba410cc8233c..b30c90dc0d4b 100644 --- a/packages/react-native/Libraries/Image/Image.android.js +++ b/packages/react-native/Libraries/Image/Image.android.js @@ -18,7 +18,6 @@ import type {AbstractImageAndroid, ImageAndroid} from './ImageTypes.flow'; import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNativeFeatureFlags'; import flattenStyle from '../StyleSheet/flattenStyle'; import StyleSheet from '../StyleSheet/StyleSheet'; -import TextAncestorContext from '../Text/TextAncestorContext'; import ImageAnalyticsTagContext from './ImageAnalyticsTagContext'; import { unstable_getImageComponentDecorator, @@ -31,7 +30,6 @@ import NativeImageLoaderAndroid, { type ImageSize, } from './NativeImageLoaderAndroid'; import resolveAssetSource from './resolveAssetSource'; -import TextInlineImageNativeComponent from './TextInlineImageNativeComponent'; import * as React from 'react'; import {use} from 'react'; @@ -326,24 +324,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 48ee4a554b46..000000000000 --- 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 de9e32008760..25e3b2cb1072 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"; }