From d9a68b021c9c1369fe4913c01e3256ff5bf4bcbb Mon Sep 17 00:00:00 2001 From: keplyx Date: Tue, 6 Aug 2019 19:38:48 +0200 Subject: [PATCH] Added refresh button in planex screen --- screens/PlanexScreen.js | 55 ++++++++++++++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 11 deletions(-) diff --git a/screens/PlanexScreen.js b/screens/PlanexScreen.js index 5fadda9..1fbf064 100644 --- a/screens/PlanexScreen.js +++ b/screens/PlanexScreen.js @@ -1,10 +1,13 @@ // @flow import * as React from 'react'; -import {View} from 'react-native'; -import {Container, Content, Spinner} from 'native-base'; +import {Platform, View} from 'react-native'; +import {Container, Right, Spinner} from 'native-base'; import CustomHeader from "../components/CustomHeader"; import WebView from "react-native-webview"; +import Touchable from "react-native-platform-touchable"; +import CustomMaterialIcon from "../components/CustomMaterialIcon"; +import ThemeManager from "../utils/ThemeManager"; type Props = { navigation: Object, @@ -26,23 +29,53 @@ export default class PlanningScreen extends React.Component { isFinishedLoading: false, }; + webview: WebView; + + getRefreshButton() { + return ( + + this.refreshWebview()}> + + + + ); + }; + + refreshWebview() { + this.setState({isFinishedLoading: false}); + this.webview.reload(); + } + render() { const nav = this.props.navigation; return ( - + (this.webview = ref)} source={{uri: PLANEX_URL}} - style={{width: this.state.isFinishedLoading ? '100%' : 0}} - onLoadEnd={() => { - this.setState({isFinishedLoading: true}) + style={{ + width: '100%', + height: '100%', }} + startInLoadingState={true} + renderLoading={() => + + + + } /> - {this.state.isFinishedLoading ? - : - - - } ); }