fix warnings in create view

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 committed by Facebook Github Bot
parent 8e6bde30eb
commit bd004568d3
1 changed files with 8 additions and 2 deletions

View File

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