mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 20:11:24 +08:00
fix: set/unset touchListener.owner onLoaded/onUnloaded (#6922)
This commit is contained in:

committed by
Manol Donev

parent
0482460c09
commit
f05616743b
@ -57,13 +57,19 @@ function initializeTouchListener(): void {
|
||||
|
||||
@Interfaces([android.view.View.OnTouchListener])
|
||||
class TouchListenerImpl extends java.lang.Object implements android.view.View.OnTouchListener {
|
||||
constructor(private owner: View) {
|
||||
private owner: WeakRef<View>;
|
||||
constructor(owner: View) {
|
||||
super();
|
||||
this.owner = new WeakRef(owner);
|
||||
|
||||
return global.__native(this);
|
||||
}
|
||||
|
||||
onTouch(view: android.view.View, event: android.view.MotionEvent): boolean {
|
||||
const owner = this.owner;
|
||||
const owner = this.owner.get();
|
||||
if (!owner) {
|
||||
return;
|
||||
}
|
||||
owner.handleGestureTouch(event);
|
||||
|
||||
let nativeView = owner.nativeViewProtected;
|
||||
|
Reference in New Issue
Block a user