Skip to content

Commit

Permalink
Bring back TextInput.State, deprecate focusTextInput and blurTextInput
Browse files Browse the repository at this point in the history
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 ce3b7b8
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion Libraries/Components/TextInput/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
/**
Expand Down

0 comments on commit ce3b7b8

Please sign in to comment.