Browse Source

Fixed side menu staying open when changing tab + fixed ios tab icon color

keplyx 2 years ago
parent
commit
dd4ba0a9fc

+ 22
- 0
components/BaseContainer.js View File

@@ -24,6 +24,8 @@ type State = {
24 24
 
25 25
 export default class BaseContainer extends React.Component<Props, State> {
26 26
 
27
+    willBlurSubscription: function;
28
+
27 29
     static defaultProps = {
28 30
         headerRightButton: <View/>
29 31
     };
@@ -43,6 +45,26 @@ export default class BaseContainer extends React.Component<Props, State> {
43 45
         this.setState({isOpen});
44 46
     }
45 47
 
48
+    /**
49
+     * Register for blur event to close side menu on screen change
50
+     */
51
+    componentDidMount() {
52
+        this.willBlurSubscription = this.props.navigation.addListener(
53
+            'willBlur',
54
+            payload => {
55
+                this.setState({isOpen: false});
56
+            }
57
+        );
58
+    }
59
+
60
+    /**
61
+     * Unregister from event when un-mounting components
62
+     */
63
+    componentWillUnmount() {
64
+        if (this.willBlurSubscription !== undefined)
65
+            this.willBlurSubscription.remove();
66
+    }
67
+
46 68
     render() {
47 69
         return (
48 70
             <View style={{

+ 5
- 4
components/FetchedDataSectionList.js View File

@@ -121,7 +121,7 @@ export default class FetchedDataSectionList extends React.Component<Props, State
121 121
     _onRefresh = () => {
122 122
         let canRefresh;
123 123
         if (this.lastRefresh !== undefined)
124
-            canRefresh = (new Date().getTime() - this.lastRefresh.getTime())/1000 > this.minTimeBetweenRefresh;
124
+            canRefresh = (new Date().getTime() - this.lastRefresh.getTime()) / 1000 > this.minTimeBetweenRefresh;
125 125
         else
126 126
             canRefresh = true;
127 127
 
@@ -314,9 +314,10 @@ export default class FetchedDataSectionList extends React.Component<Props, State
314 314
             tabbedView.push(
315 315
                 <Tab heading={
316 316
                     <TabHeading>
317
-                        <CustomMaterialIcon icon={dataset[i].icon}
318
-                                            color={'#fff'}
319
-                                            fontSize={20}
317
+                        <CustomMaterialIcon
318
+                            icon={dataset[i].icon}
319
+                            color={ThemeManager.getCurrentThemeVariables().tabIconColor}
320
+                            fontSize={20}
320 321
                         />
321 322
                         <Text>{dataset[i].title}</Text>
322 323
                     </TabHeading>}

+ 1
- 0
native-base-theme/variables/platform.js View File

@@ -238,6 +238,7 @@ export default {
238 238
 
239 239
     // Tabs
240 240
     tabBgColor: "#F8F8F8",
241
+    tabIconColor: platform === "ios" ? "#5d5d5d" : "#fff",
241 242
     tabFontSize: 15,
242 243
 
243 244
     // Text

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

@@ -239,6 +239,7 @@ export default {
239 239
 
240 240
     // Tabs
241 241
     tabBgColor: "#2b2b2b",
242
+    tabIconColor: "#fff",
242 243
     tabFontSize: 15,
243 244
 
244 245
     // Text

+ 2
- 2
screens/ProxiwashAboutScreen.js View File

@@ -36,7 +36,7 @@ export default class ProxiwashAboutScreen extends React.Component<Props> {
36 36
                             <TabHeading>
37 37
                                 <CustomMaterialIcon
38 38
                                     icon={'information'}
39
-                                    color={'#fff'}
39
+                                    color={ThemeManager.getCurrentThemeVariables().tabIconColor}
40 40
                                     fontSize={20}
41 41
                                 />
42 42
                                 <Text>{i18n.t('proxiwashScreen.informationTab')}</Text>
@@ -106,7 +106,7 @@ export default class ProxiwashAboutScreen extends React.Component<Props> {
106 106
                             <TabHeading>
107 107
                                 <CustomMaterialIcon
108 108
                                     icon={'cash'}
109
-                                    color={'#fff'}
109
+                                    color={ThemeManager.getCurrentThemeVariables().tabIconColor}
110 110
                                     fontSize={20}
111 111
                                 />
112 112
                                 <Text>{i18n.t('proxiwashScreen.paymentTab')}</Text>

Loading…
Cancel
Save