9
9
*/
10
10
11
11
import type { ViewStyleProp } from '../../StyleSheet/StyleSheet' ;
12
- import type { HoverEffect } from '../View/ViewPropTypes' ;
13
12
import typeof TouchableWithoutFeedback from './TouchableWithoutFeedback' ;
14
13
15
14
import Animated from '../../Animated/Animated' ;
@@ -19,11 +18,10 @@ import Pressability, {
19
18
} from '../../Pressability/Pressability' ;
20
19
import { PressabilityDebugView } from '../../Pressability/PressabilityDebug' ;
21
20
import flattenStyle from '../../StyleSheet/flattenStyle' ;
21
+ import StyleSheet from '../../StyleSheet/StyleSheet' ;
22
22
import Platform from '../../Utilities/Platform' ;
23
23
import * as React from 'react' ;
24
24
25
- const defaultHoverEffect : HoverEffect = 'highlight' ;
26
-
27
25
type TVProps = $ReadOnly < { |
28
26
hasTVPreferredFocus ?: ?boolean ,
29
27
nextFocusDown ?: ?number ,
@@ -33,14 +31,9 @@ type TVProps = $ReadOnly<{|
33
31
nextFocusUp ?: ?number ,
34
32
| } > ;
35
33
36
- type VisionOSProps = $ReadOnly < { |
37
- visionos_hoverEffect ?: ?HoverEffect ,
38
- | } > ;
39
-
40
34
type Props = $ReadOnly < { |
41
35
...React . ElementConfig < TouchableWithoutFeedback > ,
42
36
...TVProps ,
43
- ...VisionOSProps ,
44
37
45
38
activeOpacity ?: ?number ,
46
39
style ?: ?ViewStyleProp ,
@@ -138,10 +131,6 @@ type State = $ReadOnly<{|
138
131
*
139
132
*/
140
133
class TouchableOpacity extends React . Component < Props , State > {
141
- static defaultProps : { | visionos_hoverEffect : HoverEffect | } = {
142
- visionos_hoverEffect : defaultHoverEffect ,
143
- } ;
144
-
145
134
state : State = {
146
135
anim : new Animated . Value ( this . _getChildStyleOpacityWithDefault ( ) ) ,
147
136
pressability : new Pressability ( this . _createPressabilityConfig ( ) ) ,
@@ -287,7 +276,7 @@ class TouchableOpacity extends React.Component<Props, State> {
287
276
accessibilityElementsHidden = {
288
277
this . props [ 'aria-hidden' ] ?? this . props . accessibilityElementsHidden
289
278
}
290
- style = { [ this . props . style , { opacity : this . state . anim } ] }
279
+ style = { [ styles . touchable , this . props . style , { opacity : this . state . anim } ] }
291
280
nativeID = { this . props . id ?? this . props . nativeID }
292
281
testID = { this . props . testID }
293
282
onLayout = { this . props . onLayout }
@@ -298,7 +287,6 @@ class TouchableOpacity extends React.Component<Props, State> {
298
287
nextFocusUp = { this . props . nextFocusUp }
299
288
hasTVPreferredFocus = { this . props . hasTVPreferredFocus }
300
289
hitSlop = { this . props . hitSlop }
301
- visionos_hoverEffect = { this . props . visionos_hoverEffect }
302
290
focusable = {
303
291
this . props . focusable !== false && this . props . onPress !== undefined
304
292
}
@@ -336,6 +324,12 @@ class TouchableOpacity extends React.Component<Props, State> {
336
324
}
337
325
}
338
326
327
+ const styles = StyleSheet . create ( {
328
+ touchable : {
329
+ cursor : 'pointer' ,
330
+ } ,
331
+ } ) ;
332
+
339
333
const Touchable = ( React . forwardRef ( ( props , ref ) => (
340
334
< TouchableOpacity { ...props } hostRef = { ref } />
341
335
) ) : React . AbstractComponent < Props , React . ElementRef < typeof Animated . View >> ) ;
0 commit comments