UNPKG

@ramses-superapp/ramses-ui

Version:

Skinless UI primitives for Ramses Built Apps

38 lines (37 loc) 941 B
"use strict"; import { forwardRef, useEffect, useRef } from 'react'; import { Animated } from 'react-native'; import { jsx as _jsx } from "react/jsx-runtime"; const RsSkeleton = /*#__PURE__*/forwardRef(({ width, height, borderRadius, style }, ref) => { const opacity = useRef(new Animated.Value(0.3)).current; useEffect(() => { const animation = Animated.loop(Animated.sequence([Animated.timing(opacity, { toValue: 1, duration: 800, useNativeDriver: true }), Animated.timing(opacity, { toValue: 0.3, duration: 800, useNativeDriver: true })])); animation.start(); return () => animation.stop(); }, [opacity]); return /*#__PURE__*/_jsx(Animated.View, { ref: ref, style: [{ width, height, borderRadius, opacity }, style] }); }); RsSkeleton.displayName = 'RsSkeleton'; export default RsSkeleton; //# sourceMappingURL=RsSkeleton.js.map