feat:NestedScroller add scrollable
This commit is contained in:
parent
056f2f041f
commit
5982b15b0d
@ -15,7 +15,9 @@
|
|||||||
*/
|
*/
|
||||||
package pub.doric.shader.slider;
|
package pub.doric.shader.slider;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
@ -80,9 +82,25 @@ public class NestedSliderNode extends GroupNode<ViewPager> implements ViewPager.
|
|||||||
return viewPager;
|
return viewPager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
@Override
|
@Override
|
||||||
protected void blend(ViewPager view, String name, JSValue prop) {
|
protected void blend(ViewPager view, String name, JSValue prop) {
|
||||||
switch (name) {
|
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":
|
case "onPageSlided":
|
||||||
this.onPageSlidedFuncId = prop.asString().toString();
|
this.onPageSlidedFuncId = prop.asString().toString();
|
||||||
break;
|
break;
|
||||||
|
@ -46,7 +46,9 @@ - (UIScrollView *)build {
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)blendView:(UIScrollView *)view forPropName:(NSString *)name propValue:(id)prop {
|
- (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;
|
self.onPageSelectedFuncId = prop;
|
||||||
} else {
|
} else {
|
||||||
[super blendView:view forPropName:name propValue:prop];
|
[super blendView:view forPropName:name propValue:prop];
|
||||||
|
@ -21,6 +21,9 @@ export class NestedSlider extends Group {
|
|||||||
@Property
|
@Property
|
||||||
onPageSlided?: (index: number) => void
|
onPageSlided?: (index: number) => void
|
||||||
|
|
||||||
|
@Property
|
||||||
|
scrollable?: boolean
|
||||||
|
|
||||||
addSlideItem(view: View) {
|
addSlideItem(view: View) {
|
||||||
this.addChild(view)
|
this.addChild(view)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user