11import React from 'react' ;
2+ import { RectButton , type RectButtonProps } from 'react-native-gesture-handler' ;
23import {
34 View ,
4- Pressable ,
55 StyleSheet ,
66 type ViewStyle ,
77 type StyleProp ,
8- type PressableProps ,
98 type AccessibilityActionEvent ,
109 type AccessibilityActionInfo
1110} from 'react-native' ;
1211
1312import { useTheme } from '../theme' ;
1413
15- export interface ITouchProps extends Omit < PressableProps , 'style' | 'children' > {
14+ export interface ITouchProps extends RectButtonProps {
1615 children : React . ReactNode ;
1716 accessible ?: boolean ;
1817 accessibilityLabel ?: string ;
@@ -21,19 +20,15 @@ export interface ITouchProps extends Omit<PressableProps, 'style' | 'children'>
2120 onAccessibilityAction ?: ( event : AccessibilityActionEvent ) => void ;
2221 testID ?: string ;
2322 rectButtonStyle ?: StyleProp < ViewStyle > ;
24- underlayColor ?: string ;
25- activeOpacity ?: number ;
2623 disabled ?: boolean ;
27- style ?: StyleProp < ViewStyle > ;
2824}
2925
30- const Touch = React . forwardRef < React . ElementRef < typeof Pressable > , ITouchProps > (
26+ const Touch = React . forwardRef < React . ElementRef < typeof RectButton > , ITouchProps > (
3127 (
3228 {
3329 children,
3430 onPress,
3531 underlayColor,
36- activeOpacity = 1 ,
3732 accessible,
3833 accessibilityLabel,
3934 accessibilityHint,
@@ -78,21 +73,15 @@ const Touch = React.forwardRef<React.ElementRef<typeof Pressable>, ITouchProps>(
7873 marginTop
7974 } ;
8075 return (
81- < Pressable
76+ < RectButton
8277 ref = { ref }
8378 onPress = { onPress }
84- android_ripple = { { color : underlayColor || colors . surfaceNeutral , borderless : false } }
85- style = { ( { pressed } ) => [
86- rectButtonStyle ,
87- marginStyles ,
88- {
89- backgroundColor : pressed ? underlayColor || colors . surfaceNeutral : backgroundColor ,
90- borderRadius,
91- opacity : pressed ? activeOpacity : 1
92- }
93- ] }
79+ activeOpacity = { 1 }
80+ underlayColor = { underlayColor || colors . surfaceNeutral }
81+ rippleColor = { colors . surfaceNeutral }
82+ style = { [ rectButtonStyle , marginStyles , { backgroundColor, borderRadius } ] }
9483 { ...props }
95- disabled = { disabled } >
84+ enabled = { ! disabled } >
9685 < View
9786 accessible = { accessible }
9887 accessibilityRole = { props . accessibilityRole }
@@ -103,7 +92,7 @@ const Touch = React.forwardRef<React.ElementRef<typeof Pressable>, ITouchProps>(
10392 style = { viewStyle } >
10493 { children }
10594 </ View >
106- </ Pressable >
95+ </ RectButton >
10796 ) ;
10897 }
10998) ;
0 commit comments