Type TouchableWithoutFeedback
Reviewed By: yungsters Differential Revision: D7982348 fbshipit-source-id: 409ce4a5ea8c09e58c42caf9db60117253503c4c
This commit is contained in:
parent
91c4b0357a
commit
0b79d1faa2
|
@ -32,9 +32,41 @@ const {
|
||||||
} = require('ViewAccessibility');
|
} = require('ViewAccessibility');
|
||||||
|
|
||||||
import type {PressEvent} from 'CoreEventTypes';
|
import type {PressEvent} from 'CoreEventTypes';
|
||||||
|
import type {EdgeInsetsProp} from 'EdgeInsetsPropType';
|
||||||
|
import type {
|
||||||
|
AccessibilityComponentType,
|
||||||
|
AccessibilityTrait,
|
||||||
|
} from 'ViewAccessibility';
|
||||||
|
|
||||||
const PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
|
const PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
|
||||||
|
|
||||||
|
type Props = $ReadOnly<{|
|
||||||
|
accessible?: boolean,
|
||||||
|
accessibilityComponentType?: AccessibilityComponentType,
|
||||||
|
accessibilityLabel?:
|
||||||
|
| null
|
||||||
|
| React$PropType$Primitive<any>
|
||||||
|
| string
|
||||||
|
| Array<any>
|
||||||
|
| any,
|
||||||
|
accessibilityTraits?: AccessibilityTrait | Array<AccessibilityTrait>,
|
||||||
|
children?: ?React.Node,
|
||||||
|
delayLongPress?: ?number,
|
||||||
|
delayPressIn?: ?number,
|
||||||
|
delayPressOut?: ?number,
|
||||||
|
disabled?: ?boolean,
|
||||||
|
hitSlop?: ?EdgeInsetsProp,
|
||||||
|
nativeID?: ?string,
|
||||||
|
onLayout?: ?Function,
|
||||||
|
onLongPress?: ?Function,
|
||||||
|
onPress?: ?Function,
|
||||||
|
onPressIn?: ?Function,
|
||||||
|
onPressOut?: ?Function,
|
||||||
|
pressRetentionOffset?: ?EdgeInsetsProp,
|
||||||
|
rejectResponderTermination?: ?boolean,
|
||||||
|
testID?: ?string,
|
||||||
|
|}>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do not use unless you have a very good reason. All elements that
|
* Do not use unless you have a very good reason. All elements that
|
||||||
* respond to press should have a visual feedback when touched.
|
* respond to press should have a visual feedback when touched.
|
||||||
|
@ -42,12 +74,13 @@ const PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
|
||||||
* TouchableWithoutFeedback supports only one child.
|
* TouchableWithoutFeedback supports only one child.
|
||||||
* If you wish to have several child components, wrap them in a View.
|
* If you wish to have several child components, wrap them in a View.
|
||||||
*/
|
*/
|
||||||
const TouchableWithoutFeedback = createReactClass({
|
const TouchableWithoutFeedback = ((createReactClass({
|
||||||
displayName: 'TouchableWithoutFeedback',
|
displayName: 'TouchableWithoutFeedback',
|
||||||
mixins: [TimerMixin, Touchable.Mixin],
|
mixins: [TimerMixin, Touchable.Mixin],
|
||||||
|
|
||||||
propTypes: {
|
propTypes: {
|
||||||
accessible: PropTypes.bool,
|
accessible: PropTypes.bool,
|
||||||
|
accessibilityLabel: PropTypes.node,
|
||||||
accessibilityComponentType: PropTypes.oneOf(AccessibilityComponentTypes),
|
accessibilityComponentType: PropTypes.oneOf(AccessibilityComponentTypes),
|
||||||
accessibilityTraits: PropTypes.oneOfType([
|
accessibilityTraits: PropTypes.oneOfType([
|
||||||
PropTypes.oneOf(AccessibilityTraits),
|
PropTypes.oneOf(AccessibilityTraits),
|
||||||
|
@ -80,6 +113,9 @@ const TouchableWithoutFeedback = createReactClass({
|
||||||
|
|
||||||
onLongPress: PropTypes.func,
|
onLongPress: PropTypes.func,
|
||||||
|
|
||||||
|
nativeID: PropTypes.string,
|
||||||
|
testID: PropTypes.string,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delay in ms, from the start of the touch, before onPressIn is called.
|
* Delay in ms, from the start of the touch, before onPressIn is called.
|
||||||
*/
|
*/
|
||||||
|
@ -195,13 +231,10 @@ const TouchableWithoutFeedback = createReactClass({
|
||||||
: child.props.style;
|
: child.props.style;
|
||||||
return (React: any).cloneElement(child, {
|
return (React: any).cloneElement(child, {
|
||||||
accessible: this.props.accessible !== false,
|
accessible: this.props.accessible !== false,
|
||||||
// $FlowFixMe Invalid prop usage
|
|
||||||
accessibilityLabel: this.props.accessibilityLabel,
|
accessibilityLabel: this.props.accessibilityLabel,
|
||||||
accessibilityComponentType: this.props.accessibilityComponentType,
|
accessibilityComponentType: this.props.accessibilityComponentType,
|
||||||
accessibilityTraits: this.props.accessibilityTraits,
|
accessibilityTraits: this.props.accessibilityTraits,
|
||||||
// $FlowFixMe Invalid prop usage
|
|
||||||
nativeID: this.props.nativeID,
|
nativeID: this.props.nativeID,
|
||||||
// $FlowFixMe Invalid prop usage
|
|
||||||
testID: this.props.testID,
|
testID: this.props.testID,
|
||||||
onLayout: this.props.onLayout,
|
onLayout: this.props.onLayout,
|
||||||
hitSlop: this.props.hitSlop,
|
hitSlop: this.props.hitSlop,
|
||||||
|
@ -216,6 +249,6 @@ const TouchableWithoutFeedback = createReactClass({
|
||||||
children,
|
children,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
}): any): React.ComponentType<Props>);
|
||||||
|
|
||||||
module.exports = TouchableWithoutFeedback;
|
module.exports = TouchableWithoutFeedback;
|
||||||
|
|
Loading…
Reference in New Issue