react-native-animatable
react-native-animatable copied to clipboard
onPress is not working with custom button component
const DoneButton = ({onClick, animation, showDoneBtn}) => {
return (
<Animatable.View animation={animation} duration={150}>
<ThemeButton
buttonStyle={{...styles.doneBtnStyle, opacity: showDoneBtn ? 1 : 0}}
icon={<Icon name="arrow-forward" color="#fff" size={24} />}
onPress={onClick}
/>
</Animatable.View>
);
};
my onClick
function is not being called since I have wrapped the button in <Animatable.View>
Same problem here.
The workaround I found is to have animation inside the element with an onPress.
<ThemeButton onPress={onClick}>
<Animatable.View animation={animation} duration={150}>
<Text>My text</Text>
</Animatable.View>
<ThemeButton>