[ReactNative] Remove Subscribable from TextInput

This commit is contained in:
Eric Vicenti 2015-03-11 14:45:49 -07:00
parent 2424711a03
commit 65ba4c68c0
1 changed files with 14 additions and 8 deletions

View File

@ -14,7 +14,6 @@ var React = require('React');
var ReactChildren = require('ReactChildren');
var ReactIOSViewAttributes = require('ReactIOSViewAttributes');
var StyleSheet = require('StyleSheet');
var Subscribable = require('Subscribable');
var Text = require('Text');
var TextInputState = require('TextInputState');
var TimerMixin = require('TimerMixin');
@ -195,7 +194,7 @@ var TextInput = React.createClass({
* `NativeMethodsMixin` will look for this when invoking `setNativeProps`. We
* make `this` look like an actual native component class.
*/
mixins: [NativeMethodsMixin, TimerMixin, Subscribable.Mixin],
mixins: [NativeMethodsMixin, TimerMixin],
viewConfig: {
uiViewClassName: 'RCTTextField',
@ -232,18 +231,25 @@ var TextInput = React.createClass({
}
return;
}
this.addListenerOn(this.context.focusEmitter, 'focus', (el) => {
if (this === el) {
this.requestAnimationFrame(this.focus);
} else if (this.isFocused()) {
this.blur();
this._focusSubscription = this.context.focusEmitter.addListener(
'focus',
(el) => {
if (this === el) {
this.requestAnimationFrame(this.focus);
} else if (this.isFocused()) {
this.blur();
}
}
});
);
if (this.props.autoFocus) {
this.context.onFocusRequested(this);
}
},
componentWillUnmount: function() {
this._focusSubscription && this._focusSubscription.remove();
},
componentWillReceiveProps: function(newProps) {
if (newProps.value !== this.props.value) {
if (!this.isFocused()) {