Browse Source

Updated libraries

Arnaud Vergnet 1 year ago
parent
commit
ea33e1c017
4 changed files with 51 additions and 39 deletions
  1. 11
    8
      App.js
  2. 4
    4
      package.json
  3. 4
    10
      src/components/Overrides/CustomHeaderButton.js
  4. 32
    17
      src/components/Screens/WebViewScreen.js

+ 11
- 8
App.js View File

@@ -16,6 +16,7 @@ import ConnectionManager from "./src/managers/ConnectionManager";
16 16
 import URLHandler from "./src/utils/URLHandler";
17 17
 import {setSafeBounceHeight} from "react-navigation-collapsible";
18 18
 import SplashScreen from 'react-native-splash-screen'
19
+import {OverflowMenuProvider} from "react-navigation-header-buttons";
19 20
 
20 21
 // Native optimizations https://reactnavigation.org/docs/react-native-screens
21 22
 // Crashes app when navigating away from webview on android 9+
@@ -189,14 +190,16 @@ export default class App extends React.Component<Props, State> {
189 190
         } else {
190 191
             return (
191 192
                 <PaperProvider theme={this.state.currentTheme}>
192
-                    <View style={{backgroundColor: ThemeManager.getCurrentTheme().colors.background, flex: 1}}>
193
-                        <NavigationContainer theme={this.state.currentTheme} ref={this.navigatorRef}>
194
-                            <MainNavigator
195
-                                defaultHomeRoute={this.defaultHomeRoute}
196
-                                defaultHomeData={this.defaultHomeData}
197
-                            />
198
-                        </NavigationContainer>
199
-                    </View>
193
+                    <OverflowMenuProvider>
194
+                        <View style={{backgroundColor: ThemeManager.getCurrentTheme().colors.background, flex: 1}}>
195
+                            <NavigationContainer theme={this.state.currentTheme} ref={this.navigatorRef}>
196
+                                <MainNavigator
197
+                                    defaultHomeRoute={this.defaultHomeRoute}
198
+                                    defaultHomeData={this.defaultHomeData}
199
+                                />
200
+                            </NavigationContainer>
201
+                        </View>
202
+                    </OverflowMenuProvider>
200 203
                 </PaperProvider>
201 204
             );
202 205
         }

+ 4
- 4
package.json View File

@@ -43,8 +43,8 @@
43 43
     "react-native-keychain": "^6.0.0",
44 44
     "react-native-linear-gradient": "^2.5.6",
45 45
     "react-native-localize": "^1.4.0",
46
-    "react-native-modalize": "^1.3.6",
47
-    "react-native-paper": "^3.9.0",
46
+    "react-native-modalize": "^2.0.4",
47
+    "react-native-paper": "^3.10.1",
48 48
     "react-native-permissions": "^2.1.4",
49 49
     "react-native-push-notification": "^3.3.1",
50 50
     "react-native-reanimated": "^1.8.0",
@@ -54,8 +54,8 @@
54 54
     "react-native-splash-screen": "^3.2.0",
55 55
     "react-native-vector-icons": "^6.6.0",
56 56
     "react-native-webview": "^9.4.0",
57
-    "react-navigation-collapsible": "^5.5.0",
58
-    "react-navigation-header-buttons": "^3.0.5"
57
+    "react-navigation-collapsible": "^5.6.0",
58
+    "react-navigation-header-buttons": "^4.0.2"
59 59
   },
