diff --git a/Examples/UIExplorer/TextInputExample.android.js b/Examples/UIExplorer/TextInputExample.android.js
index 3652b974c..1a436a912 100644
--- a/Examples/UIExplorer/TextInputExample.android.js
+++ b/Examples/UIExplorer/TextInputExample.android.js
@@ -178,6 +178,60 @@ class TokenizedTextExample extends React.Component {
}
}
+var BlurOnSubmitExample = React.createClass({
+ focusNextField(nextField) {
+ this.refs[nextField].focus();
+ },
+
+ render: function() {
+ return (
+
+ this.focusNextField('2')}
+ />
+ this.focusNextField('3')}
+ />
+ this.focusNextField('4')}
+ />
+ this.focusNextField('5')}
+ />
+
+
+ );
+ }
+});
+
var styles = StyleSheet.create({
multiline: {
height: 60,
@@ -286,6 +340,10 @@ exports.examples = [
return {examples};
}
},
+ {
+ title: 'Blur on submit',
+ render: function(): ReactElement { return ; },
+ },
{
title: 'Event handling',
render: function(): ReactElement { return ; },
diff --git a/Libraries/Components/TextInput/TextInput.js b/Libraries/Components/TextInput/TextInput.js
index b2080a61f..2243ee4b4 100644
--- a/Libraries/Components/TextInput/TextInput.js
+++ b/Libraries/Components/TextInput/TextInput.js
@@ -283,7 +283,6 @@ var TextInput = React.createClass({
* multiline fields. Note that for multiline fields, setting blurOnSubmit
* to true means that pressing return will blur the field and trigger the
* onSubmitEditing event instead of inserting a newline into the field.
- * @platform ios
*/
blurOnSubmit: PropTypes.bool,
/**
@@ -505,6 +504,7 @@ var TextInput = React.createClass({
onTextInput={this._onTextInput}
onEndEditing={this.props.onEndEditing}
onSubmitEditing={this.props.onSubmitEditing}
+ blurOnSubmit={this.props.blurOnSubmit}
onLayout={this.props.onLayout}
password={this.props.password || this.props.secureTextEntry}
placeholder={this.props.placeholder}
diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java
index 58e3e5a56..14752e158 100644
--- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java
+++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java
@@ -67,6 +67,7 @@ public class ReactEditText extends EditText {
private @Nullable TextWatcherDelegator mTextWatcherDelegator;
private int mStagedInputType;
private boolean mContainsImages;
+ private boolean mBlurOnSubmit;
private @Nullable SelectionWatcher mSelectionWatcher;
private final InternalKeyListener mKeyListener;
@@ -84,6 +85,7 @@ public class ReactEditText extends EditText {
mNativeEventCount = 0;
mIsSettingTextFromJS = false;
mIsJSSettingFocus = false;
+ mBlurOnSubmit = true;
mListeners = null;
mTextWatcherDelegator = null;
mStagedInputType = getInputType();
@@ -179,6 +181,14 @@ public class ReactEditText extends EditText {
mSelectionWatcher = selectionWatcher;
}
+ public void setBlurOnSubmit(boolean blurOnSubmit) {
+ mBlurOnSubmit = blurOnSubmit;
+ }
+
+ public boolean getBlurOnSubmit() {
+ return mBlurOnSubmit;
+ }
+
/*protected*/ int getStagedInputType() {
return mStagedInputType;
}
diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java
index 2ac07ddc6..8376c2d6b 100644
--- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java
+++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java
@@ -181,6 +181,11 @@ public class ReactTextInputManager extends BaseViewManager