From 0bd460297c3081f403f0df5068cecc3581f24716 Mon Sep 17 00:00:00 2001 From: ue Date: Mon, 12 Aug 2019 12:39:03 +0300 Subject: [PATCH] added loading indicator --- .../settings/container/settingsContainer.js | 7 ++++++- src/screens/settings/screen/settingsScreen.js | 19 ++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/screens/settings/container/settingsContainer.js b/src/screens/settings/container/settingsContainer.js index ab892502e..40194add1 100644 --- a/src/screens/settings/container/settingsContainer.js +++ b/src/screens/settings/container/settingsContainer.js @@ -63,6 +63,7 @@ class SettingsContainer extends Component { this.state = { serverList: [], isNotificationMenuOpen: props.isNotificationSettingsOpen, + isLoading: false, }; } @@ -114,6 +115,8 @@ class SettingsContainer extends Component { dispatch(setApi(server)); + this.setState({ isLoading: true }); + try { serverResp = await client.database.getDynamicGlobalProperties(); } catch (e) { @@ -144,6 +147,7 @@ class SettingsContainer extends Component { checkClient(); } + this.setState({ isLoading: false }); dispatch(toastNotification(intl.formatMessage({ id: alertMessage }))); }; @@ -345,7 +349,7 @@ class SettingsContainer extends Component { }; render() { - const { serverList, isNotificationMenuOpen } = this.state; + const { serverList, isNotificationMenuOpen, isLoading } = this.state; return ( ); diff --git a/src/screens/settings/screen/settingsScreen.js b/src/screens/settings/screen/settingsScreen.js index dd6490543..ba466854d 100644 --- a/src/screens/settings/screen/settingsScreen.js +++ b/src/screens/settings/screen/settingsScreen.js @@ -1,5 +1,6 @@ +/* eslint-disable react/jsx-wrap-multilines */ import React, { PureComponent, Fragment } from 'react'; -import { ScrollView, View } from 'react-native'; +import { ScrollView, View, RefreshControl } from 'react-native'; import { injectIntl } from 'react-intl'; // Utils @@ -31,7 +32,7 @@ class SettingsScreen extends PureComponent { // Component Life Cycles // Component Functions - + // TODO: REFACTOR ME ! render() { const { handleOnChange, @@ -53,6 +54,7 @@ class SettingsScreen extends PureComponent { transfersNotification, voteNotification, handleOnButtonPress, + isLoading, } = this.props; return ( @@ -63,7 +65,18 @@ class SettingsScreen extends PureComponent { })} /> - + + } + >