diff --git a/doric-android/doric/src/main/java/pub/doric/shader/slider/NestedSliderNode.java b/doric-android/doric/src/main/java/pub/doric/shader/slider/NestedSliderNode.java index a8b7eed8..856c4174 100644 --- a/doric-android/doric/src/main/java/pub/doric/shader/slider/NestedSliderNode.java +++ b/doric-android/doric/src/main/java/pub/doric/shader/slider/NestedSliderNode.java @@ -15,7 +15,9 @@ */ package pub.doric.shader.slider; +import android.annotation.SuppressLint; import android.text.TextUtils; +import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; @@ -80,9 +82,25 @@ public class NestedSliderNode extends GroupNode implements ViewPager. return viewPager; } + @SuppressLint("ClickableViewAccessibility") @Override protected void blend(ViewPager view, String name, JSValue prop) { switch (name) { + case "scrollable": + 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; + } + }); + } + break; case "onPageSlided": this.onPageSlidedFuncId = prop.asString().toString(); break; diff --git a/doric-iOS/Pod/Classes/Shader/DoricNestedSliderNode.m b/doric-iOS/Pod/Classes/Shader/DoricNestedSliderNode.m index 547b8a69..41bc1e43 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricNestedSliderNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricNestedSliderNode.m @@ -46,7 +46,9 @@ - (UIScrollView *)build { } - (void)blendView:(UIScrollView *)view forPropName:(NSString *)name propValue:(id)prop { - if ([@"onPageSlided" isEqualToString:name]) { + if ([@"scrollable" isEqualToString:name]) { + self.view.scrollEnabled = [prop boolValue]; + } else if ([@"onPageSlided" isEqualToString:name]) { self.onPageSelectedFuncId = prop; } else { [super blendView:view forPropName:name propValue:prop]; diff --git a/doric-js/src/widget/nestedSlider.ts b/doric-js/src/widget/nestedSlider.ts index dab3f755..ce1444d2 100644 --- a/doric-js/src/widget/nestedSlider.ts +++ b/doric-js/src/widget/nestedSlider.ts @@ -21,6 +21,9 @@ export class NestedSlider extends Group { @Property onPageSlided?: (index: number) => void + @Property + scrollable?: boolean + addSlideItem(view: View) { this.addChild(view) }