feat:Flowlayout support scrollable
This commit is contained in:
parent
418b71c7a3
commit
c2ca3c0b31
@ -71,6 +71,14 @@ public class FlowLayoutNode extends SuperNode<RecyclerView> 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<RecyclerView> 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<RecyclerView> 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;
|
||||
|
@ -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]) {
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user