Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TimerMixin] Removing TimerMixin on TextInput #21522

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 7 additions & 4 deletions Libraries/Components/TextInput/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const StyleSheet = require('StyleSheet');
const Text = require('Text');
const TextAncestor = require('TextAncestor');
const TextInputState = require('TextInputState');
const TimerMixin = require('react-timer-mixin');
const TouchableWithoutFeedback = require('TouchableWithoutFeedback');
const UIManager = require('UIManager');

Expand Down Expand Up @@ -803,7 +802,7 @@ const TextInput = createReactClass({
* `NativeMethodsMixin` will look for this when invoking `setNativeProps`. We
* make `this` look like an actual native component class.
*/
mixins: [NativeMethodsMixin, TimerMixin],
mixins: [NativeMethodsMixin],

/**
* Returns `true` if the input is currently focused; `false` otherwise.
Expand All @@ -819,6 +818,7 @@ const TextInput = createReactClass({
_focusSubscription: (undefined: ?Function),
_lastNativeText: (undefined: ?string),
_lastNativeSelection: (undefined: ?Selection),
_rafId: (null: ?AnimationFrameID),

componentDidMount: function() {
this._lastNativeText = this.props.value;
Expand All @@ -833,7 +833,7 @@ const TextInput = createReactClass({
'focus',
el => {
if (this === el) {
this.requestAnimationFrame(this.focus);
this._rafId = requestAnimationFrame(this.focus);
} else if (this.isFocused()) {
this.blur();
}
Expand All @@ -844,7 +844,7 @@ const TextInput = createReactClass({
}
} else {
if (this.props.autoFocus) {
this.requestAnimationFrame(this.focus);
this._rafId = requestAnimationFrame(this.focus);
}
}
},
Expand All @@ -858,6 +858,9 @@ const TextInput = createReactClass({
if (tag != null) {
TextInputState.unregisterInput(tag);
}
if (this._rafId != null) {
cancelAnimationFrame(this._rafId);
}
},

contextTypes: {
Expand Down