mirror of
https://github.com/ecency/ecency-mobile.git
synced 2025-01-03 03:25:24 +03:00
added loading indicator
This commit is contained in:
parent
ab7b8547f9
commit
0bd460297c
@ -63,6 +63,7 @@ class SettingsContainer extends Component {
|
|||||||
this.state = {
|
this.state = {
|
||||||
serverList: [],
|
serverList: [],
|
||||||
isNotificationMenuOpen: props.isNotificationSettingsOpen,
|
isNotificationMenuOpen: props.isNotificationSettingsOpen,
|
||||||
|
isLoading: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,6 +115,8 @@ class SettingsContainer extends Component {
|
|||||||
|
|
||||||
dispatch(setApi(server));
|
dispatch(setApi(server));
|
||||||
|
|
||||||
|
this.setState({ isLoading: true });
|
||||||
|
|
||||||
try {
|
try {
|
||||||
serverResp = await client.database.getDynamicGlobalProperties();
|
serverResp = await client.database.getDynamicGlobalProperties();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -144,6 +147,7 @@ class SettingsContainer extends Component {
|
|||||||
checkClient();
|
checkClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.setState({ isLoading: false });
|
||||||
dispatch(toastNotification(intl.formatMessage({ id: alertMessage })));
|
dispatch(toastNotification(intl.formatMessage({ id: alertMessage })));
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -345,7 +349,7 @@ class SettingsContainer extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { serverList, isNotificationMenuOpen } = this.state;
|
const { serverList, isNotificationMenuOpen, isLoading } = this.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SettingsScreen
|
<SettingsScreen
|
||||||
@ -353,6 +357,7 @@ class SettingsContainer extends Component {
|
|||||||
handleOnChange={this._handleOnChange}
|
handleOnChange={this._handleOnChange}
|
||||||
isNotificationMenuOpen={isNotificationMenuOpen}
|
isNotificationMenuOpen={isNotificationMenuOpen}
|
||||||
handleOnButtonPress={this._handleButtonPress}
|
handleOnButtonPress={this._handleButtonPress}
|
||||||
|
isLoading={isLoading}
|
||||||
{...this.props}
|
{...this.props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
|
/* eslint-disable react/jsx-wrap-multilines */
|
||||||
import React, { PureComponent, Fragment } from 'react';
|
import React, { PureComponent, Fragment } from 'react';
|
||||||
import { ScrollView, View } from 'react-native';
|
import { ScrollView, View, RefreshControl } from 'react-native';
|
||||||
import { injectIntl } from 'react-intl';
|
import { injectIntl } from 'react-intl';
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
@ -31,7 +32,7 @@ class SettingsScreen extends PureComponent {
|
|||||||
// Component Life Cycles
|
// Component Life Cycles
|
||||||
|
|
||||||
// Component Functions
|
// Component Functions
|
||||||
|
// TODO: REFACTOR ME !
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
handleOnChange,
|
handleOnChange,
|
||||||
@ -53,6 +54,7 @@ class SettingsScreen extends PureComponent {
|
|||||||
transfersNotification,
|
transfersNotification,
|
||||||
voteNotification,
|
voteNotification,
|
||||||
handleOnButtonPress,
|
handleOnButtonPress,
|
||||||
|
isLoading,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -63,7 +65,18 @@ class SettingsScreen extends PureComponent {
|
|||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ScrollView style={styles.container}>
|
<ScrollView
|
||||||
|
style={styles.container}
|
||||||
|
refreshControl={
|
||||||
|
<RefreshControl
|
||||||
|
refreshing={isLoading}
|
||||||
|
progressBackgroundColor="#357CE6"
|
||||||
|
tintColor={!isDarkTheme ? '#357ce6' : '#96c0ff'}
|
||||||
|
titleColor="#fff"
|
||||||
|
colors={['#fff']}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
>
|
||||||
<View style={styles.settingsCard}>
|
<View style={styles.settingsCard}>
|
||||||
<SettingsItem
|
<SettingsItem
|
||||||
title={intl.formatMessage({
|
title={intl.formatMessage({
|
||||||
|
Loading…
Reference in New Issue
Block a user