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();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canScrollVertically() {
|
||||||
|
if (!scrollable) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return super.canScrollVertically();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
private int columnSpace = 0;
|
private int columnSpace = 0;
|
||||||
private int rowSpace = 0;
|
private int rowSpace = 0;
|
||||||
@ -89,6 +97,7 @@ public class FlowLayoutNode extends SuperNode<RecyclerView> implements IDoricScr
|
|||||||
private String onScrollEndFuncId;
|
private String onScrollEndFuncId;
|
||||||
private DoricJSDispatcher jsDispatcher = new DoricJSDispatcher();
|
private DoricJSDispatcher jsDispatcher = new DoricJSDispatcher();
|
||||||
private int itemCount = 0;
|
private int itemCount = 0;
|
||||||
|
private boolean scrollable = true;
|
||||||
|
|
||||||
public FlowLayoutNode(DoricContext doricContext) {
|
public FlowLayoutNode(DoricContext doricContext) {
|
||||||
super(doricContext);
|
super(doricContext);
|
||||||
@ -117,6 +126,12 @@ public class FlowLayoutNode extends SuperNode<RecyclerView> implements IDoricScr
|
|||||||
@Override
|
@Override
|
||||||
protected void blend(RecyclerView view, String name, JSValue prop) {
|
protected void blend(RecyclerView view, String name, JSValue prop) {
|
||||||
switch (name) {
|
switch (name) {
|
||||||
|
case "scrollable":
|
||||||
|
if (!prop.isBoolean()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.scrollable = prop.asBoolean().value();
|
||||||
|
break;
|
||||||
case "columnSpace":
|
case "columnSpace":
|
||||||
if (!prop.isNumber()) {
|
if (!prop.isNumber()) {
|
||||||
return;
|
return;
|
||||||
|
@ -190,7 +190,9 @@ - (UICollectionView *)build {
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)blendView:(UICollectionView *)view forPropName:(NSString *)name propValue:(id)prop {
|
- (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.columnSpace = [prop floatValue];
|
||||||
[self.view.collectionViewLayout invalidateLayout];
|
[self.view.collectionViewLayout invalidateLayout];
|
||||||
} else if ([@"rowSpace" isEqualToString:name]) {
|
} else if ([@"rowSpace" isEqualToString:name]) {
|
||||||
|
@ -69,6 +69,9 @@ export class FlowLayout extends Superview {
|
|||||||
@Property
|
@Property
|
||||||
onScrollEnd?: (offset: { x: number, y: number }) => void
|
onScrollEnd?: (offset: { x: number, y: number }) => void
|
||||||
|
|
||||||
|
@Property
|
||||||
|
scrollable?: boolean
|
||||||
|
|
||||||
reset() {
|
reset() {
|
||||||
this.cachedViews.clear()
|
this.cachedViews.clear()
|
||||||
this.itemCount = 0
|
this.itemCount = 0
|
||||||
|
Reference in New Issue
Block a user