mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-24 07:09:03 +00:00
[change] TextInput support for autoCorrect and autoComplete
This commit is contained in:
@@ -29,13 +29,18 @@ Automatically capitalize certain characters (only available in Chrome and iOS Sa
|
|||||||
* `sentences`: Automatically capitalize the first letter of sentences.
|
* `sentences`: Automatically capitalize the first letter of sentences.
|
||||||
* `words`: Automatically capitalize the first letter of words.
|
* `words`: Automatically capitalize the first letter of words.
|
||||||
|
|
||||||
(web) **autoComplete**: bool = false
|
(web) **autoComplete**: string
|
||||||
|
|
||||||
Indicates whether the value of the control can be automatically completed by the browser.
|
Indicates whether the value of the control can be automatically completed by
|
||||||
|
the browser. [Accepted values](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
|
||||||
|
|
||||||
|
**autoCorrect**: bool = true
|
||||||
|
|
||||||
|
Automatically correct spelling mistakes (only available in iOS Safari).
|
||||||
|
|
||||||
**autoFocus**: bool = false
|
**autoFocus**: bool = false
|
||||||
|
|
||||||
If true, focuses the input on `componentDidMount`. Only the first form element
|
If `true`, focuses the input on `componentDidMount`. Only the first form element
|
||||||
in a document with `autofocus` is focused.
|
in a document with `autofocus` is focused.
|
||||||
|
|
||||||
**clearTextOnFocus**: bool = false
|
**clearTextOnFocus**: bool = false
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ class TextInput extends Component {
|
|||||||
static propTypes = {
|
static propTypes = {
|
||||||
...View.propTypes,
|
...View.propTypes,
|
||||||
autoCapitalize: PropTypes.oneOf([ 'characters', 'none', 'sentences', 'words' ]),
|
autoCapitalize: PropTypes.oneOf([ 'characters', 'none', 'sentences', 'words' ]),
|
||||||
autoComplete: PropTypes.bool,
|
autoComplete: PropTypes.string,
|
||||||
|
autoCorrect: PropTypes.bool,
|
||||||
autoFocus: PropTypes.bool,
|
autoFocus: PropTypes.bool,
|
||||||
clearTextOnFocus: PropTypes.bool,
|
clearTextOnFocus: PropTypes.bool,
|
||||||
defaultValue: PropTypes.string,
|
defaultValue: PropTypes.string,
|
||||||
@@ -49,6 +50,8 @@ class TextInput extends Component {
|
|||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
autoCapitalize: 'sentences',
|
autoCapitalize: 'sentences',
|
||||||
|
autoComplete: 'on',
|
||||||
|
autoCorrect: true,
|
||||||
editable: true,
|
editable: true,
|
||||||
keyboardType: 'default',
|
keyboardType: 'default',
|
||||||
multiline: false,
|
multiline: false,
|
||||||
@@ -87,6 +90,7 @@ class TextInput extends Component {
|
|||||||
accessibilityLabel, // eslint-disable-line
|
accessibilityLabel, // eslint-disable-line
|
||||||
autoCapitalize,
|
autoCapitalize,
|
||||||
autoComplete,
|
autoComplete,
|
||||||
|
autoCorrect,
|
||||||
autoFocus,
|
autoFocus,
|
||||||
defaultValue,
|
defaultValue,
|
||||||
editable,
|
editable,
|
||||||
@@ -142,7 +146,8 @@ class TextInput extends Component {
|
|||||||
|
|
||||||
const propsCommon = {
|
const propsCommon = {
|
||||||
autoCapitalize,
|
autoCapitalize,
|
||||||
autoComplete: autoComplete && 'on',
|
autoComplete,
|
||||||
|
autoCorrect: autoCorrect ? 'on' : 'off',
|
||||||
autoFocus,
|
autoFocus,
|
||||||
defaultValue,
|
defaultValue,
|
||||||
maxLength,
|
maxLength,
|
||||||
|
|||||||
Reference in New Issue
Block a user