From 3efbe33ce03f846932406742528652eb695b957d Mon Sep 17 00:00:00 2001 From: hyochan Date: Fri, 6 Dec 2024 03:56:14 -0800 Subject: [PATCH] Add pointerEvents support to Text component (#48081) Summary: This PR adds `pointerEvents` to the `TextProps` type. ### Motivation: The `pointerEvents` property is already supported in `Text` components internally, but it was missing from the TypeScript definitions. By adding it to `TextProps`, developers can now use this property with full type safety and without TypeScript errors. This is a type-only change and does not introduce any functional modifications. ## Changelog: [GENERAL] [ADDED] - Added `pointerEvents` to `TextProps` type. Pull Request resolved: https://github.com/facebook/react-native/pull/48081 Test Plan: As this is a type-only update: - Verified that the `pointerEvents` property is now recognized when used with `Text` components in TypeScript projects. - Ensured there are no runtime changes or regressions by testing existing `Text` components for expected behavior. Reviewed By: cipolleschi Differential Revision: D66753454 Pulled By: javache fbshipit-source-id: c8f21b11daa6001a309b1d29fd6259101d11f5d2 --- packages/react-native/Libraries/Text/Text.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/react-native/Libraries/Text/Text.d.ts b/packages/react-native/Libraries/Text/Text.d.ts index b90bf240ba7..2481ba7707c 100644 --- a/packages/react-native/Libraries/Text/Text.d.ts +++ b/packages/react-native/Libraries/Text/Text.d.ts @@ -12,7 +12,7 @@ import {Constructor} from '../../types/private/Utilities'; import {AccessibilityProps} from '../Components/View/ViewAccessibility'; import {NativeMethods} from '../../types/public/ReactNativeTypes'; import {ColorValue, StyleProp} from '../StyleSheet/StyleSheet'; -import {TextStyle} from '../StyleSheet/StyleSheetTypes'; +import {TextStyle, ViewStyle} from '../StyleSheet/StyleSheetTypes'; import { GestureResponderEvent, LayoutChangeEvent, @@ -209,6 +209,11 @@ export interface TextProps * Specifies smallest possible scale a font can reach when adjustsFontSizeToFit is enabled. (values 0.01-1.0). */ minimumFontScale?: number | undefined; + + /** + * Controls how touch events are handled. Similar to `View`'s `pointerEvents`. + */ + pointerEvents?: ViewStyle['pointerEvents'] | undefined; } /**