mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +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;
|
||||
@ -211,7 +217,7 @@ function initializeDialogFragment() {
|
||||
const owner = this.owner;
|
||||
|
||||
if (owner) {
|
||||
// Android calls onDestroy before onDismiss.
|
||||
// Android calls onDestroy before onDismiss.
|
||||
// Make sure we unload first and then call _tearDownUI.
|
||||
if (owner.isLoaded) {
|
||||
owner.callUnloaded();
|
||||
@ -298,7 +304,7 @@ export class View extends ViewCommon {
|
||||
let view: View = this;
|
||||
let frameOrTabViewItemFound = false;
|
||||
while (view) {
|
||||
// when interacting with nested fragments instead of using getSupportFragmentManager
|
||||
// when interacting with nested fragments instead of using getSupportFragmentManager
|
||||
// we must always use getChildFragmentManager instead;
|
||||
// we have three sources of fragments -- Frame fragments, TabViewItem fragments, and
|
||||
// modal dialog fragments
|
||||
@ -1026,4 +1032,4 @@ createNativePercentLengthProperty({
|
||||
createNativePercentLengthProperty({
|
||||
setter: "_setMinHeightNative",
|
||||
get setPixels() { return org.nativescript.widgets.ViewHelper.setMinHeight }
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user