Skip to content

Commit

Permalink
feat(renderer): cr fix
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinwli committed Oct 31, 2023
1 parent 5862cf5 commit 46381ff
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,9 @@ public void run() {
// Reusable int array to be passed to method calls that mutate it in order to "return" two ints.
private final int[] mScrollOffsetPair = new int[2];
private int mNestedScrollOffset = 0;

//防抖时间 ms
protected int mScrollEventThrottle = 0;


private void init(Context context, boolean isVertical) {
setCallPageChangedOnFirstLayout(true);
setEnableReLayoutOnAttachToWindow(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,11 @@ public void setOverflow(HippyViewPager pager, String overflow) {
pager.setOverflow(overflow);
}

@HippyControllerProps(name = "scrollEventThrottle", defaultType = HippyControllerProps.NUMBER, defaultNumber = 30.0D)
@HippyControllerProps(name = "scrollEventThrottle", defaultType = HippyControllerProps.NUMBER, defaultNumber = 0)
public void setScrollEventThrottle(HippyViewPager pager,int scrollEventThrottle) {
pager.setScrollEventThrottle(scrollEventThrottle);
}

private void resolveInvalidParams(@Nullable Promise promise) {
if (promise != null) {
String msg = "Invalid parameter!";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ private void onScrollStateChangeToIdle() {
params.put(PAGE_ITEM_POSITION, mLastPageIndex);
EventUtils.sendComponentEvent(lastView, EventUtils.EVENT_PAGE_ITEM_DID_DISAPPEAR, params);
mLastPageIndex = mCurrPageIndex;
//防抖只是针对onScroll事件。 状态事件不参与过滤,也不会被丢弃。
// 状态变成idle只是重置mLastScrollEventTimeStamp,以便下次滑动开始时,重新计算。
mLastScrollEventTimeStamp = -1;
}

Expand Down

0 comments on commit 46381ff

Please sign in to comment.