Skip to content

Commit 0b79d1f

Browse files
elicwhitefacebook-github-bot
authored andcommittedMay 13, 2018
Type TouchableWithoutFeedback
Reviewed By: yungsters Differential Revision: D7982348 fbshipit-source-id: 409ce4a5ea8c09e58c42caf9db60117253503c4c
1 parent 91c4b03 commit 0b79d1f

File tree

1 file changed

+38
-5
lines changed

1 file changed

+38
-5
lines changed
 

‎Libraries/Components/Touchable/TouchableWithoutFeedback.js

+38-5
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,55 @@ const {
3232
} = require('ViewAccessibility');
3333

3434
import type {PressEvent} from 'CoreEventTypes';
35+
import type {EdgeInsetsProp} from 'EdgeInsetsPropType';
36+
import type {
37+
AccessibilityComponentType,
38+
AccessibilityTrait,
39+
} from 'ViewAccessibility';
3540

3641
const PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
3742

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+
3870
/**
3971
* Do not use unless you have a very good reason. All elements that
4072
* respond to press should have a visual feedback when touched.
4173
*
4274
* TouchableWithoutFeedback supports only one child.
4375
* If you wish to have several child components, wrap them in a View.
4476
*/
45-
const TouchableWithoutFeedback = createReactClass({
77+
const TouchableWithoutFeedback = ((createReactClass({
4678
displayName: 'TouchableWithoutFeedback',
4779
mixins: [TimerMixin, Touchable.Mixin],
4880

4981
propTypes: {
5082
accessible: PropTypes.bool,
83+
accessibilityLabel: PropTypes.node,
5184
accessibilityComponentType: PropTypes.oneOf(AccessibilityComponentTypes),
5285
accessibilityTraits: PropTypes.oneOfType([
5386
PropTypes.oneOf(AccessibilityTraits),
@@ -80,6 +113,9 @@ const TouchableWithoutFeedback = createReactClass({
80113

81114
onLongPress: PropTypes.func,
82115

116+
nativeID: PropTypes.string,
117+
testID: PropTypes.string,
118+
83119
/**
84120
* Delay in ms, from the start of the touch, before onPressIn is called.
85121
*/
@@ -195,13 +231,10 @@ const TouchableWithoutFeedback = createReactClass({
195231
: child.props.style;
196232
return (React: any).cloneElement(child, {
197233
accessible: this.props.accessible !== false,
198-
// $FlowFixMe Invalid prop usage
199234
accessibilityLabel: this.props.accessibilityLabel,
200235
accessibilityComponentType: this.props.accessibilityComponentType,
201236
accessibilityTraits: this.props.accessibilityTraits,
202-
// $FlowFixMe Invalid prop usage
203237
nativeID: this.props.nativeID,
204-
// $FlowFixMe Invalid prop usage
205238
testID: this.props.testID,
206239
onLayout: this.props.onLayout,
207240
hitSlop: this.props.hitSlop,
@@ -216,6 +249,6 @@ const TouchableWithoutFeedback = createReactClass({
216249
children,
217250
});
218251
},
219-
});
252+
}): any): React.ComponentType<Props>);
220253

221254
module.exports = TouchableWithoutFeedback;

0 commit comments

Comments
 (0)
Please sign in to comment.