Fix toolbar icon not updating

This commit is contained in:
Arnaud Vergnet 2020-04-16 00:09:43 +02:00
parent c52fa3a7d8
commit fe4d9ffecf

View file

@ -41,8 +41,9 @@ class AnimatedBottomBar extends React.Component<Props, State> {
this.displayModeIcons[DISPLAY_MODES.MONTH] = "calendar-range"; this.displayModeIcons[DISPLAY_MODES.MONTH] = "calendar-range";
} }
shouldComponentUpdate(nextProps: Props) { shouldComponentUpdate(nextProps: Props, nextState: State) {
return (nextProps.currentGroup !== this.props.currentGroup); return (nextProps.currentGroup !== this.props.currentGroup)
|| (nextState.currentMode !== this.state.currentMode);
} }
onScroll = (event: Object) => { onScroll = (event: Object) => {
@ -85,20 +86,9 @@ class AnimatedBottomBar extends React.Component<Props, State> {
style={{marginLeft: 5}} style={{marginLeft: 5}}
onPress={() => this.props.onPress('today', undefined)}/> onPress={() => this.props.onPress('today', undefined)}/>
</View> </View>
<View style={{ <View style={styles.fabContainer}>
position: "absolute",
left: 0,
right: 0,
alignItems: "center",
width: '100%',
height: '100%'
}}>
<FAB <FAB
style={{ style={styles.fab}
position: 'absolute',
alignSelf: 'center',
top: -10,
}}
icon="account-clock" icon="account-clock"
onPress={() => this.props.navigation.navigate('group-select')} onPress={() => this.props.navigation.navigate('group-select')}
/> />
@ -134,6 +124,19 @@ const styles = StyleSheet.create({
alignItems: 'center', alignItems: 'center',
borderRadius: 50, borderRadius: 50,
elevation: 2, elevation: 2,
},
fabContainer: {
position: "absolute",
left: 0,
right: 0,
alignItems: "center",
width: '100%',
height: '100%'
},
fab: {
position: 'absolute',
alignSelf: 'center',
top: -10,
} }
}); });