60 60
   "devDependencies": {
61 61
     "@babel/core": "^7.9.6",

+ 4
- 10
src/components/Overrides/CustomHeaderButton.js View File

@@ -6,26 +6,20 @@ import {HeaderButton, HeaderButtons} from 'react-navigation-header-buttons';
6 6
 import {withTheme} from "react-native-paper";
7 7
 import * as Touchable from "react-native/Libraries/Components/Touchable/TouchableNativeFeedback.android";
8 8
 
9
-const MaterialHeaderButton = (props: Object) => <HeaderButton
9
+const MaterialHeaderButton = (props: Object) =>
10
+    <HeaderButton
11
+        {...props}
10 12
         IconComponent={MaterialCommunityIcons}
11 13
         iconSize={26}
12 14
         color={props.color != null ? props.color : props.theme.colors.text}
13 15
         background={Touchable.Ripple(props.theme.colors.ripple, true)}
14
-        {...props}
15 16
     />;
16 17
 
17 18
 const MaterialHeaderButtons = (props: Object) => {
18 19
     return (
19 20
         <HeaderButtons
20
-            HeaderButtonComponent={withTheme(MaterialHeaderButton)}
21
-            OverflowIcon={
22
-                <MaterialCommunityIcons
23
-                    name="dots-vertical"
24
-                    size={26}
25
-                    color={props.theme.colors.text}
26
-                />
27
-            }
28 21
             {...props}
22
+            HeaderButtonComponent={withTheme(MaterialHeaderButton)}
29 23
         />
30 24
     );
31 25
 };

+ 32
- 17
src/components/Screens/WebViewScreen.js View File

@@ -6,16 +6,22 @@ import BasicLoadingScreen from "./BasicLoadingScreen";
6 6
 import ErrorView from "./ErrorView";
7 7
 import {ERROR_TYPE} from "../../utils/WebData";
8 8
 import MaterialHeaderButtons, {Item} from '../Overrides/CustomHeaderButton';
9
-import {HiddenItem} from "react-navigation-header-buttons";
9
+import {Divider, HiddenItem, OverflowMenu} from "react-navigation-header-buttons";
10 10
 import i18n from 'i18n-js';
11 11
 import {Animated, BackHandler, Linking} from "react-native";
12 12
 import {withCollapsible} from "../../utils/withCollapsible";
13
+import MaterialCommunityIcons from "react-native-vector-icons/MaterialCommunityIcons";
14
+import {withTheme} from "react-native-paper";
15
+import type {CustomTheme} from "../../managers/ThemeManager";
16
+import {StackNavigationProp} from "@react-navigation/stack";
17
+import {Collapsible} from "react-navigation-collapsible";
13 18
 
14 19
 type Props = {
15
-    navigation: Object,
20
+    navigation: StackNavigationProp,
21
+    theme: CustomTheme,
16 22
     url: string,
17 23
     customJS: string,
18
-    collapsibleStack: Object,
24
+    collapsibleStack: Collapsible,
19 25
     onMessage: Function,
20 26
     onScroll: Function,
21 27
     showAdvancedControls: boolean,
@@ -104,19 +110,28 @@ class WebViewScreen extends React.PureComponent<Props> {
104 110
                 <Item
105 111
                     title="refresh"
106 112
                     iconName="refresh"
107
-                    onPress={this.onRefreshClicked}/>
108
-                <HiddenItem
109
-                    title={i18n.t("general.goBack")}
110
-                    iconName="arrow-left"
111
-                    onPress={this.onGoBackClicked}/>
112
-                <HiddenItem
113
-                    title={i18n.t("general.goForward")}
114
-                    iconName="arrow-right"
115
-                    onPress={this.onGoForwardClicked}/>
116
-                <HiddenItem
117
-                    title={i18n.t("general.openInBrowser")}
118
-                    iconName="web"
119
-                    onPress={this.onOpenClicked}/>
113
+                    onPress={this.onRefreshClicked}
114
+                />
115
+                <OverflowMenu
116
+                    style={{marginHorizontal: 10}}
117
+                    OverflowIcon={
118
+                        <MaterialCommunityIcons
119
+                            name="dots-vertical"
120
+                            size={26}
121
+                            color={this.props.theme.colors.text}
122
+                        />}
123
+                >
124
+                    <HiddenItem
125
+                        title={i18n.t("general.goBack")}
126
+                        onPress={this.onGoBackClicked}/>
127
+                    <HiddenItem
128
+                        title={i18n.t("general.goForward")}
129
+                        onPress={this.onGoForwardClicked}/>
130
+                    <Divider/>
131
+                    <HiddenItem
132
+                        title={i18n.t("general.openInBrowser")}
133
+                        onPress={this.onOpenClicked}/>
134
+                </OverflowMenu>
120 135
             </MaterialHeaderButtons>
121 136
         );
122 137
     }
@@ -179,4 +194,4 @@ class WebViewScreen extends React.PureComponent<Props> {
179 194
     }
180 195
 }
181 196
 
182
-export default withCollapsible(WebViewScreen);
197
+export default withCollapsible(withTheme(WebViewScreen));

Loading…
Cancel
Save