mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 11:34:23 +00:00
[ReactNative] Clean up Touchable PropTypes
Summary: Summary: Instead of having a separate TouchablePropTypes, put those in TouchableWithoutFeedback and have the other ones use ...TouchableWithoutFeedback.propTypes. This makes it work with the docs parsing. Closes https://github.com/facebook/react-native/pull/159 Github Author: Christopher Chedeau <vjeux@fb.com> Test Plan: Run the website, make sure all the touchable components have the right prop types CC: Task ID: #
This commit is contained in:
parent
e07c8db607
commit
f377849c73
@ -1,22 +0,0 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
*
|
||||
* @providesModule TouchableFeedbackPropType
|
||||
* @flow
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var { PropTypes } = require('React');
|
||||
|
||||
var TouchableFeedbackPropType = {
|
||||
/**
|
||||
* Called when the touch is released, but not if cancelled (e.g. by a scroll
|
||||
* that steals the responder lock).
|
||||
*/
|
||||
onPress: PropTypes.func,
|
||||
onPressIn: PropTypes.func,
|
||||
onPressOut: PropTypes.func,
|
||||
onLongPress: PropTypes.func,
|
||||
};
|
||||
|
||||
module.exports = TouchableFeedbackPropType;
|
@ -11,7 +11,7 @@ var ReactIOSViewAttributes = require('ReactIOSViewAttributes');
|
||||
var StyleSheet = require('StyleSheet');
|
||||
var TimerMixin = require('TimerMixin');
|
||||
var Touchable = require('Touchable');
|
||||
var TouchableFeedbackPropType = require('TouchableFeedbackPropType');
|
||||
var TouchableWithoutFeedback = require('TouchableWithoutFeedback');
|
||||
var View = require('View');
|
||||
|
||||
var cloneWithProps = require('cloneWithProps');
|
||||
@ -51,12 +51,7 @@ var DEFAULT_PROPS = {
|
||||
|
||||
var TouchableHighlight = React.createClass({
|
||||
propTypes: {
|
||||
...TouchableFeedbackPropType,
|
||||
/**
|
||||
* Called when the touch is released, but not if cancelled (e.g. by
|
||||
* a scroll that steals the responder lock).
|
||||
*/
|
||||
onPress: React.PropTypes.func.isRequired,
|
||||
...TouchableWithoutFeedback.propTypes,
|
||||
/**
|
||||
* Determines what the opacity of the wrapped view should be when touch is
|
||||
* active.
|
||||
|
@ -9,7 +9,7 @@ var NativeMethodsMixin = require('NativeMethodsMixin');
|
||||
var POPAnimationMixin = require('POPAnimationMixin');
|
||||
var React = require('React');
|
||||
var Touchable = require('Touchable');
|
||||
var TouchableFeedbackPropType = require('TouchableFeedbackPropType');
|
||||
var TouchableWithoutFeedback = require('TouchableWithoutFeedback');
|
||||
|
||||
var cloneWithProps = require('cloneWithProps');
|
||||
var ensureComponentIsNative = require('ensureComponentIsNative');
|
||||
@ -42,7 +42,7 @@ var TouchableOpacity = React.createClass({
|
||||
mixins: [Touchable.Mixin, NativeMethodsMixin, POPAnimationMixin],
|
||||
|
||||
propTypes: {
|
||||
...TouchableFeedbackPropType,
|
||||
...TouchableWithoutFeedback.propTypes,
|
||||
/**
|
||||
* Determines what the opacity of the wrapped view should be when touch is
|
||||
* active.
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
var React = require('React');
|
||||
var Touchable = require('Touchable');
|
||||
var TouchableFeedbackPropType = require('TouchableFeedbackPropType');
|
||||
|
||||
var onlyChild = require('onlyChild');
|
||||
|
||||
@ -28,7 +27,16 @@ var PRESS_RECT_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
|
||||
var TouchableWithoutFeedback = React.createClass({
|
||||
mixins: [Touchable.Mixin],
|
||||
|
||||
propTypes: TouchableFeedbackPropType,
|
||||
propTypes: {
|
||||
/**
|
||||
* Called when the touch is released, but not if cancelled (e.g. by a scroll
|
||||
* that steals the responder lock).
|
||||
*/
|
||||
onPress: React.PropTypes.func,
|
||||
onPressIn: React.PropTypes.func,
|
||||
onPressOut: React.PropTypes.func,
|
||||
onLongPress: React.PropTypes.func,
|
||||
},
|
||||
|
||||
getInitialState: function() {
|
||||
return this.touchableGetInitialState();
|
||||
|
Loading…
x
Reference in New Issue
Block a user