mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-24 07:09:03 +00:00
[add] TextInput disabled prop
Add support for disabling TextInput elements Fix #1036
This commit is contained in:
@@ -11,6 +11,7 @@ ofProps.propTypes = {
|
||||
blurOnSubmit: PropTypes.bool,
|
||||
clearTextOnFocus: PropTypes.bool,
|
||||
defaultValue: PropTypes.string,
|
||||
disabled: PropTypes.bool,
|
||||
editable: PropTypes.bool,
|
||||
keyboardType: PropTypes.string,
|
||||
maxLength: PropTypes.number,
|
||||
@@ -52,6 +53,7 @@ export { default as autoCapitalize } from './examples/AutoCapitalize';
|
||||
export { default as blurOnSubmit } from './examples/BlurOnSubmit';
|
||||
export { default as clearButtonMode } from './examples/ClearButtonMode';
|
||||
export { default as clearTextOnFocus } from './examples/ClearTextOnFocus';
|
||||
export { default as disabled } from './examples/Disabled';
|
||||
export { default as editable } from './examples/Editable';
|
||||
export { default as keyboardType } from './examples/KeyboardType';
|
||||
export { default as maxLength } from './examples/MaxLength';
|
||||
|
||||
@@ -56,7 +56,7 @@ into the field.
|
||||
</Story>
|
||||
</Preview>
|
||||
|
||||
### clearTextOnFocus: ?boolean = false
|
||||
### clearTextOnFocus
|
||||
|
||||
If `true`, clears the text field automatically when focused.
|
||||
|
||||
@@ -72,6 +72,16 @@ Provides an initial value that will change when the user starts typing. Useful
|
||||
for simple use-cases where you don't want to deal with listening to events and
|
||||
updating the value prop to keep the controlled state in sync.
|
||||
|
||||
### disabled
|
||||
|
||||
If `true`, the input is disabled. (Web-only)
|
||||
|
||||
<Preview withSource='none'>
|
||||
<Story name="disabled">
|
||||
<Stories.disabled />
|
||||
</Story>
|
||||
</Preview>
|
||||
|
||||
### editable
|
||||
|
||||
If `false`, text is not editable (i.e., read-only).
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import React from 'react';
|
||||
import { styles } from '../helpers';
|
||||
import { TextInput, View } from 'react-native';
|
||||
|
||||
export default function Disabled() {
|
||||
return (
|
||||
<View>
|
||||
<TextInput defaultValue="disabled text input" disabled={true} style={styles.textinput} />
|
||||
<TextInput
|
||||
defaultValue="disabled multiline text input"
|
||||
disabled={true}
|
||||
multiline={true}
|
||||
style={styles.multiline}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user