react-native-fiesta
Version:
A set of celebration animations powered by Skia. Engage more with your users by celebrating in your React Native application.
25 lines • 687 B
JavaScript
import React, { memo, useEffect } from 'react';
import { Text } from '@shopify/react-native-skia';
import { useSharedValue, withSpring } from 'react-native-reanimated';
import { singleItemFadeSpeed } from '../constants/speed';
export const Emoji = /*#__PURE__*/memo(({
x = 0,
y = 0,
autoHide = true,
emoji = '🎉',
font
}) => {
const opacity = useSharedValue(1);
useEffect(() => {
opacity.value = withSpring(autoHide ? 0 : 1, singleItemFadeSpeed);
}, [autoHide, opacity]);
if (!font) return null;
return /*#__PURE__*/React.createElement(Text, {
x: x,
y: y,
text: emoji,
opacity: opacity,
font: font
});
});
//# sourceMappingURL=Emoji.js.map