mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix(RootLayout): prevent android touch event to pass through views underneath (#9389)
This commit is contained in:
@@ -10,6 +10,26 @@ export class RootLayout extends RootLayoutBase {
|
||||
super();
|
||||
}
|
||||
|
||||
insertChild(view: View, atIndex: number): void {
|
||||
super.insertChild(view, atIndex);
|
||||
if (!view.hasGestureObservers()) {
|
||||
// block tap events from going through to layers behind the view
|
||||
view.nativeViewProtected.setOnTouchListener(
|
||||
new android.view.View.OnTouchListener({
|
||||
onTouch: function (view, event) {
|
||||
return true;
|
||||
},
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
removeChild(view: View): void {
|
||||
if (view.hasGestureObservers()) {
|
||||
view.nativeViewProtected.setOnTouchListener(null);
|
||||
}
|
||||
super.removeChild(view);
|
||||
}
|
||||
|
||||
protected _bringToFront(view: View) {
|
||||
(<android.view.View>view.nativeViewProtected).bringToFront();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user