[react-packager][streamline oss] Move open sourced JS source to react-native-github

This commit is contained in:
Spencer Ahrens
2015-02-19 20:10:52 -08:00
commit efae175a8e
434 changed files with 44658 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @providesModule TextInputState
*
* This class is responsible for coordinating the "focused"
* state for TextInputs. All calls relating to the keyboard
* should be funneled through here
*/
'use strict';
var RKUIManager = require('NativeModulesDeprecated').RKUIManager;
var TextInputState = {
/**
* Internal state
*/
_currentlyFocusedID: null,
/**
* Returns the ID of the currently focused text field, if one exists
* If no text field is focused it returns null
*/
currentlyFocusedField: function() {
return this._currentlyFocusedID;
},
/**
* @param {string} TextInputID id of the text field to focus
* Focuses the specified text field
* noop if the text field was already focused
*/
focusTextInput: function(textFieldID) {
if (this._currentlyFocusedID != textFieldID && textFieldID != null) {
this._currentlyFocusedID = textFieldID;
RKUIManager.focus(textFieldID);
}
},
/**
* @param {string} textFieldID id of the text field to focus
* Unfocuses the specified text field
* noop if it wasn't focused
*/
blurTextInput: function(textFieldID) {
if (this._currentlyFocusedID == textFieldID && textFieldID != null) {
this._currentlyFocusedID = null;
RKUIManager.blur(textFieldID);
}
}
};
module.exports = TextInputState;