mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 20:11:24 +08:00
FIX: Never show text-view hint while editing.
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
import {
|
import {
|
||||||
EditableTextBase, editableProperty, hintProperty, textProperty, colorProperty, placeholderColorProperty,
|
EditableTextBase, editableProperty, hintProperty, textProperty, colorProperty, placeholderColorProperty,
|
||||||
borderTopWidthProperty, borderRightWidthProperty, borderBottomWidthProperty, borderLeftWidthProperty,
|
borderTopWidthProperty, borderRightWidthProperty, borderBottomWidthProperty, borderLeftWidthProperty,
|
||||||
paddingTopProperty, paddingRightProperty, paddingBottomProperty, paddingLeftProperty,
|
paddingTopProperty, paddingRightProperty, paddingBottomProperty, paddingLeftProperty,
|
||||||
Length, _updateCharactersInRangeReplacementString, Color, layout
|
Length, _updateCharactersInRangeReplacementString, Color, layout
|
||||||
} from "../editable-text-base";
|
} from "../editable-text-base";
|
||||||
|
|
||||||
@ -28,6 +28,13 @@ class UITextViewDelegateImpl extends NSObject implements UITextViewDelegate {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public textViewDidBeginEditing(textView: UITextView) {
|
||||||
|
var owner = this._owner.get();
|
||||||
|
if (owner) {
|
||||||
|
owner._isEditing = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public textViewDidEndEditing(textView: UITextView) {
|
public textViewDidEndEditing(textView: UITextView) {
|
||||||
const owner = this._owner.get();
|
const owner = this._owner.get();
|
||||||
if (owner) {
|
if (owner) {
|
||||||
@ -35,6 +42,7 @@ class UITextViewDelegateImpl extends NSObject implements UITextViewDelegate {
|
|||||||
textProperty.nativeValueChange(owner, textView.text);
|
textProperty.nativeValueChange(owner, textView.text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
owner._isEditing = false;
|
||||||
owner.dismissSoftInput();
|
owner.dismissSoftInput();
|
||||||
owner._refreshHintState(owner.hint, textView.text);
|
owner._refreshHintState(owner.hint, textView.text);
|
||||||
}
|
}
|
||||||
@ -63,6 +71,7 @@ export class TextView extends EditableTextBase implements TextViewDefinition {
|
|||||||
private _ios: UITextView;
|
private _ios: UITextView;
|
||||||
private _delegate: UITextViewDelegateImpl;
|
private _delegate: UITextViewDelegateImpl;
|
||||||
private _isShowingHint: boolean;
|
private _isShowingHint: boolean;
|
||||||
|
public _isEditing: boolean = false;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
@ -96,9 +105,10 @@ export class TextView extends EditableTextBase implements TextViewDefinition {
|
|||||||
if (this.formattedText) {
|
if (this.formattedText) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (text !== null && text !== undefined && text !== '') {
|
if (text !== null && text !== undefined && text !== '') {
|
||||||
this.showText();
|
this.showText();
|
||||||
} else if (hint !== null && hint !== undefined && hint !== '') {
|
} else if (!this._isEditing && hint !== null && hint !== undefined && hint !== '') {
|
||||||
this.showHint(hint);
|
this.showHint(hint);
|
||||||
} else {
|
} else {
|
||||||
this._isShowingHint = false;
|
this._isShowingHint = false;
|
||||||
|
Reference in New Issue
Block a user