diff --git a/Libraries/Text/Text.js b/Libraries/Text/Text.js index cd28d02a04d..54476ca5369 100644 --- a/Libraries/Text/Text.js +++ b/Libraries/Text/Text.js @@ -163,6 +163,7 @@ const Text: React.AbstractComponent< {...restProps} {...eventHandlersForText} isHighlighted={isHighlighted} + isPressable={isPressable} numberOfLines={numberOfLines} selectionColor={selectionColor} style={style} diff --git a/Libraries/Text/TextNativeComponent.js b/Libraries/Text/TextNativeComponent.js index da238a1222a..615b9d264d4 100644 --- a/Libraries/Text/TextNativeComponent.js +++ b/Libraries/Text/TextNativeComponent.js @@ -19,6 +19,10 @@ type NativeTextProps = $ReadOnly<{ ...TextProps, isHighlighted?: ?boolean, selectionColor?: ?ProcessedColorValue, + // This is only needed for platforms that optimize text hit testing, e.g., + // react-native-windows. It can be used to only hit test virtual text spans + // that have pressable events attached to them. + isPressable?: ?boolean, }>; export const NativeText: HostComponent = @@ -26,6 +30,7 @@ export const NativeText: HostComponent = validAttributes: { ...ReactNativeViewAttributes.UIView, isHighlighted: true, + isPressable: true, numberOfLines: true, ellipsizeMode: true, allowFontScaling: true, @@ -59,6 +64,7 @@ export const NativeVirtualText: HostComponent = validAttributes: { ...ReactNativeViewAttributes.UIView, isHighlighted: true, + isPressable: true, maxFontSizeMultiplier: true, }, uiViewClassName: 'RCTVirtualText',