Merged
修改废弃接口animateTo为uiContext.animateTo #78
liu-haikangAdd on Jun 12, 2025
修改废弃接口animateTo为uiContext.animateTo #78
Merged
Total: 6 files changed+14-7
| @@ -1,3 +1,6 @@ | |||
| 1 | +## 2.1.3-rc.0 | ||
| 2 | +1.Change animateTo to uiContext.animateTo | ||
| 3 | + | ||
| 1 | ## 2.1.2 | 4 | ## 2.1.2 |
| 2 | 5 | ||
| 3 | 1. Modify external configuration items | 6 | 1. Modify external configuration items |
| @@ -14,7 +14,7 @@ | |||
| 14 | "main": "index.ets", | 14 | "main": "index.ets", |
| 15 | "repository": "https://gitcode.com/openharmony-sig/ohos_pull_to_refresh", | 15 | "repository": "https://gitcode.com/openharmony-sig/ohos_pull_to_refresh", |
| 16 | "type": "module", | 16 | "type": "module", |
| 17 | - "version": "2.1.2", | 17 | + "version": "2.1.3-rc.0", |
| 18 | "dependencies": {}, | 18 | "dependencies": {}, |
| 19 | "tags": [ | 19 | "tags": [ |
| 20 | "UI" | 20 | "UI" |
| @@ -80,8 +80,10 @@ export struct PullToRefresh { | |||
| 80 | private refreshPoint2x?: number = 0; | 80 | private refreshPoint2x?: number = 0; |
| 81 | private refreshPoint2y?: number = 0; | 81 | private refreshPoint2y?: number = 0; |
| 82 | private panOption: PanGestureOptions = new PanGestureOptions({ direction: PanDirection.Up | PanDirection.Down }) | 82 | private panOption: PanGestureOptions = new PanGestureOptions({ direction: PanDirection.Up | PanDirection.Down }) |
| 83 | + uiContext: UIContext | undefined = undefined; | ||
| 83 | 84 | ||
| 84 | aboutToAppear() { | 85 | aboutToAppear() { |
| 86 | + this.uiContext = this.getUIContext(); | ||
| 85 | if (!this.refreshConfigurator) { | 87 | if (!this.refreshConfigurator) { |
| 86 | this.refreshConfigurator = new PullToRefreshConfigurator(); | 88 | this.refreshConfigurator = new PullToRefreshConfigurator(); |
| 87 | } | 89 | } |
| @@ -587,7 +589,7 @@ export struct PullToRefresh { | |||
| 587 | public closeRefresh(): void { | 589 | public closeRefresh(): void { |
| 588 | clearInterval(this.timer); | 590 | clearInterval(this.timer); |
| 589 | if (this.refreshConfigurator !== undefined) { | 591 | if (this.refreshConfigurator !== undefined) { |
| 590 | - animateTo({ duration: this.refreshConfigurator.getAnimDuration() }, () => { | 592 | + this.uiContext?.animateTo({ duration: this.refreshConfigurator.getAnimDuration() }, () => { |
| 591 | this.trYTop = 0; | 593 | this.trYTop = 0; |
| 592 | }); | 594 | }); |
| 593 | } | 595 | } |
| @@ -602,7 +604,7 @@ export struct PullToRefresh { | |||
| 602 | public closeLoad(): void { | 604 | public closeLoad(): void { |
| 603 | clearInterval(this.timer); | 605 | clearInterval(this.timer); |
| 604 | if (this.refreshConfigurator !== undefined) { | 606 | if (this.refreshConfigurator !== undefined) { |
| 605 | - animateTo({ duration: this.refreshConfigurator.getAnimDuration() }, () => { | 607 | + this.uiContext?.animateTo({ duration: this.refreshConfigurator.getAnimDuration() }, () => { |
| 606 | this.trYBottom = 0; | 608 | this.trYBottom = 0; |
| 607 | }); | 609 | }); |
| 608 | } | 610 | } |
| @@ -80,8 +80,10 @@ export struct PullToRefreshV2 { | |||
| 80 | private refreshPoint2x?: number = 0; | 80 | private refreshPoint2x?: number = 0; |
| 81 | private refreshPoint2y?: number = 0; | 81 | private refreshPoint2y?: number = 0; |
| 82 | private panOption: PanGestureOptions = new PanGestureOptions({ direction: PanDirection.Up | PanDirection.Down }) | 82 | private panOption: PanGestureOptions = new PanGestureOptions({ direction: PanDirection.Up | PanDirection.Down }) |
| 83 | + uiContext: UIContext | undefined = undefined; | ||
| 83 | 84 | ||
| 84 | aboutToAppear() { | 85 | aboutToAppear() { |
| 86 | + this.uiContext = this.getUIContext(); | ||
| 85 | // if (!this.refreshConfigurator) { | 87 | // if (!this.refreshConfigurator) { |
| 86 | // this.refreshConfigurator = new PullToRefreshConfigurator(); | 88 | // this.refreshConfigurator = new PullToRefreshConfigurator(); |
| 87 | // } | 89 | // } |
| @@ -586,7 +588,7 @@ export struct PullToRefreshV2 { | |||
| 586 | public closeRefresh(): void { | 588 | public closeRefresh(): void { |
| 587 | clearInterval(this.timer); | 589 | clearInterval(this.timer); |
| 588 | if (this.refreshConfigurator !== undefined) { | 590 | if (this.refreshConfigurator !== undefined) { |
| 589 | - animateTo({ duration: this.refreshConfigurator.getAnimDuration() }, () => { | 591 | + this.uiContext?.animateTo({ duration: this.refreshConfigurator.getAnimDuration() }, () => { |
| 590 | this.trYTop = 0; | 592 | this.trYTop = 0; |
| 591 | }); | 593 | }); |
| 592 | } | 594 | } |
| @@ -601,7 +603,7 @@ export struct PullToRefreshV2 { | |||
| 601 | public closeLoad(): void { | 603 | public closeLoad(): void { |
| 602 | clearInterval(this.timer); | 604 | clearInterval(this.timer); |
| 603 | if (this.refreshConfigurator !== undefined) { | 605 | if (this.refreshConfigurator !== undefined) { |
| 604 | - animateTo({ duration: this.refreshConfigurator.getAnimDuration() }, () => { | 606 | + this.uiContext?.animateTo({ duration: this.refreshConfigurator.getAnimDuration() }, () => { |
| 605 | this.trYBottom = 0; | 607 | this.trYBottom = 0; |
| 606 | }); | 608 | }); |
| 607 | } | 609 | } |