Browse Source

Various UI improvements and fixes (mainly for ios)

keplyx 4 years ago
parent
commit
6371d4a9ff

+ 20
- 1
App.js View File

1
 // @flow
1
 // @flow
2
 
2
 
3
 import * as React from 'react';
3
 import * as React from 'react';
4
+import {StatusBar, Platform } from 'react-native';
4
 import {Root, StyleProvider} from 'native-base';
5
 import {Root, StyleProvider} from 'native-base';
5
 import {createAppContainerWithInitialRoute} from './navigation/AppNavigator';
6
 import {createAppContainerWithInitialRoute} from './navigation/AppNavigator';
6
 import ThemeManager from './utils/ThemeManager';
7
 import ThemeManager from './utils/ThemeManager';
45
         this.setState({
46
         this.setState({
46
             currentTheme: ThemeManager.getCurrentTheme()
47
             currentTheme: ThemeManager.getCurrentTheme()
47
         });
48
         });
49
+        this.setupStatusBar();
48
         clearThemeCache();
50
         clearThemeCache();
49
     }
51
     }
50
 
52
 
53
+    setupStatusBar() {
54
+        if (Platform.OS === 'ios') {
55
+            console.log(ThemeManager.getNightMode());
56
+            if (ThemeManager.getNightMode()) {
57
+                console.log('setting light mode');
58
+                StatusBar.setBarStyle('light-content', true);
59
+            } else {
60
+                console.log('setting dark mode');
61
+                StatusBar.setBarStyle('dark-content', true);
62
+            }
63
+        }
64
+    }
65
+
51
     /**
66
     /**
52
      * Callback when user ends the intro. Save in preferences to avaoid showing back the introSlides
67
      * Callback when user ends the intro. Save in preferences to avaoid showing back the introSlides
53
      */
68
      */
70
         await AsyncStorageManager.getInstance().loadPreferences();
85
         await AsyncStorageManager.getInstance().loadPreferences();
71
         ThemeManager.getInstance().setUpdateThemeCallback(() => this.updateTheme());
86
         ThemeManager.getInstance().setUpdateThemeCallback(() => this.updateTheme());
72
         await NotificationsManager.initExpoToken();
87
         await NotificationsManager.initExpoToken();
73
-        console.log(AsyncStorageManager.getInstance().preferences.expoToken.current);
88
+        // console.log(AsyncStorageManager.getInstance().preferences.expoToken.current);
74
     }
89
     }
75
 
90
 
76
     onLoadFinished() {
91
     onLoadFinished() {
83
             showUpdate: AsyncStorageManager.getInstance().preferences.showUpdate1.current === '1'
98
             showUpdate: AsyncStorageManager.getInstance().preferences.showUpdate1.current === '1'
84
             // showIntro: true
99
             // showIntro: true
85
         });
100
         });
101
+        // Status bar goes dark if set too fast
102
+        setTimeout(this.setupStatusBar,
103
+            1000
104
+        )
86
     }
105
     }
87
 
106
 
