From fe4d9ffecfb307f75a7e83d7a2d74fb556f1f770 Mon Sep 17 00:00:00 2001 From: Arnaud Vergnet Date: Thu, 16 Apr 2020 00:09:43 +0200 Subject: [PATCH] Fix toolbar icon not updating --- src/components/Custom/AnimatedBottomBar.js | 33 ++++++++++++---------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/components/Custom/AnimatedBottomBar.js b/src/components/Custom/AnimatedBottomBar.js index 5729253..ac5cf7c 100644 --- a/src/components/Custom/AnimatedBottomBar.js +++ b/src/components/Custom/AnimatedBottomBar.js @@ -41,8 +41,9 @@ class AnimatedBottomBar extends React.Component { this.displayModeIcons[DISPLAY_MODES.MONTH] = "calendar-range"; } - shouldComponentUpdate(nextProps: Props) { - return (nextProps.currentGroup !== this.props.currentGroup); + shouldComponentUpdate(nextProps: Props, nextState: State) { + return (nextProps.currentGroup !== this.props.currentGroup) + || (nextState.currentMode !== this.state.currentMode); } onScroll = (event: Object) => { @@ -85,20 +86,9 @@ class AnimatedBottomBar extends React.Component { style={{marginLeft: 5}} onPress={() => this.props.onPress('today', undefined)}/> - + this.props.navigation.navigate('group-select')} /> @@ -134,6 +124,19 @@ const styles = StyleSheet.create({ alignItems: 'center', borderRadius: 50, elevation: 2, + }, + fabContainer: { + position: "absolute", + left: 0, + right: 0, + alignItems: "center", + width: '100%', + height: '100%' + }, + fab: { + position: 'absolute', + alignSelf: 'center', + top: -10, } });