Skip to content

Commit

Permalink
TextInput: Remove use of legacy context API (#22220)
Browse files Browse the repository at this point in the history
Summary:
This removes the use of the legacy context API in `TextInput`.

Nothing in OSS appears to make use of the `focusEmitter`.
Pull Request resolved: #22220

Reviewed By: TheSavior

Differential Revision: D13408886

Pulled By: RSNara

fbshipit-source-id: 9ae597507ccc26a9bc944a44c1f51b91e73cd637
  • Loading branch information
empyrical authored and facebook-github-bot committed Dec 26, 2018
1 parent 193615a commit 94456ed
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions Libraries/Components/TextInput/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
const DeprecatedColorPropType = require('DeprecatedColorPropType');
const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes');
const DocumentSelectionState = require('DocumentSelectionState');
const EventEmitter = require('EventEmitter');
const NativeMethodsMixin = require('NativeMethodsMixin');
const Platform = require('Platform');
const PropTypes = require('prop-types');
Expand Down Expand Up @@ -892,26 +891,6 @@ const TextInput = createReactClass({
// tag is null only in unit tests
TextInputState.registerInput(tag);
}

if (this.context.focusEmitter) {
this._focusSubscription = this.context.focusEmitter.addListener(
'focus',
el => {
if (this === el) {
this._rafId = requestAnimationFrame(this.focus);
} else if (this.isFocused()) {
this.blur();
}
},
);
if (this.props.autoFocus) {
this.context.onFocusRequested(this);
}
} else {
if (this.props.autoFocus) {
this._rafId = requestAnimationFrame(this.focus);
}
}
},

componentWillUnmount: function() {
Expand All @@ -928,11 +907,6 @@ const TextInput = createReactClass({
}
},

contextTypes: {
onFocusRequested: PropTypes.func,
focusEmitter: PropTypes.instanceOf(EventEmitter),
},

/**
* Removes all text from the `TextInput`.
*/
Expand Down

0 comments on commit 94456ed

Please sign in to comment.