Skip to content

Commit

Permalink
fix(android): onScroll of HippyRecyclerView
Browse files Browse the repository at this point in the history
  • Loading branch information
siguangli2018 authored and zoomchan-cxj committed Mar 9, 2022
1 parent 4c8b6f8 commit eb2bead
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,17 @@ public static HippyRecyclerView initDefault(Context context, HippyMap iniProps,
HippyRecyclerView recyclerView) {
LinearLayoutManager layoutManager = new EasyLinearLayoutManager(context);
recyclerView.setItemAnimator(null);
if (iniProps != null && iniProps.containsKey("horizontal")) {
layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
boolean enableScrollEvent = false;
if (iniProps != null) {
if (iniProps.containsKey("horizontal")) {
layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
}
enableScrollEvent = iniProps.getBoolean("onScroll");
}
recyclerView.setLayoutManager(layoutManager);
recyclerView.setHippyEngineContext(((HippyInstanceContext) context).getEngineContext());
recyclerView.initRecyclerView();
recyclerView.getRecyclerViewEventHelper().setOnScrollEventEnable(enableScrollEvent);
return recyclerView;
}

Expand Down Expand Up @@ -119,11 +124,6 @@ public void setMomentumScrollEndEventEnable(HRW view, boolean flag) {
view.getRecyclerViewEventHelper().setMomentumScrollEndEventEnable(flag);
}

@HippyControllerProps(name = "onScrollEnable", defaultType = HippyControllerProps.BOOLEAN, defaultBoolean = false)
public void setOnScrollEventEnable(HRW view, boolean flag) {
view.getRecyclerViewEventHelper().setOnScrollEventEnable(flag);
}

@HippyControllerProps(name = "exposureEventEnabled", defaultType = HippyControllerProps.BOOLEAN, defaultBoolean = false)
public void setExposureEventEnable(HRW view, boolean flag) {
view.getRecyclerViewEventHelper().setExposureEventEnable(flag);
Expand Down

0 comments on commit eb2bead

Please sign in to comment.