mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Remove TextInlineImageNativeComponent Remnants (#55434)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55434 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 fbshipit-source-id: c33897efee124eaabed5447266389f34709650e0
This commit is contained in:
1 parent
5d0d941119
commit
36182241e6
3 files changed
+1
-69
No files matched your search
@@ -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 ? (
|
||||
<TextInlineImageNativeComponent
|
||||
// $FlowFixMe[incompatible-type]
|
||||
style={style_}
|
||||
resizeMode={resizeMode_}
|
||||
headers={headers_}
|
||||
src={sources_}
|
||||
ref={actualRef}
|
||||
/>
|
||||
) : (
|
||||
<ImageViewNativeComponent {...nativeProps} ref={actualRef} />
|
||||
);
|
||||
return <ImageViewNativeComponent {...nativeProps} ref={actualRef} />;
|
||||
};
|
||||
|
||||
let _BaseImage = BaseImage;
|
||||
|
||||
@@ -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<?Readonly<{uri?: ?string, ...}>>,
|
||||
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<RCTTextInlineImageNativeProps> =
|
||||
NativeComponentRegistry.get<RCTTextInlineImageNativeProps>(
|
||||
'RCTTextInlineImage',
|
||||
() => __INTERNAL_VIEW_CONFIG,
|
||||
);
|
||||
|
||||
export default TextInlineImage;
|
||||
-5
@@ -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";
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user