feat: slider add bounces for iOS

This commit is contained in:
pengfei.zhou 2021-04-30 14:28:38 +08:00 committed by osborn
parent f8b983b8d2
commit e621db48b9
11 changed files with 52 additions and 1 deletions

View File

@ -73,6 +73,30 @@ class SliderPanel extends Panel {
space: 10,
backgroundColor: Color.RED,
}),
hlayout([
text({
text: "Bounces",
layoutConfig: {
widthSpec: LayoutSpec.FIT,
heightSpec: LayoutSpec.JUST,
},
textSize: 20,
textColor: Color.BLACK,
textAlignment: gravity().center(),
height: 50,
}),
switchView({
state: true,
onSwitch: (state) => {
pager.bounces = state
},
}),
], {
layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT),
gravity: gravity().center(),
space: 10,
backgroundColor: Color.RED,
}),
pager,
]).also(it => {
it.layoutConfig = {

View File

@ -100,6 +100,8 @@ - (void)blendView:(UICollectionView *)view forPropName:(NSString *)name propValu
[self.view reloadData];
[self.view setContentOffset:CGPointMake(1 * self.view.width, self.view.contentOffset.y) animated:false];
}
} else if ([@"bounces" isEqualToString:name]) {
self.view.bounces = [prop boolValue];
} else {
[super blendView:view forPropName:name propValue:prop];
}

View File

@ -2261,6 +2261,10 @@ var Slider = /** @class */ (function (_super) {
Property,
__metadata$7("design:type", Boolean)
], Slider.prototype, "scrollable", void 0);
__decorate$7([
Property,
__metadata$7("design:type", Boolean)
], Slider.prototype, "bounces", void 0);
return Slider;
}(Superview));
function slider(config) {

View File

@ -1731,6 +1731,10 @@ __decorate$7([
Property,
__metadata$7("design:type", Boolean)
], Slider.prototype, "scrollable", void 0);
__decorate$7([
Property,
__metadata$7("design:type", Boolean)
], Slider.prototype, "bounces", void 0);
function slider(config) {
const ret = new Slider;
for (let key in config) {

View File

@ -3252,6 +3252,10 @@ __decorate$7([
Property,
__metadata$7("design:type", Boolean)
], Slider.prototype, "scrollable", void 0);
__decorate$7([
Property,
__metadata$7("design:type", Boolean)
], Slider.prototype, "bounces", void 0);
function slider(config) {
const ret = new Slider;
for (let key in config) {

1
doric-js/index.d.ts vendored
View File

@ -645,6 +645,7 @@ declare module 'doric/lib/src/widget/slider' {
onPageSlided?: (index: number) => void;
loop?: boolean;
scrollable?: boolean;
bounces?: boolean;
slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise<any>;
getSlidedPage(context: BridgeContext): Promise<number>;
}

View File

@ -16,6 +16,7 @@ export declare class Slider extends Superview {
onPageSlided?: (index: number) => void;
loop?: boolean;
scrollable?: boolean;
bounces?: boolean;
private getItem;
private renderBunchedItems;
slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise<any>;

View File

@ -84,6 +84,10 @@ __decorate([
Property,
__metadata("design:type", Boolean)
], Slider.prototype, "scrollable", void 0);
__decorate([
Property,
__metadata("design:type", Boolean)
], Slider.prototype, "bounces", void 0);
export function slider(config) {
const ret = new Slider;
for (let key in config) {

View File

@ -52,6 +52,9 @@ export class Slider extends Superview {
@Property
scrollable?: boolean
@Property
bounces?: boolean
private getItem(itemIdx: number) {
let view = this.renderPage(itemIdx)
view.superview = this

View File

@ -3306,6 +3306,10 @@ __decorate$7([
Property,
__metadata$7("design:type", Boolean)
], Slider.prototype, "scrollable", void 0);
__decorate$7([
Property,
__metadata$7("design:type", Boolean)
], Slider.prototype, "bounces", void 0);
function slider(config) {
const ret = new Slider;
for (let key in config) {

File diff suppressed because one or more lines are too long