import React, { forwardRef } from 'react'; import type { VariantProps } from '@gluestack-ui/utils/nativewind-utils'; import { View } from 'react-native'; import { skeletonStyle, skeletonTextStyle } from './styles'; type ISkeletonProps = React.ComponentProps & VariantProps & { isLoaded?: boolean; startColor?: string; speed?: number | string; }; type ISkeletonTextProps = React.ComponentProps & VariantProps & { _lines?: number; isLoaded?: boolean; startColor?: string; }; const Skeleton = forwardRef, ISkeletonProps>( function Skeleton( { className, variant, children, startColor = 'bg-accent', isLoaded = false, speed = 4, ...props }, ref ) { if (!isLoaded) { return ( ); } else { return children; } } ); const SkeletonText = forwardRef< React.ComponentRef, ISkeletonTextProps >(function SkeletonText( { className, _lines, isLoaded = false, startColor = 'bg-accent', gap = 2, children, ...props }, ref ) { if (!isLoaded) { if (_lines) { return ( {Array.from({ length: _lines }).map((_, index) => ( ))} ); } else { return ( ); } } else { return children; } }); Skeleton.displayName = 'Skeleton'; SkeletonText.displayName = 'SkeletonText'; export { Skeleton, SkeletonText };