2020-08-16 18:59:07 +05:00
|
|
|
import React from 'react';
|
|
|
|
|
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
2020-09-21 15:40:19 +05:00
|
|
|
import {useTracked} from '../../provider';
|
|
|
|
|
import {PressableButton} from '../PressableButton';
|
2020-10-13 17:02:14 +05:00
|
|
|
import {SIZE} from "../../utils/SizeUtils";
|
2020-09-21 15:40:19 +05:00
|
|
|
|
|
|
|
|
export const ActionIcon = ({
|
|
|
|
|
onPress,
|
|
|
|
|
name,
|
|
|
|
|
color,
|
|
|
|
|
customStyle,
|
|
|
|
|
size = SIZE.xxxl,
|
2020-09-27 12:25:54 +05:00
|
|
|
iconStyle = {},
|
|
|
|
|
left = 10,
|
|
|
|
|
right = 10,
|
2020-09-29 23:14:07 +05:00
|
|
|
testID,
|
2020-09-21 15:40:19 +05:00
|
|
|
}) => {
|
|
|
|
|
const [state, dispatch] = useTracked();
|
|
|
|
|
const {colors} = state;
|
2020-08-16 18:59:07 +05:00
|
|
|
|
|
|
|
|
return (
|
2020-09-21 15:40:19 +05:00
|
|
|
<PressableButton
|
2020-09-29 23:14:07 +05:00
|
|
|
testID={testID}
|
2020-08-16 18:59:07 +05:00
|
|
|
onPress={onPress}
|
2020-09-27 12:25:54 +05:00
|
|
|
hitSlop={{top: 30, left: left, right: right, bottom: 30}}
|
2020-09-21 15:40:19 +05:00
|
|
|
color="transparent"
|
|
|
|
|
selectedColor={colors.nav}
|
|
|
|
|
alpha={!colors.night ? -0.02 : 0.02}
|
|
|
|
|
opacity={1}
|
|
|
|
|
customStyle={{
|
|
|
|
|
width: 40,
|
|
|
|
|
height: 40,
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
alignItems: 'center',
|
2020-09-27 12:25:54 +05:00
|
|
|
borderRadius: 100,
|
2020-09-21 15:40:19 +05:00
|
|
|
...customStyle,
|
2020-10-13 17:02:14 +05:00
|
|
|
|
2020-09-21 15:40:19 +05:00
|
|
|
}}>
|
|
|
|
|
<Icon name={name} style={iconStyle} color={color} size={size} />
|
|
|
|
|
</PressableButton>
|
2020-08-16 18:59:07 +05:00
|
|
|
);
|
|
|
|
|
};
|