|
@@ -18,6 +18,7 @@ type Props = {
|
18
|
18
|
collapsibleStack: Object,
|
19
|
19
|
onMessage: Function,
|
20
|
20
|
onScroll: Function,
|
|
21
|
+ showAdvancedControls: boolean,
|
21
|
22
|
}
|
22
|
23
|
|
23
|
24
|
const AnimatedWebView = Animated.createAnimatedComponent(WebView);
|
|
@@ -29,6 +30,7 @@ class WebViewScreen extends React.PureComponent<Props> {
|
29
|
30
|
|
30
|
31
|
static defaultProps = {
|
31
|
32
|
customJS: '',
|
|
33
|
+ showAdvancedControls: true,
|
32
|
34
|
};
|
33
|
35
|
|
34
|
36
|
webviewRef: Object;
|
|
@@ -45,9 +47,10 @@ class WebViewScreen extends React.PureComponent<Props> {
|
45
|
47
|
* Creates refresh button after mounting
|
46
|
48
|
*/
|
47
|
49
|
componentDidMount() {
|
48
|
|
- const rightButton = this.getRefreshButton.bind(this);
|
49
|
50
|
this.props.navigation.setOptions({
|
50
|
|
- headerRight: rightButton,
|
|
51
|
+ headerRight: this.props.showAdvancedControls
|
|
52
|
+ ? this.getAdvancedButtons
|
|
53
|
+ : this.getBasicButton,
|
51
|
54
|
});
|
52
|
55
|
this.props.navigation.addListener(
|
53
|
56
|
'focus',
|
|
@@ -80,7 +83,22 @@ class WebViewScreen extends React.PureComponent<Props> {
|
80
|
83
|
*
|
81
|
84
|
* @return {*}
|
82
|
85
|
*/
|
83
|
|
- getRefreshButton() {
|
|
86
|
+ getBasicButton = () => {
|
|
87
|
+ return (
|
|
88
|
+ <MaterialHeaderButtons>
|
|
89
|
+ <Item
|
|
90
|
+ title="refresh"
|
|
91
|
+ iconName="refresh"
|
|
92
|
+ onPress={this.onRefreshClicked}/>
|
|
93
|
+ <Item
|
|
94
|
+ title={i18n.t("general.openInBrowser")}
|
|
95
|
+ iconName="open-in-new"
|
|
96
|
+ onPress={this.onOpenClicked}/>
|
|
97
|
+ </MaterialHeaderButtons>
|
|
98
|
+ );
|
|
99
|
+ };
|
|
100
|
+
|
|
101
|
+ getAdvancedButtons = () => {
|
84
|
102
|
return (
|
85
|
103
|
<MaterialHeaderButtons>
|
86
|
104
|
<Item
|
|
@@ -101,7 +119,7 @@ class WebViewScreen extends React.PureComponent<Props> {
|
101
|
119
|
onPress={this.onOpenClicked}/>
|
102
|
120
|
</MaterialHeaderButtons>
|
103
|
121
|
);
|
104
|
|
- };
|
|
122
|
+ }
|
105
|
123
|
|
106
|
124
|
/**
|
107
|
125
|
* Callback to use when refresh button is clicked. Reloads the webview.
|