mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-31 09:44:21 +00:00
@@ -87,6 +87,11 @@ as an argument to the callback handler.
|
|||||||
|
|
||||||
Callback that is called when the text input is focused.
|
Callback that is called when the text input is focused.
|
||||||
|
|
||||||
|
**onKeyPress**: function
|
||||||
|
|
||||||
|
Callback that is called when a key is pressed. Pressed key value is passed as
|
||||||
|
an argument to the callback handler. Fires before `onChange` callbacks.
|
||||||
|
|
||||||
(web) **onSelectionChange**: function
|
(web) **onSelectionChange**: function
|
||||||
|
|
||||||
Callback that is called when the text input's selection changes. The following
|
Callback that is called when the text input's selection changes. The following
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ class TextInput extends Component {
|
|||||||
onChange: PropTypes.func,
|
onChange: PropTypes.func,
|
||||||
onChangeText: PropTypes.func,
|
onChangeText: PropTypes.func,
|
||||||
onFocus: PropTypes.func,
|
onFocus: PropTypes.func,
|
||||||
|
onKeyPress: PropTypes.func,
|
||||||
onSelectionChange: PropTypes.func,
|
onSelectionChange: PropTypes.func,
|
||||||
placeholder: PropTypes.string,
|
placeholder: PropTypes.string,
|
||||||
placeholderTextColor: PropTypes.string,
|
placeholderTextColor: PropTypes.string,
|
||||||
@@ -87,6 +88,7 @@ class TextInput extends Component {
|
|||||||
maxNumberOfLines,
|
maxNumberOfLines,
|
||||||
multiline,
|
multiline,
|
||||||
numberOfLines,
|
numberOfLines,
|
||||||
|
onKeyPress,
|
||||||
onLayout,
|
onLayout,
|
||||||
onSelectionChange,
|
onSelectionChange,
|
||||||
placeholder,
|
placeholder,
|
||||||
@@ -139,6 +141,7 @@ class TextInput extends Component {
|
|||||||
onBlur: this._handleBlur,
|
onBlur: this._handleBlur,
|
||||||
onChange: this._handleChange,
|
onChange: this._handleChange,
|
||||||
onFocus: this._handleFocus,
|
onFocus: this._handleFocus,
|
||||||
|
onKeyPress,
|
||||||
onSelect: onSelectionChange && this._handleSelectionChange,
|
onSelect: onSelectionChange && this._handleSelectionChange,
|
||||||
readOnly: !editable,
|
readOnly: !editable,
|
||||||
ref: this._setInputRef,
|
ref: this._setInputRef,
|
||||||
@@ -200,6 +203,7 @@ class TextInput extends Component {
|
|||||||
_handleChange = (e) => {
|
_handleChange = (e) => {
|
||||||
const { onChange, onChangeText } = this.props;
|
const { onChange, onChangeText } = this.props;
|
||||||
const text = e.target.value;
|
const text = e.target.value;
|
||||||
|
e.nativeEvent.text = text;
|
||||||
this.setState({ showPlaceholder: text === '' });
|
this.setState({ showPlaceholder: text === '' });
|
||||||
if (onChange) { onChange(e); }
|
if (onChange) { onChange(e); }
|
||||||
if (onChangeText) { onChangeText(text); }
|
if (onChangeText) { onChangeText(text); }
|
||||||
|
|||||||
Reference in New Issue
Block a user