File tree Expand file tree Collapse file tree
packages/react-native/Libraries/Text Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -466,6 +466,24 @@ function useTextPressability({
466466 ) ;
467467}
468468
469+ function usePressabilityDebugStyleDev (
470+ style : ?TextStyleProp ,
471+ onPress : ?( event : GestureResponderEvent ) = > unknown ,
472+ ) : ?TextStyleProp {
473+ const isDebugEnabled = PressabilityDebug . useIsEnabled ( ) ;
474+ return isDebugEnabled && onPress != null
475+ ? [ style , { color : 'magenta' } ]
476+ : style ;
477+ }
478+
479+ /**
480+ * Colors pressable text when press targets are shown by the Inspector.
481+ * Outside of `__DEV__` it returns the style unchanged and uses no hooks.
482+ */
483+ const usePressabilityDebugStyle : typeof usePressabilityDebugStyleDev = __DEV__
484+ ? usePressabilityDebugStyleDev
485+ : style => style ;
486+
469487/**
470488 * Wrap the NativeVirtualText component and initialize pressability.
471489 *
@@ -533,19 +551,6 @@ component PressableText(
533551 ) ;
534552}
535553
536- /**
537- * Colors pressable text when press targets are shown by the Inspector.
538- */
539- function usePressabilityDebugStyle (
540- style : NativeTextProps [ 'style' ] ,
541- onPress : TextPressabilityProps [ 'onPress' ] ,
542- ) : NativeTextProps [ 'style' ] {
543- const isDebugEnabled = PressabilityDebug . useIsEnabled ( ) ;
544- return isDebugEnabled && onPress != null
545- ? [ style , { color : 'magenta' } ]
546- : style ;
547- }
548-
549554const userSelectToSelectableMap = {
550555 auto : true ,
551556 text : true ,
You can’t perform that action at this time.
0 commit comments