mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-06-01 01:59:10 +00:00
[add] TextInput support for autoCapitalize
This commit is contained in:
@@ -20,6 +20,15 @@ Unsupported React Native props:
|
|||||||
|
|
||||||
[...View props](./View.md)
|
[...View props](./View.md)
|
||||||
|
|
||||||
|
**autoCapitalize**: oneOf('characters', 'none', 'sentences', 'words') = 'sentences'
|
||||||
|
|
||||||
|
Automatically capitalize certain characters (only available in Chrome and iOS Safari).
|
||||||
|
|
||||||
|
* `characters`: Automatically capitalize all characters.
|
||||||
|
* `none`: Completely disables automatic capitalization
|
||||||
|
* `sentences`: Automatically capitalize the first letter of sentences.
|
||||||
|
* `words`: Automatically capitalize the first letter of words.
|
||||||
|
|
||||||
(web) **autoComplete**: bool = false
|
(web) **autoComplete**: bool = false
|
||||||
|
|
||||||
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.
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ class TextInput extends Component {
|
|||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
...View.propTypes,
|
...View.propTypes,
|
||||||
|
autoCapitalize: PropTypes.oneOf([ 'characters', 'none', 'sentences', 'words' ]),
|
||||||
autoComplete: PropTypes.bool,
|
autoComplete: PropTypes.bool,
|
||||||
autoFocus: PropTypes.bool,
|
autoFocus: PropTypes.bool,
|
||||||
clearTextOnFocus: PropTypes.bool,
|
clearTextOnFocus: PropTypes.bool,
|
||||||
@@ -47,6 +48,7 @@ class TextInput extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
|
autoCapitalize: 'sentences',
|
||||||
editable: true,
|
editable: true,
|
||||||
keyboardType: 'default',
|
keyboardType: 'default',
|
||||||
multiline: false,
|
multiline: false,
|
||||||
@@ -83,6 +85,7 @@ class TextInput extends Component {
|
|||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
accessibilityLabel, // eslint-disable-line
|
accessibilityLabel, // eslint-disable-line
|
||||||
|
autoCapitalize,
|
||||||
autoComplete,
|
autoComplete,
|
||||||
autoFocus,
|
autoFocus,
|
||||||
defaultValue,
|
defaultValue,
|
||||||
@@ -138,6 +141,7 @@ class TextInput extends Component {
|
|||||||
const textStyles = omit(flattenedStyle, viewStyleProps);
|
const textStyles = omit(flattenedStyle, viewStyleProps);
|
||||||
|
|
||||||
const propsCommon = {
|
const propsCommon = {
|
||||||
|
autoCapitalize,
|
||||||
autoComplete: autoComplete && 'on',
|
autoComplete: autoComplete && 'on',
|
||||||
autoFocus,
|
autoFocus,
|
||||||
defaultValue,
|
defaultValue,
|
||||||
|
|||||||
Reference in New Issue
Block a user