Skip to content

Commit 561415a

Browse files
committed
Add momentum events invoking
1 parent c1c8d32 commit 561415a

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

Example/android/app/src/main/java/tonlabs/uikit/ReactOverScrollView.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
import com.mixiaoxiao.overscroll.PathScroller;
2323

2424
import java.lang.reflect.Field;
25+
import java.lang.reflect.InvocationTargetException;
26+
import java.lang.reflect.Method;
2527

2628
/**
2729
* https://github.com/Mixiaoxiao/OverScroll-Everywhere
@@ -78,6 +80,20 @@ public boolean onTouchEvent(MotionEvent event) {
7880
// TODO: it's fired twice for some reason
7981
ReactScrollViewHelper.emitScrollEndDragEvent(this, 0, 0);
8082
mDragging = false;
83+
84+
// TODO: create a wrapper with method invoker
85+
try {
86+
Method handlePostTouchScrolling = ReactScrollView.class.getDeclaredMethod("handlePostTouchScrolling");
87+
handlePostTouchScrolling.setAccessible(true);
88+
// TODO: velocity
89+
handlePostTouchScrolling.invoke(this, 0, 0);
90+
} catch (IllegalAccessException e) {
91+
e.printStackTrace();
92+
} catch (InvocationTargetException e) {
93+
e.printStackTrace();
94+
} catch (NoSuchMethodException e) {
95+
e.printStackTrace();
96+
}
8197
// return true;
8298
}
8399
int offset = this.superComputeVerticalScrollOffset();

0 commit comments

Comments
 (0)