Android TextView没有';不要在键盘关闭时失去焦点

Android TextView没有';不要在键盘关闭时失去焦点,android,textview,nativescript,angular2-nativescript,Android,Textview,Nativescript,Angular2 Nativescript,这种行为只发生在Android设备上 <TextView [(ngModel)]="textData" updateTextTrigger="focusLost" (ngModelChange)="updateText()"></TextView> 由于我使用updateTextTrigger作为focusLost,模型不会更新,因为TextView始终保持聚焦,我们将焦点切换到另一个元素,这是我无法做到的,因为这是页面上唯一的输入元素 这是安卓设备上的预期行为吗?

这种行为只发生在
Android
设备上

<TextView [(ngModel)]="textData" updateTextTrigger="focusLost" (ngModelChange)="updateText()"></TextView>

由于我使用
updateTextTrigger
作为
focusLost
,模型不会更新,因为
TextView
始终保持聚焦,我们将焦点切换到另一个元素,这是我无法做到的,因为这是页面上唯一的输入元素

这是安卓设备上的预期行为吗?如何处理


这是否是
NativeScript的一个问题,并且应该作为一个问题创建???

我正在使用一个稍微调整过的去盎司管道版本,如下所示:

上面链接中的代码也更新了模型,这是我不需要的。所以选择你的毒药。我的代码是:

import { Input, Output } from "@angular/core";
import { EventEmitter, ElementRef, OnInit, Directive } from "@angular/core";
import { Observable } from "rxjs";

@Directive({
  selector: '[debounce]'
})
export class DebounceDirective implements OnInit {
  @Input() debounceDelay: number = 700;
  @Input() debounceFromEvent: string = "tap";
  @Output() debounceFunction: EventEmitter<any> = new EventEmitter();

  constructor(private elementRef: ElementRef) {
  }

  ngOnInit(): void {
    const eventStream = Observable
        .fromEvent(this.elementRef.nativeElement, this.debounceFromEvent)
        .debounceTime(this.debounceDelay);

    eventStream.subscribe(input => this.debounceFunction.emit(input));
  }
}

那么为什么要使用
focusLost
呢?@EddyVerbruggen每当用户输入完内容,我就会保存
textData
,如果要实现去Bounce,我就需要在这个组件周围写一个包装,而且它也会比这种方法更频繁地到达后端去Bounce可能是一个
管道
,我过去也这样做过。如果您愿意,我可以将代码粘贴到这里作为答案。使用
管道
进行debounce是很有趣的,我很想看看代码。如果你想知道我到底在期待什么,这里有一个最简单的示例代码谢谢你,我也可以在其他场景中使用它,但我希望我们在
Angular2
中有类似
ngModelOptions
的东西,这会让生活更轻松
TextView
似乎不会触发
keyup
propertyChange
事件。我应该使用哪个事件?给
textChange
一个快照使用
textChange
工作。但始终聚焦的
TextView
看起来还是不太好。当键盘关闭时,应该找到一种方法移除焦点。
<Label debounce debounceDelay="700" (debounceFunction)="saveChanges()" (tap)="updateStock(selectedArticle.article, 1)" text="Update"></Label>