mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-10 00:27:41 +08:00
docs(react): update component usage docs (#17615)
This commit is contained in:
@ -85,6 +85,52 @@ export class RefresherExample {
|
||||
```
|
||||
|
||||
|
||||
### React
|
||||
|
||||
```tsx
|
||||
import React from 'react';
|
||||
|
||||
import { IonContent, IonRefresher, IonRefresherContent } from '@ionic/react';
|
||||
|
||||
function doRefresh(event: CustomEvent) {
|
||||
console.log('Begin async operation');
|
||||
|
||||
setTimeout(() => {
|
||||
console.log('Async operation has ended');
|
||||
event.target.complete();
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
const Example: React.SFC<{}> = () => (
|
||||
<>
|
||||
{/*-- Default Refresher --*/}
|
||||
<IonContent>
|
||||
<IonRefresher slot="fixed" onIonRefresh={doRefresh}>
|
||||
<IonRefresherContent></IonRefresherContent>
|
||||
</IonRefresher>
|
||||
</IonContent>
|
||||
|
||||
{/*-- Custom Refresher Content --*/}
|
||||
<IonContent>
|
||||
<IonRefresher slot="fixed" onIonRefresh={doRefresh}>
|
||||
<IonRefresherContent
|
||||
pullingIcon="arrow-dropdown"
|
||||
pullingText="Pull to refresh"
|
||||
refreshingSpinner="circles"
|
||||
refreshingText="Refreshing...">
|
||||
</IonRefresherContent>
|
||||
</IonRefresher>
|
||||
</IonContent>
|
||||
</>
|
||||
|
||||
}
|
||||
|
||||
|
||||
);
|
||||
|
||||
export default Example
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
|
||||
42
core/src/components/refresher/usage/react.md
Normal file
42
core/src/components/refresher/usage/react.md
Normal file
@ -0,0 +1,42 @@
|
||||
```tsx
|
||||
import React from 'react';
|
||||
|
||||
import { IonContent, IonRefresher, IonRefresherContent } from '@ionic/react';
|
||||
|
||||
function doRefresh(event: CustomEvent) {
|
||||
console.log('Begin async operation');
|
||||
|
||||
setTimeout(() => {
|
||||
console.log('Async operation has ended');
|
||||
event.target.complete();
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
const Example: React.SFC<{}> = () => (
|
||||
<>
|
||||
{/*-- Default Refresher --*/}
|
||||
<IonContent>
|
||||
<IonRefresher slot="fixed" onIonRefresh={doRefresh}>
|
||||
<IonRefresherContent></IonRefresherContent>
|
||||
</IonRefresher>
|
||||
</IonContent>
|
||||
|
||||
{/*-- Custom Refresher Content --*/}
|
||||
<IonContent>
|
||||
<IonRefresher slot="fixed" onIonRefresh={doRefresh}>
|
||||
<IonRefresherContent
|
||||
pullingIcon="arrow-dropdown"
|
||||
pullingText="Pull to refresh"
|
||||
refreshingSpinner="circles"
|
||||
refreshingText="Refreshing...">
|
||||
</IonRefresherContent>
|
||||
</IonRefresher>
|
||||
</IonContent>
|
||||
</>
|
||||
|
||||
}
|
||||
|
||||
|
||||
);
|
||||
|
||||
export default Example
|
||||
Reference in New Issue
Block a user