88
     /**
107
     /**

+ 20
- 15
components/BaseContainer.js View File

14
     navigation: Object,
14
     navigation: Object,
15
     headerTitle: string,
15
     headerTitle: string,
16
     headerRightButton: React.Node,
16
     headerRightButton: React.Node,
17
-    children: React.Node
17
+    children: React.Node,
18
+    hasTabs: boolean,
18
 }
19
 }
19
 
20
 
20
 type State = {
21
 type State = {
27
     willBlurSubscription: function;
28
     willBlurSubscription: function;
28
 
29
 
29
     static defaultProps = {
30
     static defaultProps = {
30
-        headerRightButton: <View/>
31
+        headerRightButton: <View/>,
32
+        hasTabs: false,
31
     };
33
     };
32
 
34
 
33
 
35
 
72
                 width: '100%',
74
                 width: '100%',
73
                 height: '100%'
75
                 height: '100%'
74
             }}>
76
             }}>
75
-                <CustomSideMenu navigation={this.props.navigation} isOpen={this.state.isOpen}
76
-                                onChange={(isOpen) => this.updateMenuState(isOpen)}>
77
+                <CustomSideMenu
78
+                    navigation={this.props.navigation} isOpen={this.state.isOpen}
79
+                    onChange={(isOpen) => this.updateMenuState(isOpen)}>
77
                     <Container>
80
                     <Container>
78
-                        <CustomHeader navigation={this.props.navigation} title={this.props.headerTitle}
79
-                                      leftButton={
80
-                                          <Touchable
81
-                                              style={{padding: 6}}
82
-                                              onPress={() => this.toggle()}>
83
-                                              <CustomMaterialIcon
84
-                                                  color={Platform.OS === 'ios' ? ThemeManager.getCurrentThemeVariables().brandPrimary : "#fff"}
85
-                                                  icon="menu"/>
86
-                                          </Touchable>
87
-                                      }
88
-                                      rightButton={this.props.headerRightButton}/>
81
+                        <CustomHeader
82
+                            navigation={this.props.navigation} title={this.props.headerTitle}
83
+                            leftButton={
84
+                                <Touchable
85
+                                    style={{padding: 6}}
86
+                                    onPress={() => this.toggle()}>
87
+                                    <CustomMaterialIcon
88
+                                        color={Platform.OS === 'ios' ? ThemeManager.getCurrentThemeVariables().brandPrimary : "#fff"}
89
+                                        icon="menu"/>
90
+                                </Touchable>
91
+                            }
92
+                            rightButton={this.props.headerRightButton}
93
+                            hasTabs={this.props.hasTabs}/>
89
                         {this.props.children}
94
                         {this.props.children}
90
                     </Container>
95
                     </Container>
91
                 </CustomSideMenu>
96
                 </CustomSideMenu>

+ 9
- 8
components/CustomHeader.js View File

50
             button = this.props.leftButton;
50
             button = this.props.leftButton;
51
 
51
 
52
         return (
52
         return (
53
-            <Header style={styles.header}>
53
+            <Header style={styles.header}
54
+                    hasTabs={this.props.hasTabs}>
54
                 <Left>
55
                 <Left>
55
                     {button}
56
                     {button}
56
                 </Left>
57
                 </Left>
60
                 <Right>
61
                 <Right>
61
                     {this.props.rightButton}
62
                     {this.props.rightButton}
62
                     {this.props.hasBackButton ? <View/> :
63
                     {this.props.hasBackButton ? <View/> :
63
-                    <Touchable
64
-                        style={{padding: 6}}
65
-                        onPress={() => this.props.navigation.navigate('SettingsScreen')}>
66
-                        <CustomMaterialIcon
67
-                            color={Platform.OS === 'ios' ? ThemeManager.getCurrentThemeVariables().brandPrimary : "#fff"}
68
-                            icon="settings"/>
69
-                    </Touchable>}
64
+                        <Touchable
65
+                            style={{padding: 6}}
66
+                            onPress={() => this.props.navigation.navigate('SettingsScreen')}>
67
+                            <CustomMaterialIcon
68
+                                color={Platform.OS === 'ios' ? ThemeManager.getCurrentThemeVariables().brandPrimary : "#fff"}
69
+                                icon="settings"/>
70
+                        </Touchable>}
70
                 </Right>
71
                 </Right>
71
             </Header>);
72
             </Header>);
72
     }
73
     }

+ 9
- 3
components/FetchedDataSectionList.js View File

342
         const nav = this.props.navigation;
342
         const nav = this.props.navigation;
343
         const dataset = this.createDataset(this.state.fetchedData);
343
         const dataset = this.createDataset(this.state.fetchedData);
344
         return (
344
         return (
345
-            <BaseContainer navigation={nav} headerTitle={this.getHeaderTranslation()}
346
-                           headerRightButton={this.getRightButton()}>
345
+            <BaseContainer
346
+                navigation={nav} headerTitle={this.getHeaderTranslation()}
347
+                headerRightButton={this.getRightButton()}
348
+                hasTabs={this.hasTabs()}>
347
                 {this.hasTabs() ?
349
                 {this.hasTabs() ?
348
-                    <Tabs>
350
+                    <Tabs
351
+                        tabContainerStyle={{
352
+                            elevation: 0, // Fix for android shadow
353
+                        }}
354
+                    >
349
                         {this.getTabbedView(dataset)}
355
                         {this.getTabbedView(dataset)}
350
                     </Tabs>
356
                     </Tabs>
351
                     :
357
                     :

+ 4
- 4
native-base-theme/variables/platformDark.js View File

158
     searchBarHeight: platform === "ios" ? 30 : 40,
158
     searchBarHeight: platform === "ios" ? 30 : 40,
159
     searchBarInputHeight: platform === "ios" ? 30 : 50,
159
     searchBarInputHeight: platform === "ios" ? 30 : 50,
160
     toolbarBtnTextColor: platform === "ios" ? "#be1522" : "#fff",
160
     toolbarBtnTextColor: platform === "ios" ? "#be1522" : "#fff",
161
-    toolbarDefaultBorder: platform === "ios" ? "#a7a6ab" : "#ba1f0f",
161
+    toolbarDefaultBorder: platform === "ios" ? "#3f3f3f" : "#ba1f0f",
162
     iosStatusbar: platform === "ios" ? "dark-content" : "light-content",
162
     iosStatusbar: platform === "ios" ? "dark-content" : "light-content",
163
     get statusBarColor() {
163
     get statusBarColor() {
164
         return color(this.toolbarDefaultBg)
164
         return color(this.toolbarDefaultBg)
199
 
199
 
200
     // List
200
     // List
201
     listBg: "transparent",
201
     listBg: "transparent",
202
-    listBorderColor: "#727272",
202
+    listBorderColor: "#3e3e3e",
203
     listDividerBg: "#f4f4f4",
203
     listDividerBg: "#f4f4f4",
204
     listBtnUnderlayColor: "#DDD",
204
     listBtnUnderlayColor: "#DDD",
205
     listItemPadding: platform === "ios" ? 10 : 12,
205
     listItemPadding: platform === "ios" ? 10 : 12,
231
     inverseSpinnerColor: "#1A191B",
231
     inverseSpinnerColor: "#1A191B",
232
 
232
 
233
     // Tab
233
     // Tab
234
-    tabDefaultBg: platform === "ios" ? "#2b2b2b" : "#be1522",
234
+    tabDefaultBg: platform === "ios" ? "#333333" : "#be1522",
235
     topTabBarTextColor: platform === "ios" ? "#6b6b6b" : "#b3c7f9",
235
     topTabBarTextColor: platform === "ios" ? "#6b6b6b" : "#b3c7f9",
236
     topTabBarActiveTextColor: platform === "ios" ? "#be1522" : "#fff",
236
     topTabBarActiveTextColor: platform === "ios" ? "#be1522" : "#fff",
237
-    topTabBarBorderColor: platform === "ios" ? "#a7a6ab" : "#fff",
237
+    topTabBarBorderColor: platform === "ios" ? "#3f3f3f" : "#fff",
238
     topTabBarActiveBorderColor: platform === "ios" ? "#be1522" : "#fff",
238
     topTabBarActiveBorderColor: platform === "ios" ? "#be1522" : "#fff",
239
 
239
 
240
     // Tabs
240
     // Tabs

+ 5
- 0
package-lock.json View File

1042
       "resolved": "https://registry.npmjs.org/@react-native-community/netinfo/-/netinfo-2.0.10.tgz",
1042
       "resolved": "https://registry.npmjs.org/@react-native-community/netinfo/-/netinfo-2.0.10.tgz",
1043
       "integrity": "sha512-NrIzyLe0eSbhgMnHl2QdSEhaA7yXh6p9jzMomfUa//hoTXE+xbObGDdiWWSQm2bnXnZJg8XCU3AB9qzvqcuLnA=="
1043
       "integrity": "sha512-NrIzyLe0eSbhgMnHl2QdSEhaA7yXh6p9jzMomfUa//hoTXE+xbObGDdiWWSQm2bnXnZJg8XCU3AB9qzvqcuLnA=="
1044
     },
1044
     },
1045
+    "@react-native-community/status-bar": {
1046
+      "version": "1.0.3",
1047
+      "resolved": "https://registry.npmjs.org/@react-native-community/status-bar/-/status-bar-1.0.3.tgz",
1048
+      "integrity": "sha512-5gwhG1gBTXqgSi/e9DbraBQBCtUtTCSrI9kuwEpwLOCa/pKLIyxQG/HM96ZjvytbZOTZXeaTiKtqLFvYNYSx3A=="
1049
+    },
1045
     "@react-navigation/core": {
1050
     "@react-navigation/core": {
1046
       "version": "3.4.2",
1051
       "version": "3.4.2",
1047
       "resolved": "https://registry.npmjs.org/@react-navigation/core/-/core-3.4.2.tgz",
1052
       "resolved": "https://registry.npmjs.org/@react-navigation/core/-/core-3.4.2.tgz",

+ 1
- 0
package.json View File

9
   },
9
   },
10
   "dependencies": {
10
   "dependencies": {
11
     "@expo/vector-icons": "^10.0.2",
11
     "@expo/vector-icons": "^10.0.2",
12
+    "@react-native-community/status-bar": "^1.0.3",
12
     "@shoutem/theme": "^0.11.3",
13
     "@shoutem/theme": "^0.11.3",
13
     "expo": "^33.0.7",
14
     "expo": "^33.0.7",
14
     "expo-font": "^5.0.1",
15
     "expo-font": "^5.0.1",

+ 6
- 2
screens/PlanningScreen.js View File

128
                         // Surround description with div to allow text styling if the description is not html
128
                         // Surround description with div to allow text styling if the description is not html
129
                         <HTML html={"<div>" + this.state.modalCurrentDisplayItem.description + "</div>"}
129
                         <HTML html={"<div>" + this.state.modalCurrentDisplayItem.description + "</div>"}
130
                               tagsStyles={{
130
                               tagsStyles={{
131
-                                  p: {color: ThemeManager.getCurrentThemeVariables().textColor},
131
+                                  p: {
132
+                                      color: ThemeManager.getCurrentThemeVariables().textColor,
133
+                                      fontSize: ThemeManager.getCurrentThemeVariables().fontSizeBase
134
+                                  },
132
                                   div: {color: ThemeManager.getCurrentThemeVariables().textColor}
135
                                   div: {color: ThemeManager.getCurrentThemeVariables().textColor}
133
-                              }}/>
136
+                              }}
137
+                              onLinkPress={(event, link) => openWebLink(link)}/>
134
                         : <View/>}
138
                         : <View/>}
135
                 </Content>
139
                 </Content>
136
             </View>
140
             </View>

+ 8
- 2
screens/ProxiwashAboutScreen.js View File

29
         const nav = this.props.navigation;
29
         const nav = this.props.navigation;
30
         return (
30
         return (
31
             <Container>
31
             <Container>
32
-                <CustomHeader navigation={nav} title={i18n.t('screens.proxiwash')} hasBackButton={true}/>
33
-                <Tabs>
32
+                <CustomHeader
33
+                    navigation={nav} title={i18n.t('screens.proxiwash')}
34
+                    hasBackButton={true}
35
+                    hasTabs={true}/>
36
+                <Tabs
37
+                    tabContainerStyle={{
38
+                        elevation: 0, // Fix for android shadow
39
+                    }}>
34
                     <Tab
40
                     <Tab
35
                         heading={
41
                         heading={
36
                             <TabHeading>
42
                             <TabHeading>

Loading…
Cancel
Save