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:
@ -93,6 +93,55 @@ async function presentLoadingWithOptions() {
|
||||
```
|
||||
|
||||
|
||||
### React
|
||||
|
||||
```tsx
|
||||
import React, { Component } from 'react'
|
||||
import { IonLoading } from '@ionic/react';
|
||||
|
||||
type Props = {}
|
||||
type State = {
|
||||
showLoading1: boolean
|
||||
showLoading2: boolean
|
||||
}
|
||||
|
||||
export class LoadingExample extends Component<Props, State> {
|
||||
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
showLoading1: false
|
||||
showLoading2: false
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<IonLoading
|
||||
isOpen={this.state.showLoading1}
|
||||
onDidDismiss={() => this.setState(() => ({ showLoading1: false }))}
|
||||
message={'Hellooo'}
|
||||
duration={200}
|
||||
>
|
||||
</IonLoading>
|
||||
|
||||
<IonLoading
|
||||
isOpen={this.state.showLoading2}
|
||||
onDidDismiss={() => this.setState(() => ({ showLoading2: false }))}
|
||||
spinner={null}
|
||||
duration={5000}
|
||||
message='Please wait...'}
|
||||
translucent={true}
|
||||
cssClass='custom-class custom-loading'
|
||||
>
|
||||
</IonLoading>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
|
||||
45
core/src/components/loading/usage/react.md
Normal file
45
core/src/components/loading/usage/react.md
Normal file
@ -0,0 +1,45 @@
|
||||
```tsx
|
||||
import React, { Component } from 'react'
|
||||
import { IonLoading } from '@ionic/react';
|
||||
|
||||
type Props = {}
|
||||
type State = {
|
||||
showLoading1: boolean
|
||||
showLoading2: boolean
|
||||
}
|
||||
|
||||
export class LoadingExample extends Component<Props, State> {
|
||||
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
showLoading1: false
|
||||
showLoading2: false
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<IonLoading
|
||||
isOpen={this.state.showLoading1}
|
||||
onDidDismiss={() => this.setState(() => ({ showLoading1: false }))}
|
||||
message={'Hellooo'}
|
||||
duration={200}
|
||||
>
|
||||
</IonLoading>
|
||||
|
||||
<IonLoading
|
||||
isOpen={this.state.showLoading2}
|
||||
onDidDismiss={() => this.setState(() => ({ showLoading2: false }))}
|
||||
spinner={null}
|
||||
duration={5000}
|
||||
message='Please wait...'}
|
||||
translucent={true}
|
||||
cssClass='custom-class custom-loading'
|
||||
>
|
||||
</IonLoading>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
Reference in New Issue
Block a user