@@ -32,22 +32,55 @@ const {
32
32
} = require ( 'ViewAccessibility' ) ;
33
33
34
34
import type { PressEvent } from 'CoreEventTypes' ;
35
+ import type { EdgeInsetsProp } from 'EdgeInsetsPropType' ;
36
+ import type {
37
+ AccessibilityComponentType ,
38
+ AccessibilityTrait ,
39
+ } from 'ViewAccessibility' ;
35
40
36
41
const PRESS_RETENTION_OFFSET = { top : 20 , left : 20 , right : 20 , bottom : 30 } ;
37
42
43
+ type Props = $ReadOnly < { |
44
+ accessible ?: boolean ,
45
+ accessibilityComponentType ?: AccessibilityComponentType ,
46
+ accessibilityLabel ?:
47
+ | null
48
+ | React$PropType$Primitive < any >
49
+ | string
50
+ | Array < any >
51
+ | any ,
52
+ accessibilityTraits ?: AccessibilityTrait | Array < AccessibilityTrait > ,
53
+ children ?: ?React . Node ,
54
+ delayLongPress ?: ?number ,
55
+ delayPressIn ?: ?number ,
56
+ delayPressOut ?: ?number ,
57
+ disabled ?: ?boolean ,
58
+ hitSlop ?: ?EdgeInsetsProp ,
59
+ nativeID ?: ?string ,
60
+ onLayout ?: ?Function ,
61
+ onLongPress ?: ?Function ,
62
+ onPress ?: ?Function ,
63
+ onPressIn ?: ?Function ,
64
+ onPressOut ?: ?Function ,
65
+ pressRetentionOffset ?: ?EdgeInsetsProp ,
66
+ rejectResponderTermination ?: ?boolean ,
67
+ testID ?: ?string ,
68
+ | } > ;
69
+
38
70
/**
39
71
* Do not use unless you have a very good reason. All elements that
40
72
* respond to press should have a visual feedback when touched.
41
73
*
42
74
* TouchableWithoutFeedback supports only one child.
43
75
* If you wish to have several child components, wrap them in a View.
44
76
*/
45
- const TouchableWithoutFeedback = createReactClass ( {
77
+ const TouchableWithoutFeedback = ( ( createReactClass ( {
46
78
displayName : 'TouchableWithoutFeedback' ,
47
79
mixins : [ TimerMixin , Touchable . Mixin ] ,
48
80
49
81
propTypes : {
50
82
accessible : PropTypes . bool ,
83
+ accessibilityLabel : PropTypes . node ,
51
84
accessibilityComponentType : PropTypes . oneOf ( AccessibilityComponentTypes ) ,
52
85
accessibilityTraits : PropTypes . oneOfType ( [
53
86
PropTypes . oneOf ( AccessibilityTraits ) ,
@@ -80,6 +113,9 @@ const TouchableWithoutFeedback = createReactClass({
80
113
81
114
onLongPress : PropTypes . func ,
82
115
116
+ nativeID : PropTypes . string ,
117
+ testID : PropTypes . string ,
118
+
83
119
/**
84
120
* Delay in ms, from the start of the touch, before onPressIn is called.
85
121
*/
@@ -195,13 +231,10 @@ const TouchableWithoutFeedback = createReactClass({
195
231
: child . props . style ;
196
232
return ( React : any ) . cloneElement ( child , {
197
233
accessible : this . props . accessible !== false ,
198
- // $FlowFixMe Invalid prop usage
199
234
accessibilityLabel : this . props . accessibilityLabel ,
200
235
accessibilityComponentType : this . props . accessibilityComponentType ,
201
236
accessibilityTraits : this . props . accessibilityTraits ,
202
- // $FlowFixMe Invalid prop usage
203
237
nativeID : this . props . nativeID ,
204
- // $FlowFixMe Invalid prop usage
205
238
testID : this . props . testID ,
206
239
onLayout : this . props . onLayout ,
207
240
hitSlop : this . props . hitSlop ,
@@ -216,6 +249,6 @@ const TouchableWithoutFeedback = createReactClass({
216
249
children,
217
250
} ) ;
218
251
} ,
219
- } ) ;
252
+ } ) : any ) : React . ComponentType < Props > ) ;
220
253
221
254
module . exports = TouchableWithoutFeedback ;
0 commit comments