Browse Source

Fixed tab bar icon not updating on theme change

Arnaud Vergnet 4 years ago
parent
commit
cb522466c7
1 changed files with 1 additions and 11 deletions
  1. 1
    11
      src/components/Tabbar/CustomTabBar.js

+ 1
- 11
src/components/Tabbar/CustomTabBar.js View File

@@ -31,26 +31,16 @@ class CustomTabBar extends React.Component<Props, State> {
31 31
 
32 32
     static TAB_BAR_HEIGHT = 48;
33 33
 
34
-    activeColor: string;
35
-    inactiveColor: string;
36
-
37 34
     state = {
38 35
         translateY: new Animated.Value(0),
39 36
         barSynced: false,// Is the bar synced with the header for animations?
40 37
     }
41 38
 
42
-    // shouldComponentUpdate(nextProps: Props): boolean {
43
-    //     return (nextProps.theme.dark !== this.props.theme.dark)
44
-    //         || (nextProps.state.index !== this.props.state.index);
45
-    // }
46
-
47 39
     tabRef: Object;
48 40
 
49 41
     constructor(props) {
50 42
         super(props);
51 43
         this.tabRef = React.createRef();
52
-        this.activeColor = props.theme.colors.primary;
53
-        this.inactiveColor = props.theme.colors.tabIcon;
54 44
     }
55 45
 
56 46
     onItemPress(route: Object, currentIndex: number, destIndex: number) {
@@ -119,7 +109,7 @@ class CustomTabBar extends React.Component<Props, State> {
119 109
             }
120 110
         }
121 111
 
122
-        const color = isFocused ? this.activeColor : this.inactiveColor;
112
+        const color = isFocused ? this.props.theme.colors.primary : this.props.theme.colors.tabIcon;
123 113
         if (route.name !== "home") {
124 114
             return <TabIcon
125 115
                 onPress={onPress}

Loading…
Cancel
Save