Reviewed By: fred2028

Differential Revision: D5016368

fbshipit-source-id: 60fae5769f66bf94de6fa2fe75a509862270c401
This commit is contained in:
Jiajie Zhu 2017-05-08 10:52:31 -07:00 коммит произвёл Facebook Github Bot
Родитель 8e6bde30eb
Коммит bd004568d3
1 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -15,8 +15,8 @@
var ColorPropType = require('ColorPropType'); var ColorPropType = require('ColorPropType');
var NativeMethodsMixin = require('NativeMethodsMixin'); var NativeMethodsMixin = require('NativeMethodsMixin');
var React = require('React');
const PropTypes = require('prop-types'); const PropTypes = require('prop-types');
var React = require('React');
var ReactNativeViewAttributes = require('ReactNativeViewAttributes'); var ReactNativeViewAttributes = require('ReactNativeViewAttributes');
var StyleSheet = require('StyleSheet'); var StyleSheet = require('StyleSheet');
var TimerMixin = require('react-timer-mixin'); var TimerMixin = require('react-timer-mixin');
@ -137,16 +137,22 @@ var TouchableHighlight = React.createClass({
}, },
getInitialState: function() { getInitialState: function() {
this._isMounted = false;
return merge( return merge(
this.touchableGetInitialState(), this._computeSyntheticState(this.props) this.touchableGetInitialState(), this._computeSyntheticState(this.props)
); );
}, },
componentDidMount: function() { componentDidMount: function() {
this._isMounted = true;
ensurePositiveDelayProps(this.props); ensurePositiveDelayProps(this.props);
ensureComponentIsNative(this.refs[CHILD_REF]); ensureComponentIsNative(this.refs[CHILD_REF]);
}, },
componentWillMount: function() {
this._isMounted = false;
},
componentDidUpdate: function() { componentDidUpdate: function() {
ensureComponentIsNative(this.refs[CHILD_REF]); ensureComponentIsNative(this.refs[CHILD_REF]);
}, },
@ -216,7 +222,7 @@ var TouchableHighlight = React.createClass({
}, },
_showUnderlay: function() { _showUnderlay: function() {
if (!this.isMounted() || !this._hasPressHandler()) { if (!this._isMounted || !this._hasPressHandler()) {
return; return;
} }