mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-28 20:25:33 +08:00
Implements blurOnSubmit
Summary: The default value (to retain current behavior) is set to `true`. Setting the value to `false` will prevent the textField from blurring but still fire the `onSubmitEditing` callback. However, the `onEndEditing` callback will not be fired. Addresses issue: https://github.com/facebook/react-native/issues/2129 Closes https://github.com/facebook/react-native/pull/2149 Reviewed By: svcscm Differential Revision: D2619822 Pulled By: nicklockwood fb-gh-sync-id: 9a61152892f4afb5c6c53e7b38dffae13bc7e13f
This commit is contained in:
committed by
facebook-github-bot-6
parent
66f7feda4d
commit
7af752403e
@@ -47,6 +47,10 @@ if (Platform.OS === 'android') {
|
||||
var RCTTextField = requireNativeComponent('RCTTextField', null);
|
||||
}
|
||||
|
||||
type DefaultProps = {
|
||||
blurOnSubmit: boolean;
|
||||
};
|
||||
|
||||
type Event = Object;
|
||||
|
||||
/**
|
||||
@@ -283,6 +287,12 @@ var TextInput = React.createClass({
|
||||
* @platform ios
|
||||
*/
|
||||
selectTextOnFocus: PropTypes.bool,
|
||||
/**
|
||||
* If true, the text field will blur when submitted.
|
||||
* The default value is true.
|
||||
* @platform ios
|
||||
*/
|
||||
blurOnSubmit: PropTypes.bool,
|
||||
/**
|
||||
* Styles
|
||||
*/
|
||||
@@ -298,6 +308,12 @@ var TextInput = React.createClass({
|
||||
underlineColorAndroid: PropTypes.string,
|
||||
},
|
||||
|
||||
getDefaultProps: function(): DefaultProps {
|
||||
return {
|
||||
blurOnSubmit: true,
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* `NativeMethodsMixin` will look for this when invoking `setNativeProps`. We
|
||||
* make `this` look like an actual native component class.
|
||||
|
||||
Reference in New Issue
Block a user