diff --git a/Examples/UIExplorer/TextInputExample.android.js b/Examples/UIExplorer/TextInputExample.android.js
index 5809d7121..2238111cd 100644
--- a/Examples/UIExplorer/TextInputExample.android.js
+++ b/Examples/UIExplorer/TextInputExample.android.js
@@ -531,4 +531,43 @@ exports.examples = [
return ;
}
},
+ {
+ title: 'Return key',
+ render: function() {
+ var returnKeyTypes = [
+ 'none',
+ 'go',
+ 'search',
+ 'send',
+ 'done',
+ 'previous',
+ 'next',
+ ];
+ var returnKeyLabels = [
+ 'Compile',
+ 'React Native',
+ ];
+ var examples = returnKeyTypes.map((type) => {
+ return (
+
+ );
+ });
+ var types = returnKeyLabels.map((type) => {
+ return (
+
+ );
+ });
+ return {examples}{types};
+ }
+ },
];
diff --git a/Libraries/Components/TextInput/TextInput.js b/Libraries/Components/TextInput/TextInput.js
index 1400f31f1..bbb665f60 100644
--- a/Libraries/Components/TextInput/TextInput.js
+++ b/Libraries/Components/TextInput/TextInput.js
@@ -120,6 +120,7 @@ var TextInput = React.createClass({
* Determines which keyboard to open, e.g.`numeric`.
*
* The following values work across platforms:
+ *
* - default
* - numeric
* - email-address
@@ -150,22 +151,54 @@ var TextInput = React.createClass({
'dark',
]),
/**
- * Determines how the return key should look.
- * @platform ios
+ * Determines how the return key should look. On Android you can also use
+ * `returnKeyLabel`.
+ *
+ * The following values work across platforms:
+ *
+ * - done
+ * - go
+ * - next
+ * - search
+ * - send
+ *
+ * The following values work on Android only:
+ *
+ * - none
+ * - previous
+ *
+ * The following values work on iOS only:
+ *
+ * - default
+ * - emergency-call
+ * - google
+ * - join
+ * - route
+ * - yahoo
*/
returnKeyType: PropTypes.oneOf([
- 'default',
+ // Cross-platform
+ 'done',
'go',
- 'google',
- 'join',
'next',
- 'route',
'search',
'send',
- 'yahoo',
- 'done',
+ // Android-only
+ 'none',
+ 'previous',
+ // iOS-only
+ 'default',
'emergency-call',
+ 'google',
+ 'join',
+ 'route',
+ 'yahoo',
]),
+ /**
+ * Sets the return key to the label. Use it instead of `returnKeyType`.
+ * @platform android
+ */
+ returnKeyLabel: PropTypes.string,
/**
* Limits the maximum number of characters that can be entered. Use this
* instead of implementing the logic in JS to avoid flicker.
@@ -531,6 +564,8 @@ var TextInput = React.createClass({
children={children}
editable={this.props.editable}
selectTextOnFocus={this.props.selectTextOnFocus}
+ returnKeyType={this.props.returnKeyType}
+ returnKeyLabel={this.props.returnKeyLabel}
/>;
return (
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 b6f589ad0..5564580ed 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
@@ -44,8 +44,8 @@ import com.facebook.react.uimanager.ViewProps;
import com.facebook.react.uimanager.annotations.ReactProp;
import com.facebook.react.uimanager.events.EventDispatcher;
import com.facebook.react.views.text.DefaultStyleValuesUtil;
-import com.facebook.react.views.text.TextInlineImageSpan;
import com.facebook.react.views.text.ReactTextUpdate;
+import com.facebook.react.views.text.TextInlineImageSpan;
/**
* Manages instances of TextInput.
@@ -431,6 +431,40 @@ public class ReactTextInputManager extends BaseViewManager