diff --git a/doric-android/doric/src/main/java/pub/doric/shader/flowlayout/FlowLayoutNode.java b/doric-android/doric/src/main/java/pub/doric/shader/flowlayout/FlowLayoutNode.java index 3a478c7a..d8caf75c 100644 --- a/doric-android/doric/src/main/java/pub/doric/shader/flowlayout/FlowLayoutNode.java +++ b/doric-android/doric/src/main/java/pub/doric/shader/flowlayout/FlowLayoutNode.java @@ -71,6 +71,14 @@ public class FlowLayoutNode extends SuperNode implements IDoricScr e.printStackTrace(); } } + + @Override + public boolean canScrollVertically() { + if (!scrollable) { + return false; + } + return super.canScrollVertically(); + } }; private int columnSpace = 0; private int rowSpace = 0; @@ -89,6 +97,7 @@ public class FlowLayoutNode extends SuperNode implements IDoricScr private String onScrollEndFuncId; private DoricJSDispatcher jsDispatcher = new DoricJSDispatcher(); private int itemCount = 0; + private boolean scrollable = true; public FlowLayoutNode(DoricContext doricContext) { super(doricContext); @@ -117,6 +126,12 @@ public class FlowLayoutNode extends SuperNode implements IDoricScr @Override protected void blend(RecyclerView view, String name, JSValue prop) { switch (name) { + case "scrollable": + if (!prop.isBoolean()) { + return; + } + this.scrollable = prop.asBoolean().value(); + break; case "columnSpace": if (!prop.isNumber()) { return; diff --git a/doric-iOS/Pod/Classes/Shader/DoricFlowLayoutNode.m b/doric-iOS/Pod/Classes/Shader/DoricFlowLayoutNode.m index 7772cd4b..7b5e7f2b 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricFlowLayoutNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricFlowLayoutNode.m @@ -190,7 +190,9 @@ - (UICollectionView *)build { } - (void)blendView:(UICollectionView *)view forPropName:(NSString *)name propValue:(id)prop { - if ([@"columnSpace" isEqualToString:name]) { + if ([@"scrollable" isEqualToString:name]) { + self.view.scrollEnabled = [prop boolValue]; + } else if ([@"columnSpace" isEqualToString:name]) { self.columnSpace = [prop floatValue]; [self.view.collectionViewLayout invalidateLayout]; } else if ([@"rowSpace" isEqualToString:name]) { diff --git a/doric-js/src/widget/flowlayout.ts b/doric-js/src/widget/flowlayout.ts index 5cf11358..8aef7926 100644 --- a/doric-js/src/widget/flowlayout.ts +++ b/doric-js/src/widget/flowlayout.ts @@ -69,6 +69,9 @@ export class FlowLayout extends Superview { @Property onScrollEnd?: (offset: { x: number, y: number }) => void + @Property + scrollable?: boolean + reset() { this.cachedViews.clear() this.itemCount = 0