diff --git a/src/components/Screens/WebViewScreen.js b/src/components/Screens/WebViewScreen.js index 7fcce98..22f8229 100644 --- a/src/components/Screens/WebViewScreen.js +++ b/src/components/Screens/WebViewScreen.js @@ -18,6 +18,7 @@ type Props = { collapsibleStack: Object, onMessage: Function, onScroll: Function, + showAdvancedControls: boolean, } const AnimatedWebView = Animated.createAnimatedComponent(WebView); @@ -29,6 +30,7 @@ class WebViewScreen extends React.PureComponent { static defaultProps = { customJS: '', + showAdvancedControls: true, }; webviewRef: Object; @@ -45,9 +47,10 @@ class WebViewScreen extends React.PureComponent { * Creates refresh button after mounting */ componentDidMount() { - const rightButton = this.getRefreshButton.bind(this); this.props.navigation.setOptions({ - headerRight: rightButton, + headerRight: this.props.showAdvancedControls + ? this.getAdvancedButtons + : this.getBasicButton, }); this.props.navigation.addListener( 'focus', @@ -80,7 +83,22 @@ class WebViewScreen extends React.PureComponent { * * @return {*} */ - getRefreshButton() { + getBasicButton = () => { + return ( + + + + + ); + }; + + getAdvancedButtons = () => { return ( { onPress={this.onOpenClicked}/> ); - }; + } /** * Callback to use when refresh button is clicked. Reloads the webview. diff --git a/src/screens/Planex/PlanexScreen.js b/src/screens/Planex/PlanexScreen.js index 4b54b98..51b34e6 100644 --- a/src/screens/Planex/PlanexScreen.js +++ b/src/screens/Planex/PlanexScreen.js @@ -207,10 +207,11 @@ class PlanexScreen extends React.Component { + 'true;'; // Prevents crash on ios } - // componentWillUpdate(prevProps: Props) { - // if (prevProps.theme.dark !== this.props.theme.dark) - // this.generateInjectedCSS(); - // } + shouldComponentUpdate(nextProps: Props): boolean { + if (nextProps.theme.dark !== this.props.theme.dark) + this.generateInjectedJS(this.state.currentGroup.id); + return true; + } /** * Callback used when closing the banner. @@ -291,6 +292,7 @@ class PlanexScreen extends React.Component { customJS={this.customInjectedJS} onMessage={this.onMessage} onScroll={this.onScroll} + showAdvancedControls={false} /> );