mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-27 06:12:24 +08:00
[react-native] Codemod .getNodeHandle, .getNativeNode to React.findNodeHandle
This commit is contained in:
committed by
Christopher Chedeau
parent
a2f73b4d77
commit
a0440daf98
@@ -305,7 +305,7 @@ var TextInput = React.createClass({
|
||||
|
||||
isFocused: function(): boolean {
|
||||
return TextInputState.currentlyFocusedField() ===
|
||||
this.refs.input.getNativeNode();
|
||||
React.findNodeHandle(this.refs.input);
|
||||
},
|
||||
|
||||
getDefaultProps: function(): DefaultProps {
|
||||
|
||||
@@ -21,22 +21,22 @@ var TextInputState = {
|
||||
/**
|
||||
* Internal state
|
||||
*/
|
||||
_currentlyFocusedID: (null: ?string),
|
||||
_currentlyFocusedID: (null: ?number),
|
||||
|
||||
/**
|
||||
* Returns the ID of the currently focused text field, if one exists
|
||||
* If no text field is focused it returns null
|
||||
*/
|
||||
currentlyFocusedField: function(): ?string {
|
||||
currentlyFocusedField: function(): ?number {
|
||||
return this._currentlyFocusedID;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {string} TextInputID id of the text field to focus
|
||||
* @param {number} TextInputID id of the text field to focus
|
||||
* Focuses the specified text field
|
||||
* noop if the text field was already focused
|
||||
*/
|
||||
focusTextInput: function(textFieldID: string) {
|
||||
focusTextInput: function(textFieldID: ?number) {
|
||||
if (this._currentlyFocusedID !== textFieldID && textFieldID !== null) {
|
||||
this._currentlyFocusedID = textFieldID;
|
||||
RCTUIManager.focus(textFieldID);
|
||||
@@ -44,11 +44,11 @@ var TextInputState = {
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {string} textFieldID id of the text field to focus
|
||||
* @param {number} textFieldID id of the text field to focus
|
||||
* Unfocuses the specified text field
|
||||
* noop if it wasn't focused
|
||||
*/
|
||||
blurTextInput: function(textFieldID: string) {
|
||||
blurTextInput: function(textFieldID: ?number) {
|
||||
if (this._currentlyFocusedID === textFieldID && textFieldID !== null) {
|
||||
this._currentlyFocusedID = null;
|
||||
RCTUIManager.blur(textFieldID);
|
||||
|
||||
Reference in New Issue
Block a user