diff --git a/packages/react-native/Libraries/Text/Text.js b/packages/react-native/Libraries/Text/Text.js
index 9bfc163f9f5..a31b20a918f 100644
--- a/packages/react-native/Libraries/Text/Text.js
+++ b/packages/react-native/Libraries/Text/Text.js
@@ -20,18 +20,14 @@ import flattenStyle from '../StyleSheet/flattenStyle';
import processColor from '../StyleSheet/processColor';
import Platform from '../Utilities/Platform';
import TextAncestorContext from './TextAncestorContext';
-import {
- NativeSelectableText,
- NativeText,
- NativeVirtualText,
-} from './TextNativeComponent';
+import {NativeText, NativeVirtualText} from './TextNativeComponent';
import * as React from 'react';
import {useContext, useMemo, useState} from 'react';
export type {TextProps} from './TextProps';
type TextForwardRef = React.ElementRef<
- typeof NativeText | typeof NativeVirtualText | typeof NativeSelectableText,
+ typeof NativeText | typeof NativeVirtualText,
>;
/**
@@ -267,7 +263,7 @@ const TextImpl: component(
processedProps.children = children;
if (isPressable) {
return (
-
);
} else {
- nativeText =
- _selectable === true ? (
-
- ) : (
-
- );
+ nativeText = ;
}
if (children == null) {
@@ -467,17 +457,28 @@ function useTextPressability({
);
}
+type NativePressableTextProps = Readonly<{
+ textProps: NativeTextProps,
+ textPressabilityProps: TextPressabilityProps,
+}>;
+
/**
* Wrap the NativeVirtualText component and initialize pressability.
*
* This logic is split out from the main Text component to enable the more
* expensive pressability logic to be only initialized when needed.
*/
-component PressableVirtualText(
+const NativePressableVirtualText: component(
+ ref: React.RefSetter,
+ ...props: NativePressableTextProps
+) = ({
+ ref: forwardedRef,
+ textProps,
+ textPressabilityProps,
+}: {
ref?: React.RefSetter,
- textProps: NativeTextProps,
- textPressabilityProps: TextPressabilityProps,
-) {
+ ...NativePressableTextProps,
+}) => {
const [isHighlighted, eventHandlersForText] = useTextPressability(
textPressabilityProps,
);
@@ -488,40 +489,42 @@ component PressableVirtualText(
{...eventHandlersForText}
isHighlighted={isHighlighted}
isPressable={true}
- ref={ref}
+ ref={forwardedRef}
/>
);
-}
+};
/**
- * Wrap a NativeText component and initialize pressability.
+ * Wrap the NativeText component and initialize pressability.
*
* This logic is split out from the main Text component to enable the more
* expensive pressability logic to be only initialized when needed.
*/
-component PressableText(
+const NativePressableText: component(
+ ref: React.RefSetter,
+ ...props: NativePressableTextProps
+) = ({
+ ref: forwardedRef,
+ textProps,
+ textPressabilityProps,
+}: {
ref?: React.RefSetter,
- selectable?: ?boolean,
- textProps: NativeTextProps,
- textPressabilityProps: TextPressabilityProps,
-) {
+ ...NativePressableTextProps,
+}) => {
const [isHighlighted, eventHandlersForText] = useTextPressability(
textPressabilityProps,
);
- const NativeComponent =
- selectable === true ? NativeSelectableText : NativeText;
-
return (
-
);
-}
+};
const userSelectToSelectableMap = {
auto: true,
diff --git a/packages/react-native/Libraries/Text/TextNativeComponent.js b/packages/react-native/Libraries/Text/TextNativeComponent.js
index 01b7c690fd8..020d5ceea8b 100644
--- a/packages/react-native/Libraries/Text/TextNativeComponent.js
+++ b/packages/react-native/Libraries/Text/TextNativeComponent.js
@@ -13,7 +13,6 @@ import type {ProcessedColorValue} from '../StyleSheet/processColor';
import type {GestureResponderEvent} from '../Types/CoreEventTypes';
import type {TextProps} from './TextProps';
-import {enablePreparedTextLayout} from '../../src/private/featureflags/ReactNativeFeatureFlags';
import {createViewConfig} from '../NativeComponent/ViewConfig';
import UIManager from '../ReactNative/UIManager';
import createReactNativeComponentClass from '../Renderer/shims/createReactNativeComponentClass';
@@ -91,15 +90,3 @@ export const NativeVirtualText: HostComponent =
* https://fburl.com/workplace/6291gfvu */
createViewConfig(virtualTextViewConfig),
): any);
-
-export const NativeSelectableText: HostComponent =
- enablePreparedTextLayout()
- ? (createReactNativeComponentClass('RCTSelectableText', () =>
- /* $FlowFixMe[incompatible-type] Natural Inference rollout. See
- * https://fburl.com/workplace/6291gfvu */
- createViewConfig({
- ...textViewConfig,
- uiViewClassName: 'RCTSelectableText',
- }),
- ): any)
- : NativeText;
diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api
index bd954e44c8e..182fabf4666 100644
--- a/packages/react-native/ReactAndroid/api/ReactAndroid.api
+++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api
@@ -6114,7 +6114,7 @@ public class com/facebook/react/views/text/ReactTextView : androidx/appcompat/wi
public fun updateView ()V
}
-public class com/facebook/react/views/text/ReactTextViewManager : com/facebook/react/uimanager/BaseViewManager, com/facebook/react/uimanager/IViewManagerWithChildren, com/facebook/react/views/text/ReactTextViewManagerCallback {
+public final class com/facebook/react/views/text/ReactTextViewManager : com/facebook/react/uimanager/BaseViewManager, com/facebook/react/uimanager/IViewManagerWithChildren, com/facebook/react/views/text/ReactTextViewManagerCallback {
public static final field Companion Lcom/facebook/react/views/text/ReactTextViewManager$Companion;
public static final field REACT_CLASS Ljava/lang/String;
public fun ()V
@@ -6127,14 +6127,11 @@ public class com/facebook/react/views/text/ReactTextViewManager : com/facebook/r
public fun createViewInstance (Lcom/facebook/react/uimanager/ThemedReactContext;)Lcom/facebook/react/views/text/ReactTextView;
public fun getExportedCustomDirectEventTypeConstants ()Ljava/util/Map;
public fun getName ()Ljava/lang/String;
- protected final fun getReactTextViewManagerCallback ()Lcom/facebook/react/views/text/ReactTextViewManagerCallback;
public fun getShadowNodeClass ()Ljava/lang/Class;
public fun needsCustomLayoutForChildren ()Z
public synthetic fun onAfterUpdateTransaction (Landroid/view/View;)V
- protected fun onAfterUpdateTransaction (Lcom/facebook/react/views/text/ReactTextView;)V
public fun onPostProcessSpannable (Landroid/text/Spannable;)V
public synthetic fun prepareToRecycleView (Lcom/facebook/react/uimanager/ThemedReactContext;Landroid/view/View;)Landroid/view/View;
- protected fun prepareToRecycleView (Lcom/facebook/react/uimanager/ThemedReactContext;Lcom/facebook/react/views/text/ReactTextView;)Lcom/facebook/react/views/text/ReactTextView;
public final fun setAccessible (Lcom/facebook/react/views/text/ReactTextView;Z)V
public final fun setAdjustFontSizeToFit (Lcom/facebook/react/views/text/ReactTextView;Z)V
public final fun setAndroidHyphenationFrequency (Lcom/facebook/react/views/text/ReactTextView;Ljava/lang/String;)V
@@ -6152,7 +6149,6 @@ public class com/facebook/react/views/text/ReactTextViewManager : com/facebook/r
public final fun setOverflow (Lcom/facebook/react/views/text/ReactTextView;Ljava/lang/String;)V
public synthetic fun setPadding (Landroid/view/View;IIII)V
public fun setPadding (Lcom/facebook/react/views/text/ReactTextView;IIII)V
- protected final fun setReactTextViewManagerCallback (Lcom/facebook/react/views/text/ReactTextViewManagerCallback;)V
public final fun setSelectable (Lcom/facebook/react/views/text/ReactTextView;Z)V
public final fun setSelectionColor (Lcom/facebook/react/views/text/ReactTextView;Ljava/lang/Integer;)V
public final fun setTextAlignVertical (Lcom/facebook/react/views/text/ReactTextView;Ljava/lang/String;)V
@@ -6161,7 +6157,6 @@ public class com/facebook/react/views/text/ReactTextViewManager : com/facebook/r
public synthetic fun updateState (Landroid/view/View;Lcom/facebook/react/uimanager/ReactStylesDiffMap;Lcom/facebook/react/uimanager/StateWrapper;)Ljava/lang/Object;
public fun updateState (Lcom/facebook/react/views/text/ReactTextView;Lcom/facebook/react/uimanager/ReactStylesDiffMap;Lcom/facebook/react/uimanager/StateWrapper;)Ljava/lang/Object;
public synthetic fun updateViewAccessibility (Landroid/view/View;)V
- protected fun updateViewAccessibility (Lcom/facebook/react/views/text/ReactTextView;)V
}
public final class com/facebook/react/views/text/ReactTextViewManager$Companion {
@@ -6179,9 +6174,6 @@ public final class com/facebook/react/views/text/ReactTypefaceUtils {
public static final fun parseFontWeight (Ljava/lang/String;)I
}
-public final class com/facebook/react/views/text/SelectableTextViewManager$Companion {
-}
-
public final class com/facebook/react/views/text/TextAttributeProps {
public static final field Companion Lcom/facebook/react/views/text/TextAttributeProps$Companion;
public static final field TA_KEY_ACCESSIBILITY_ROLE I
diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/FabricNameComponentMapping.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/FabricNameComponentMapping.kt
index 31d93c32b69..c032448a7a3 100644
--- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/FabricNameComponentMapping.kt
+++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/FabricNameComponentMapping.kt
@@ -18,7 +18,6 @@ internal object FabricNameComponentMapping {
"Slider" to "RCTSlider",
"ModalHostView" to "RCTModalHostView",
"Paragraph" to "RCTText",
- "SelectableParagraph" to "RCTSelectableText",
"Text" to "RCTText",
"RawText" to "RCTRawText",
"ActivityIndicatorView" to "AndroidProgressBar",
diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.kt
index b3baad46a9a..9927bf57153 100644
--- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.kt
+++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.kt
@@ -15,7 +15,6 @@ import com.facebook.react.bridge.ModuleSpec
import com.facebook.react.bridge.NativeModule
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.common.ClassFinder
-import com.facebook.react.common.annotations.UnstableReactNativeAPI
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
import com.facebook.react.module.annotations.ReactModule
import com.facebook.react.module.annotations.ReactModuleList
@@ -59,7 +58,6 @@ import com.facebook.react.views.swiperefresh.SwipeRefreshLayoutManager
import com.facebook.react.views.switchview.ReactSwitchManager
import com.facebook.react.views.text.PreparedLayoutTextViewManager
import com.facebook.react.views.text.ReactTextViewManager
-import com.facebook.react.views.text.SelectableTextViewManager
import com.facebook.react.views.textinput.ReactTextInputManager
import com.facebook.react.views.unimplementedview.ReactUnimplementedViewManager
import com.facebook.react.views.view.ReactViewManager
@@ -98,7 +96,6 @@ import com.facebook.react.views.view.ReactViewManager
WebSocketModule::class,
]
)
-@OptIn(UnstableReactNativeAPI::class)
public class MainReactPackage
@JvmOverloads
constructor(private val config: MainPackageConfig? = null) :
@@ -153,7 +150,6 @@ constructor(private val config: MainPackageConfig? = null) :
ReactTextInputManager(),
if (ReactNativeFeatureFlags.enablePreparedTextLayout()) PreparedLayoutTextViewManager()
else ReactTextViewManager(),
- SelectableTextViewManager(),
ReactViewManager(),
ReactUnimplementedViewManager(),
)
@@ -196,8 +192,6 @@ constructor(private val config: MainPackageConfig? = null) :
PreparedLayoutTextViewManager()
else ReactTextViewManager()
},
- SelectableTextViewManager.REACT_CLASS to
- ModuleSpec.viewManagerSpec { SelectableTextViewManager() },
ReactViewManager.REACT_CLASS to ModuleSpec.viewManagerSpec { ReactViewManager() },
ReactUnimplementedViewManager.REACT_CLASS to
ModuleSpec.viewManagerSpec { ReactUnimplementedViewManager() },
diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/PreparedLayoutTextViewManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/PreparedLayoutTextViewManager.kt
index 66a2bf75313..ede2a678a1f 100644
--- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/PreparedLayoutTextViewManager.kt
+++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/PreparedLayoutTextViewManager.kt
@@ -118,9 +118,8 @@ internal class PreparedLayoutTextViewManager :
@ReactProp(name = "selectable", defaultBoolean = false)
fun setSelectable(view: PreparedLayoutTextView, isSelectable: Boolean): Unit {
- check(!isSelectable) {
- "selectable Text should use SelectableTextViewManager instead of PreparedLayoutViewManager"
- }
+ // T222052152: Implement fine-grained text selection for PreparedLayoutTextView
+ // view.setTextIsSelectable(isSelectable);
}
@ReactProp(name = "selectionColor", customType = "Color")
diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.kt
index e616cf5f6e7..2e3669c113d 100644
--- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.kt
+++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.kt
@@ -12,7 +12,6 @@ package com.facebook.react.views.text
import android.os.Build
import android.text.Layout
import android.text.Spannable
-import android.text.SpannableString
import android.text.Spanned
import android.text.TextUtils
import android.text.util.Linkify
@@ -32,7 +31,6 @@ import com.facebook.react.uimanager.LayoutShadowNode
import com.facebook.react.uimanager.LengthPercentage
import com.facebook.react.uimanager.LengthPercentageType
import com.facebook.react.uimanager.ReactStylesDiffMap
-import com.facebook.react.uimanager.ReferenceStateWrapper
import com.facebook.react.uimanager.StateWrapper
import com.facebook.react.uimanager.ThemedReactContext
import com.facebook.react.uimanager.ViewDefaults
@@ -48,7 +46,7 @@ import java.util.HashMap
/** View manager for `` nodes. */
@ReactModule(name = ReactTextViewManager.REACT_CLASS)
@OptIn(UnstableReactNativeAPI::class)
-public open class ReactTextViewManager
+public class ReactTextViewManager
@JvmOverloads
public constructor(
protected var reactTextViewManagerCallback: ReactTextViewManagerCallback? = null
@@ -133,11 +131,6 @@ public constructor(
stateWrapper: StateWrapper,
): Any? {
SystraceSection("ReactTextViewManager.updateState").use { s ->
- val refState = (stateWrapper as? ReferenceStateWrapper)?.stateDataReference
- if (refState is PreparedLayout) {
- return getReactTextUpdateFromPreparedLayout(view, refState)
- }
-
val stateMapBuffer = stateWrapper.stateDataMapBuffer
return if (stateMapBuffer != null) {
getReactTextUpdate(view, props, stateMapBuffer)
@@ -183,34 +176,6 @@ public constructor(
)
}
- /**
- * Constructs a [ReactTextUpdate] from a [PreparedLayout] received via [ReferenceStateWrapper].
- */
- private fun getReactTextUpdateFromPreparedLayout(
- view: ReactTextView,
- preparedLayout: PreparedLayout,
- ): ReactTextUpdate {
- val layout = preparedLayout.layout
- val text = layout.text
- val spanned = if (text is Spannable) text else SpannableString(text)
- view.setSpanned(spanned)
-
- val textAlign =
- when (layout.alignment) {
- Layout.Alignment.ALIGN_CENTER -> Gravity.CENTER_HORIZONTAL
- Layout.Alignment.ALIGN_OPPOSITE -> Gravity.END
- else -> Gravity.START
- }
-
- return ReactTextUpdate(
- spanned,
- -1,
- textAlign,
- Layout.BREAK_STRATEGY_HIGH_QUALITY,
- 0,
- )
- }
-
override fun getExportedCustomDirectEventTypeConstants(): MutableMap? {
val baseEventTypeConstants = super.getExportedCustomDirectEventTypeConstants()
val eventTypeConstants = baseEventTypeConstants ?: HashMap()
diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/SelectableTextViewManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/SelectableTextViewManager.kt
deleted file mode 100644
index b1f15c46190..00000000000
--- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/SelectableTextViewManager.kt
+++ /dev/null
@@ -1,29 +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.
- */
-
-package com.facebook.react.views.text
-
-import com.facebook.react.common.annotations.UnstableReactNativeAPI
-
-/**
- * A [ReactTextViewManager] registered under the name "RCTSelectableText". Used to route selectable
- * text through [ReactTextView] (a real [android.widget.TextView]) instead of
- * [PreparedLayoutTextView] when enablePreparedTextLayout is on, since [PreparedLayoutTextView] does
- * not support native text selection.
- */
-@UnstableReactNativeAPI
-public class SelectableTextViewManager
-@JvmOverloads
-public constructor(reactTextViewManagerCallback: ReactTextViewManagerCallback? = null) :
- ReactTextViewManager(reactTextViewManagerCallback) {
-
- override fun getName(): String = REACT_CLASS
-
- public companion object {
- public const val REACT_CLASS: String = "RCTSelectableText"
- }
-}
diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/fabric/CoreComponentsRegistry.cpp b/packages/react-native/ReactAndroid/src/main/jni/react/fabric/CoreComponentsRegistry.cpp
index 3b15aa50198..03d455ee92f 100644
--- a/packages/react-native/ReactAndroid/src/main/jni/react/fabric/CoreComponentsRegistry.cpp
+++ b/packages/react-native/ReactAndroid/src/main/jni/react/fabric/CoreComponentsRegistry.cpp
@@ -21,7 +21,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -72,9 +71,6 @@ void addCoreComponents(
AndroidHorizontalScrollContentViewComponentDescriptor>());
providerRegistry->add(
concreteComponentDescriptorProvider());
- providerRegistry->add(
- concreteComponentDescriptorProvider<
- SelectableParagraphComponentDescriptor>());
providerRegistry->add(
concreteComponentDescriptorProvider<
AndroidDrawerLayoutComponentDescriptor>());
diff --git a/packages/react-native/ReactCommon/react/renderer/componentregistry/componentNameByReactViewName.cpp b/packages/react-native/ReactCommon/react/renderer/componentregistry/componentNameByReactViewName.cpp
index fe63407de82..25e3b2cb107 100644
--- a/packages/react-native/ReactCommon/react/renderer/componentregistry/componentNameByReactViewName.cpp
+++ b/packages/react-native/ReactCommon/react/renderer/componentregistry/componentNameByReactViewName.cpp
@@ -27,9 +27,6 @@ std::string componentNameByReactViewName(std::string viewName) {
if (viewName == "Text") {
return "Paragraph";
}
- if (viewName == "SelectableText") {
- return "SelectableParagraph";
- }
if (viewName == "VirtualText") {
return "Text";
diff --git a/packages/react-native/ReactCommon/react/renderer/components/text/BaseParagraphComponentDescriptor.h b/packages/react-native/ReactCommon/react/renderer/components/text/BaseParagraphComponentDescriptor.h
deleted file mode 100644
index 8c7c8aab798..00000000000
--- a/packages/react-native/ReactCommon/react/renderer/components/text/BaseParagraphComponentDescriptor.h
+++ /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.
- */
-
-#pragma once
-
-#include
-#include
-#include
-
-namespace facebook::react {
-
-constexpr const char *const TextLayoutManagerKey = "TextLayoutManager";
-
-template
-class BaseParagraphComponentDescriptor : public ConcreteComponentDescriptor {
- public:
- explicit BaseParagraphComponentDescriptor(const ComponentDescriptorParameters ¶meters)
- : ConcreteComponentDescriptor(parameters),
- textLayoutManager_(getManagerByName(this->contextContainer_, TextLayoutManagerKey))
- {
- }
-
- ComponentName getComponentName() const override
- {
- return ShadowNodeT::Name();
- }
-
- protected:
- void adopt(ShadowNode &shadowNode) const override
- {
- ConcreteComponentDescriptor::adopt(shadowNode);
-
- auto ¶graphShadowNode = static_cast(shadowNode);
-
- // `ParagraphShadowNode` uses `TextLayoutManager` to measure text content
- // and communicate text rendering metrics to mounting layer.
- paragraphShadowNode.setTextLayoutManager(textLayoutManager_);
- }
-
- private:
- // Every `ParagraphShadowNode` has a reference to a shared `TextLayoutManager`
- const std::shared_ptr textLayoutManager_;
-};
-
-} // namespace facebook::react
diff --git a/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphComponentDescriptor.cpp b/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphComponentDescriptor.cpp
new file mode 100644
index 00000000000..ee4e014b656
--- /dev/null
+++ b/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphComponentDescriptor.cpp
@@ -0,0 +1,14 @@
+/*
+ * 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.
+ */
+
+#include "ParagraphComponentDescriptor.h"
+
+namespace facebook::react {
+
+extern const char TextLayoutManagerKey[] = "TextLayoutManager";
+
+} // namespace facebook::react
diff --git a/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphComponentDescriptor.h b/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphComponentDescriptor.h
index 3f64c6e8cb7..3ed1a2a7aef 100644
--- a/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphComponentDescriptor.h
+++ b/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphComponentDescriptor.h
@@ -7,16 +7,41 @@
#pragma once
-#include
#include
+#include
+#include
+#include
namespace facebook::react {
+
+extern const char TextLayoutManagerKey[];
+
/*
* Descriptor for component.
*/
-class ParagraphComponentDescriptor final : public BaseParagraphComponentDescriptor {
+class ParagraphComponentDescriptor final : public ConcreteComponentDescriptor {
public:
- using BaseParagraphComponentDescriptor::BaseParagraphComponentDescriptor;
+ explicit ParagraphComponentDescriptor(const ComponentDescriptorParameters ¶meters)
+ : ConcreteComponentDescriptor(parameters),
+ textLayoutManager_(getManagerByName(contextContainer_, TextLayoutManagerKey))
+ {
+ }
+
+ protected:
+ void adopt(ShadowNode &shadowNode) const override
+ {
+ ConcreteComponentDescriptor::adopt(shadowNode);
+
+ auto ¶graphShadowNode = static_cast(shadowNode);
+
+ // `ParagraphShadowNode` uses `TextLayoutManager` to measure text content
+ // and communicate text rendering metrics to mounting layer.
+ paragraphShadowNode.setTextLayoutManager(textLayoutManager_);
+ }
+
+ private:
+ // Every `ParagraphShadowNode` has a reference to a shared `TextLayoutManager`
+ const std::shared_ptr textLayoutManager_;
};
} // namespace facebook::react
diff --git a/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphShadowNode.h b/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphShadowNode.h
index c518ccf4b90..91709d035d0 100644
--- a/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphShadowNode.h
+++ b/packages/react-native/ReactCommon/react/renderer/components/text/ParagraphShadowNode.h
@@ -26,7 +26,7 @@ extern const char ParagraphComponentName[];
* containing and displaying text. Text content is represented as nested
* and components.
*/
-class ParagraphShadowNode
+class ParagraphShadowNode final
: public ConcreteViewShadowNode,
public BaseTextShadowNode {
public:
diff --git a/packages/react-native/ReactCommon/react/renderer/components/text/SelectableParagraphComponentDescriptor.h b/packages/react-native/ReactCommon/react/renderer/components/text/SelectableParagraphComponentDescriptor.h
deleted file mode 100644
index b008580f588..00000000000
--- a/packages/react-native/ReactCommon/react/renderer/components/text/SelectableParagraphComponentDescriptor.h
+++ /dev/null
@@ -1,24 +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.
- */
-
-#pragma once
-
-#include
-#include
-
-namespace facebook::react {
-/*
- * Descriptor for component, which may render to a
- * different native view than .
- */
-class SelectableParagraphComponentDescriptor final
- : public BaseParagraphComponentDescriptor {
- public:
- using BaseParagraphComponentDescriptor::BaseParagraphComponentDescriptor;
-};
-
-} // namespace facebook::react
diff --git a/packages/react-native/ReactCommon/react/renderer/components/text/SelectableParagraphShadowNode.h b/packages/react-native/ReactCommon/react/renderer/components/text/SelectableParagraphShadowNode.h
deleted file mode 100644
index 8574dd601ab..00000000000
--- a/packages/react-native/ReactCommon/react/renderer/components/text/SelectableParagraphShadowNode.h
+++ /dev/null
@@ -1,32 +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.
- */
-
-#pragma once
-
-#include
-
-namespace facebook::react {
-
-/*
- * ShadowNode for selectable Paragraph components, which may map to different native component than Paragraph.
- */
-class SelectableParagraphShadowNode : public ParagraphShadowNode {
- public:
- using ParagraphShadowNode::ParagraphShadowNode;
-
- static constexpr ComponentName Name()
- {
- return "SelectableParagraph";
- }
-
- static ComponentHandle Handle()
- {
- return ComponentHandle(Name());
- }
-};
-
-} // namespace facebook::react
diff --git a/packages/react-native/ReactNativeApi.d.ts b/packages/react-native/ReactNativeApi.d.ts
index 3cb8fa700fc..9229bb4336f 100644
--- a/packages/react-native/ReactNativeApi.d.ts
+++ b/packages/react-native/ReactNativeApi.d.ts
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
- * @generated SignedSource<>
+ * @generated SignedSource<<6463b0a4f3acbeb07e6759c345b927d8>>
*
* This file was generated by scripts/js-api/build-types/index.js.
*/
@@ -322,7 +322,6 @@ declare const NativeModules: typeof NativeModules_default
declare let NativeModules_default: {
[moduleName: string]: any
}
-declare const NativeSelectableText: HostComponent
declare const NativeText: HostComponent
declare const NativeTouchable:
| typeof TouchableNativeFeedback
@@ -3369,7 +3368,6 @@ declare type NativeScrollVelocity = {
readonly x: number
readonly y: number
}
-declare type NativeSelectableText = typeof NativeSelectableText
declare type NativeSwitchChangeEvent = {
readonly target: Int32
readonly value: boolean
@@ -5162,7 +5160,7 @@ declare type TextContentType =
| "URL"
| "username"
declare type TextForwardRef = React.ComponentRef<
- typeof NativeSelectableText | typeof NativeText | typeof NativeVirtualText
+ typeof NativeText | typeof NativeVirtualText
>
declare type TextInput = typeof TextInput
declare type TextInputAndroidProps = {
@@ -5997,7 +5995,7 @@ export {
AlertOptions, // a0cdac0f
AlertType, // 5ab91217
AndroidKeyboardEvent, // e03becc8
- Animated, // f39d3c6f
+ Animated, // ed7eb912
AppConfig, // ebddad4b
AppRegistry, // 6cdee1d6
AppState, // 12012be5
@@ -6217,7 +6215,7 @@ export {
TVViewPropsIOS, // 330ce7b5
TargetedEvent, // 16e98910
TaskProvider, // 266dedf2
- Text, // 0620c789
+ Text, // e55ac2e2
TextContentType, // 239b3ecc
TextInput, // 2e89b91d
TextInputAndroidProps, // 3f09ce49