Skip to content

Commit d61e704

Browse files
committed
fix(android): recycle MotionEvent when necessary
1 parent dcd430a commit d61e704

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

packages/gesturehandler/platforms/android/java/com/nativescript/gesturehandler/RootViewGestureHandler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ protected void onCancel() {
3838
getView().setDispatchToOrchestra(false);
3939
getView().dispatchTouchEvent(event);
4040
getView().setDispatchToOrchestra(true);
41+
event.recycle();
4142
}
4243
// public boolean shouldRecognizeSimultaneously(GestureHandler handler) {
4344
// return true;

packages/gesturehandler/platforms/android/java/com/swmansion/gesturehandler/NativeViewGestureHandler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,5 +145,6 @@ protected void onCancel() {
145145
MotionEvent event = MotionEvent.obtain(time, time, MotionEvent.ACTION_CANCEL, 0, 0, 0);
146146
event.setAction(MotionEvent.ACTION_CANCEL);
147147
getView().onTouchEvent(event);
148+
event.recycle();
148149
}
149150
}

0 commit comments

Comments
 (0)