forked from vergnet/application-amicale
Improve tab home button display
This commit is contained in:
parent
5b13eacc12
commit
5c1052fbd4
1 changed files with 6 additions and 24 deletions
|
@ -31,7 +31,6 @@ type PropsType = {
|
||||||
focused: boolean,
|
focused: boolean,
|
||||||
onPress: () => void,
|
onPress: () => void,
|
||||||
onLongPress: () => void,
|
onLongPress: () => void,
|
||||||
theme: CustomThemeType,
|
|
||||||
tabBarHeight: number,
|
tabBarHeight: number,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -84,20 +83,9 @@ class TabHomeIcon extends React.Component<PropsType> {
|
||||||
color: string,
|
color: string,
|
||||||
}): React.Node => {
|
}): React.Node => {
|
||||||
const {focused} = this.props;
|
const {focused} = this.props;
|
||||||
if (focused)
|
|
||||||
return (
|
|
||||||
<Image
|
|
||||||
source={FOCUSED_ICON}
|
|
||||||
style={{
|
|
||||||
width: size,
|
|
||||||
height: size,
|
|
||||||
tintColor: color,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
return (
|
return (
|
||||||
<Image
|
<Image
|
||||||
source={UNFOCUSED_ICON}
|
source={focused ? FOCUSED_ICON : UNFOCUSED_ICON}
|
||||||
style={{
|
style={{
|
||||||
width: size,
|
width: size,
|
||||||
height: size,
|
height: size,
|
||||||
|
@ -115,15 +103,7 @@ class TabHomeIcon extends React.Component<PropsType> {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
}}>
|
}}>
|
||||||
<TouchableRipple
|
<View
|
||||||
onPress={props.onPress}
|
|
||||||
onLongPress={props.onLongPress}
|
|
||||||
borderless
|
|
||||||
rippleColor={
|
|
||||||
Platform.OS === 'android'
|
|
||||||
? props.theme.colors.primary
|
|
||||||
: 'transparent'
|
|
||||||
}
|
|
||||||
style={{
|
style={{
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
|
@ -137,16 +117,18 @@ class TabHomeIcon extends React.Component<PropsType> {
|
||||||
easing="ease-out"
|
easing="ease-out"
|
||||||
animation={props.focused ? 'fabFocusIn' : 'fabFocusOut'}
|
animation={props.focused ? 'fabFocusIn' : 'fabFocusOut'}
|
||||||
icon={this.getIconRender}
|
icon={this.getIconRender}
|
||||||
|
onPress={props.onPress}
|
||||||
|
onLongPress={props.onLongPress}
|
||||||
style={{
|
style={{
|
||||||
marginTop: 15,
|
marginTop: 15,
|
||||||
marginLeft: 'auto',
|
marginLeft: 'auto',
|
||||||
marginRight: 'auto',
|
marginRight: 'auto',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</TouchableRipple>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default withTheme(TabHomeIcon);
|
export default TabHomeIcon;
|
||||||
|
|
Loading…
Reference in a new issue