Skip to content

Commit 7ce1031

Browse files
authored
fix(refresher): mode property can be used in typescript (#28717)
Issue number: resolves #28716 --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> All components that have per-mode stylesheets can have their mode adjusted by setting `mode` on the component. We use the `setMode` function to determine which mode to use on the component: https://github.com/ionic-team/ionic-framework/blob/516b84475e5d78060f35fa2c4821efc712536353/core/src/global/ionic-global.ts#L75 While this works on refresher, it is missing the `virtualProp` jsdoc comment which causes it to not have the appropriate type information. As a result, when developers try to use a JS binding for `mode`, they will get compilation errors. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Adds virtualProp for mode to refresher ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change: 1. Describe the impact and migration path for existing applications below. 2. Update the BREAKING.md file with the breaking change. 3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer for more information. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> I am considering this a bug fix instead of a feature. In non-TypeScript environments you can set `mode` on `ion-refresher` and it does change the mode. What's missing here is the type information associated with it. Dev build: `7.6.2-dev.11702914017.1ae72da5`
1 parent 516b844 commit 7ce1031

File tree

5 files changed

+16
-4
lines changed

5 files changed

+16
-4
lines changed

core/api.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,7 @@ ion-range,part,tick-active
10871087
ion-refresher,none
10881088
ion-refresher,prop,closeDuration,string,'280ms',false,false
10891089
ion-refresher,prop,disabled,boolean,false,false,false
1090+
ion-refresher,prop,mode,"ios" | "md",undefined,false,false
10901091
ion-refresher,prop,pullFactor,number,1,false,false
10911092
ion-refresher,prop,pullMax,number,this.pullMin + 60,false,false
10921093
ion-refresher,prop,pullMin,number,60,false,false

core/src/components.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2377,6 +2377,10 @@ export namespace Components {
23772377
* A number representing how far down the user has pulled. The number `0` represents the user hasn't pulled down at all. The number `1`, and anything greater than `1`, represents that the user has pulled far enough down that when they let go then the refresh will happen. If they let go and the number is less than `1`, then the refresh will not happen, and the content will return to it's original position.
23782378
*/
23792379
"getProgress": () => Promise<number>;
2380+
/**
2381+
* The mode determines which platform styles to use.
2382+
*/
2383+
"mode"?: "ios" | "md";
23802384
/**
23812385
* How much to multiply the pull speed by. To slow the pull animation down, pass a number less than `1`. To speed up the pull, pass a number greater than `1`. The default value is `1` which is equal to the speed of the cursor. If a negative value is passed in, the factor will be `1` instead. For example: If the value passed is `1.2` and the content is dragged by `10` pixels, instead of `10` pixels the content will be pulled by `12` pixels (an increase of 20 percent). If the value passed is `0.8`, the dragged amount will be `8` pixels, less than the amount the cursor has moved. Does not apply when the refresher content uses a spinner, enabling the native refresher.
23822386
*/
@@ -7089,6 +7093,10 @@ declare namespace LocalJSX {
70897093
* If `true`, the refresher will be hidden.
70907094
*/
70917095
"disabled"?: boolean;
7096+
/**
7097+
* The mode determines which platform styles to use.
7098+
*/
7099+
"mode"?: "ios" | "md";
70927100
/**
70937101
* Emitted while the user is pulling down the content and exposing the refresher.
70947102
*/

core/src/components/refresher/refresher.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ import {
2525
translateElement,
2626
} from './refresher.utils';
2727

28+
/**
29+
* @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
30+
*/
2831
@Component({
2932
tag: 'ion-refresher',
3033
styleUrls: {

packages/angular/src/directives/proxies.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,15 +1626,15 @@ mouse drag, touch gesture, or keyboard interaction.
16261626

16271627

16281628
@ProxyCmp({
1629-
inputs: ['closeDuration', 'disabled', 'pullFactor', 'pullMax', 'pullMin', 'snapbackDuration'],
1629+
inputs: ['closeDuration', 'disabled', 'mode', 'pullFactor', 'pullMax', 'pullMin', 'snapbackDuration'],
16301630
methods: ['complete', 'cancel', 'getProgress']
16311631
})
16321632
@Component({
16331633
selector: 'ion-refresher',
16341634
changeDetection: ChangeDetectionStrategy.OnPush,
16351635
template: '<ng-content></ng-content>',
16361636
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
1637-
inputs: ['closeDuration', 'disabled', 'pullFactor', 'pullMax', 'pullMin', 'snapbackDuration'],
1637+
inputs: ['closeDuration', 'disabled', 'mode', 'pullFactor', 'pullMax', 'pullMin', 'snapbackDuration'],
16381638
})
16391639
export class IonRefresher {
16401640
protected el: HTMLElement;

packages/angular/standalone/src/directives/proxies.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,15 +1496,15 @@ export declare interface IonProgressBar extends Components.IonProgressBar {}
14961496

14971497
@ProxyCmp({
14981498
defineCustomElementFn: defineIonRefresher,
1499-
inputs: ['closeDuration', 'disabled', 'pullFactor', 'pullMax', 'pullMin', 'snapbackDuration'],
1499+
inputs: ['closeDuration', 'disabled', 'mode', 'pullFactor', 'pullMax', 'pullMin', 'snapbackDuration'],
15001500
methods: ['complete', 'cancel', 'getProgress']
15011501
})
15021502
@Component({
15031503
selector: 'ion-refresher',
15041504
changeDetection: ChangeDetectionStrategy.OnPush,
15051505
template: '<ng-content></ng-content>',
15061506
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
1507-
inputs: ['closeDuration', 'disabled', 'pullFactor', 'pullMax', 'pullMin', 'snapbackDuration'],
1507+
inputs: ['closeDuration', 'disabled', 'mode', 'pullFactor', 'pullMax', 'pullMin', 'snapbackDuration'],
15081508
standalone: true
15091509
})
15101510
export class IonRefresher {

0 commit comments

Comments
 (0)