feat: slider add bounces for iOS
This commit is contained in:
parent
f8b983b8d2
commit
e621db48b9
@ -73,6 +73,30 @@ class SliderPanel extends Panel {
|
|||||||
space: 10,
|
space: 10,
|
||||||
backgroundColor: Color.RED,
|
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,
|
pager,
|
||||||
]).also(it => {
|
]).also(it => {
|
||||||
it.layoutConfig = {
|
it.layoutConfig = {
|
||||||
|
@ -100,6 +100,8 @@ - (void)blendView:(UICollectionView *)view forPropName:(NSString *)name propValu
|
|||||||
[self.view reloadData];
|
[self.view reloadData];
|
||||||
[self.view setContentOffset:CGPointMake(1 * self.view.width, self.view.contentOffset.y) animated:false];
|
[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 {
|
} else {
|
||||||
[super blendView:view forPropName:name propValue:prop];
|
[super blendView:view forPropName:name propValue:prop];
|
||||||
}
|
}
|
||||||
|
@ -2261,6 +2261,10 @@ var Slider = /** @class */ (function (_super) {
|
|||||||
Property,
|
Property,
|
||||||
__metadata$7("design:type", Boolean)
|
__metadata$7("design:type", Boolean)
|
||||||
], Slider.prototype, "scrollable", void 0);
|
], Slider.prototype, "scrollable", void 0);
|
||||||
|
__decorate$7([
|
||||||
|
Property,
|
||||||
|
__metadata$7("design:type", Boolean)
|
||||||
|
], Slider.prototype, "bounces", void 0);
|
||||||
return Slider;
|
return Slider;
|
||||||
}(Superview));
|
}(Superview));
|
||||||
function slider(config) {
|
function slider(config) {
|
||||||
|
@ -1731,6 +1731,10 @@ __decorate$7([
|
|||||||
Property,
|
Property,
|
||||||
__metadata$7("design:type", Boolean)
|
__metadata$7("design:type", Boolean)
|
||||||
], Slider.prototype, "scrollable", void 0);
|
], Slider.prototype, "scrollable", void 0);
|
||||||
|
__decorate$7([
|
||||||
|
Property,
|
||||||
|
__metadata$7("design:type", Boolean)
|
||||||
|
], Slider.prototype, "bounces", void 0);
|
||||||
function slider(config) {
|
function slider(config) {
|
||||||
const ret = new Slider;
|
const ret = new Slider;
|
||||||
for (let key in config) {
|
for (let key in config) {
|
||||||
|
@ -3252,6 +3252,10 @@ __decorate$7([
|
|||||||
Property,
|
Property,
|
||||||
__metadata$7("design:type", Boolean)
|
__metadata$7("design:type", Boolean)
|
||||||
], Slider.prototype, "scrollable", void 0);
|
], Slider.prototype, "scrollable", void 0);
|
||||||
|
__decorate$7([
|
||||||
|
Property,
|
||||||
|
__metadata$7("design:type", Boolean)
|
||||||
|
], Slider.prototype, "bounces", void 0);
|
||||||
function slider(config) {
|
function slider(config) {
|
||||||
const ret = new Slider;
|
const ret = new Slider;
|
||||||
for (let key in config) {
|
for (let key in config) {
|
||||||
|
1
doric-js/index.d.ts
vendored
1
doric-js/index.d.ts
vendored
@ -645,6 +645,7 @@ declare module 'doric/lib/src/widget/slider' {
|
|||||||
onPageSlided?: (index: number) => void;
|
onPageSlided?: (index: number) => void;
|
||||||
loop?: boolean;
|
loop?: boolean;
|
||||||
scrollable?: boolean;
|
scrollable?: boolean;
|
||||||
|
bounces?: boolean;
|
||||||
slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise<any>;
|
slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise<any>;
|
||||||
getSlidedPage(context: BridgeContext): Promise<number>;
|
getSlidedPage(context: BridgeContext): Promise<number>;
|
||||||
}
|
}
|
||||||
|
1
doric-js/lib/src/widget/slider.d.ts
vendored
1
doric-js/lib/src/widget/slider.d.ts
vendored
@ -16,6 +16,7 @@ export declare class Slider extends Superview {
|
|||||||
onPageSlided?: (index: number) => void;
|
onPageSlided?: (index: number) => void;
|
||||||
loop?: boolean;
|
loop?: boolean;
|
||||||
scrollable?: boolean;
|
scrollable?: boolean;
|
||||||
|
bounces?: boolean;
|
||||||
private getItem;
|
private getItem;
|
||||||
private renderBunchedItems;
|
private renderBunchedItems;
|
||||||
slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise<any>;
|
slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise<any>;
|
||||||
|
@ -84,6 +84,10 @@ __decorate([
|
|||||||
Property,
|
Property,
|
||||||
__metadata("design:type", Boolean)
|
__metadata("design:type", Boolean)
|
||||||
], Slider.prototype, "scrollable", void 0);
|
], Slider.prototype, "scrollable", void 0);
|
||||||
|
__decorate([
|
||||||
|
Property,
|
||||||
|
__metadata("design:type", Boolean)
|
||||||
|
], Slider.prototype, "bounces", void 0);
|
||||||
export function slider(config) {
|
export function slider(config) {
|
||||||
const ret = new Slider;
|
const ret = new Slider;
|
||||||
for (let key in config) {
|
for (let key in config) {
|
||||||
|
@ -52,6 +52,9 @@ export class Slider extends Superview {
|
|||||||
@Property
|
@Property
|
||||||
scrollable?: boolean
|
scrollable?: boolean
|
||||||
|
|
||||||
|
@Property
|
||||||
|
bounces?: boolean
|
||||||
|
|
||||||
private getItem(itemIdx: number) {
|
private getItem(itemIdx: number) {
|
||||||
let view = this.renderPage(itemIdx)
|
let view = this.renderPage(itemIdx)
|
||||||
view.superview = this
|
view.superview = this
|
||||||
|
4
doric-web/dist/index.js
vendored
4
doric-web/dist/index.js
vendored
@ -3306,6 +3306,10 @@ __decorate$7([
|
|||||||
Property,
|
Property,
|
||||||
__metadata$7("design:type", Boolean)
|
__metadata$7("design:type", Boolean)
|
||||||
], Slider.prototype, "scrollable", void 0);
|
], Slider.prototype, "scrollable", void 0);
|
||||||
|
__decorate$7([
|
||||||
|
Property,
|
||||||
|
__metadata$7("design:type", Boolean)
|
||||||
|
], Slider.prototype, "bounces", void 0);
|
||||||
function slider(config) {
|
function slider(config) {
|
||||||
const ret = new Slider;
|
const ret = new Slider;
|
||||||
for (let key in config) {
|
for (let key in config) {
|
||||||
|
2
doric-web/dist/index.js.map
vendored
2
doric-web/dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user