diff --git a/components/Amicale/AuthenticatedScreen.js b/components/Amicale/AuthenticatedScreen.js index 06989b2..807687e 100644 --- a/components/Amicale/AuthenticatedScreen.js +++ b/components/Amicale/AuthenticatedScreen.js @@ -1,11 +1,11 @@ // @flow import * as React from 'react'; -import {View} from "react-native"; -import {ActivityIndicator, withTheme} from 'react-native-paper'; +import {withTheme} from 'react-native-paper'; import ConnectionManager, {ERROR_TYPE} from "../../managers/ConnectionManager"; import NetworkErrorComponent from "../Custom/NetworkErrorComponent"; import i18n from 'i18n-js'; +import BasicLoadingScreen from "../Custom/BasicLoadingScreen"; type Props = { navigation: Object, @@ -71,32 +71,6 @@ class AuthenticatedScreen extends React.Component { this.setState({loading: false}); } - /** - * Gets the loading indicator - * - * @return {*} - */ - getRenderLoading() { - return ( - - - - ); - } - getErrorRender() { let message; let icon; @@ -128,7 +102,7 @@ class AuthenticatedScreen extends React.Component { render() { return ( this.state.loading - ? this.getRenderLoading() + ? : (this.data !== undefined ? this.props.renderFunction(this.data) : this.getErrorRender()) diff --git a/components/Custom/BasicLoadingScreen.js b/components/Custom/BasicLoadingScreen.js new file mode 100644 index 0000000..5e3a027 --- /dev/null +++ b/components/Custom/BasicLoadingScreen.js @@ -0,0 +1,35 @@ +// @flow + +import * as React from 'react'; +import {ActivityIndicator, withTheme} from 'react-native-paper'; +import {View} from "react-native"; + +/** + * Component used to display a header button + * + * @param props Props to pass to the component + * @return {*} + */ +function BasicLoadingScreen(props) { + const {colors} = props.theme; + return ( + + + + ); +} + +export default withTheme(BasicLoadingScreen); diff --git a/components/Screens/WebViewScreen.js b/components/Screens/WebViewScreen.js index 16903a7..95d9067 100644 --- a/components/Screens/WebViewScreen.js +++ b/components/Screens/WebViewScreen.js @@ -1,10 +1,10 @@ // @flow import * as React from 'react'; -import {View} from 'react-native'; import WebView from "react-native-webview"; -import {ActivityIndicator, withTheme} from 'react-native-paper'; +import {withTheme} from 'react-native-paper'; import HeaderButton from "../Custom/HeaderButton"; +import BasicLoadingScreen from "../Custom/BasicLoadingScreen"; type Props = { navigation: Object, @@ -88,24 +88,7 @@ class WebViewScreen extends React.PureComponent { * @return {*} */ getRenderLoading() { - return ( - - - - ); + return ; } render() {