Bring back TextInput.State, deprecate focusTextInput and blurTextInput

Summary:
a275eac56e 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 https://github.com/facebook/react-native/pull/18936

Differential Revision: D8044439

Pulled By: hramos

fbshipit-source-id: fde145f04bb1d46ef58b5954cb7963adf495b21c
This commit is contained in:
Janic Duplessis 2018-05-17 11:18:36 -07:00 committed by Facebook Github Bot
parent 4e1453eb01
commit ce3b7b8204
1 changed files with 17 additions and 1 deletions

View File

@ -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,
/**