feat:Scroller support scrollable
This commit is contained in:
parent
9e6d9131ee
commit
4cc67a463d
@ -15,8 +15,11 @@
|
||||
*/
|
||||
package pub.doric.shader;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.github.pengfeizhou.jscore.JSONBuilder;
|
||||
@ -144,9 +147,24 @@ public class ScrollerNode extends SuperNode<HVScrollView> implements IDoricScrol
|
||||
return hvScrollView;
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
@Override
|
||||
protected void blend(HVScrollView view, String name, JSValue prop) {
|
||||
if ("content".equals(name)) {
|
||||
if ("scrollable".equals(name)) {
|
||||
if (!prop.isBoolean()) {
|
||||
return;
|
||||
}
|
||||
if (prop.asBoolean().value()) {
|
||||
this.getView().setOnTouchListener(null);
|
||||
} else {
|
||||
this.getView().setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
} else if ("content".equals(name)) {
|
||||
if (!prop.isString()) {
|
||||
return;
|
||||
}
|
||||
|
@ -127,7 +127,9 @@ - (void)requestLayout {
|
||||
}
|
||||
|
||||
- (void)blendView:(DoricScrollView *)view forPropName:(NSString *)name propValue:(id)prop {
|
||||
if ([@"content" isEqualToString:name]) {
|
||||
if ([@"scrollable" isEqualToString:name]) {
|
||||
self.view.scrollEnabled = [prop boolValue];
|
||||
} else if ([@"content" isEqualToString:name]) {
|
||||
self.childViewId = prop;
|
||||
} else if ([@"onScroll" isEqualToString:name]) {
|
||||
self.onScrollFuncId = prop;
|
||||
|
@ -42,6 +42,9 @@ export class Scroller extends Superview {
|
||||
@Property
|
||||
onScrollEnd?: (offset: { x: number, y: number }) => void
|
||||
|
||||
@Property
|
||||
scrollable?: boolean
|
||||
|
||||
allSubviews() {
|
||||
return [this.content]
|
||||
}
|
||||
|
Reference in New Issue
Block a user