From cb522466c76671e2a4d0f50bbbe02a00fa330621 Mon Sep 17 00:00:00 2001 From: Arnaud Vergnet Date: Fri, 1 May 2020 11:06:37 +0200 Subject: [PATCH] Fixed tab bar icon not updating on theme change --- src/components/Tabbar/CustomTabBar.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/components/Tabbar/CustomTabBar.js b/src/components/Tabbar/CustomTabBar.js index 6431fd3..c83c175 100644 --- a/src/components/Tabbar/CustomTabBar.js +++ b/src/components/Tabbar/CustomTabBar.js @@ -31,26 +31,16 @@ class CustomTabBar extends React.Component { static TAB_BAR_HEIGHT = 48; - activeColor: string; - inactiveColor: string; - state = { translateY: new Animated.Value(0), barSynced: false,// Is the bar synced with the header for animations? } - // shouldComponentUpdate(nextProps: Props): boolean { - // return (nextProps.theme.dark !== this.props.theme.dark) - // || (nextProps.state.index !== this.props.state.index); - // } - tabRef: Object; constructor(props) { super(props); this.tabRef = React.createRef(); - this.activeColor = props.theme.colors.primary; - this.inactiveColor = props.theme.colors.tabIcon; } onItemPress(route: Object, currentIndex: number, destIndex: number) { @@ -119,7 +109,7 @@ class CustomTabBar extends React.Component { } } - const color = isFocused ? this.activeColor : this.inactiveColor; + const color = isFocused ? this.props.theme.colors.primary : this.props.theme.colors.tabIcon; if (route.name !== "home") { return