Skip to content
Permalink
Browse files

Bring back TextInput.State, deprecate focusTextInput and blurTextInput

Summary:
a275eac removed TextInput.State but we should keep it as it was a public-ish API and we don't have any migration plan off it. Also bring back `focusTextInput` and `blurTextInput` with a deprecation warning.

Tested TextInput.State is back

[GENERAL][ENHANCEMENT][TextInput] - Bring back TextInput.State, deprecate focusTextInput and blurTextInput
Closes #18936

Differential Revision: D8044439

Pulled By: hramos

fbshipit-source-id: fde145f04bb1d46ef58b5954cb7963adf495b21c
  • Loading branch information...
janicduplessis authored and facebook-github-bot committed May 17, 2018
1 parent 4e1453e commit ce3b7b8204dad0fd62a76a0ce66472eca4b25bc8
Showing with 17 additions and 1 deletion.
  1. +17 −1 Libraries/Components/TextInput/TextInput.js
@@ -325,7 +325,23 @@ type Props = $ReadOnly<{|

const TextInput = createReactClass({
displayName: 'TextInput',

statics: {
State: {
currentlyFocusedField: TextInputState.currentlyFocusedField,
focusTextInput: (textFieldID: ?number) => {
console.warn(
'`focusTextInput` is deprecated, use the `focus` method of the `TextInput` ref instead.',
);
TextInputState.focusTextInput(textFieldID);
},
blurTextInput: (textFieldID: ?number) => {
console.warn(
'`blurTextInput` is deprecated, use `Keyboard.dismiss` or the `blur` method of the `TextInput` ref.',
);
TextInputState.blurTextInput(textFieldID);
},
},
},
propTypes: {
...ViewPropTypes,
/**

0 comments on commit ce3b7b8

Please sign in to comment.
You can’t perform that action at this time.