UNPKG

react-native-dynamic-shimmer

Version:
31 lines (30 loc) 1.38 kB
import { type DimensionValue } from 'react-native'; /** * Generates styles for shimmer components based on child element properties and dimensions. * * This function computes the appropriate styles for a shimmer component, * considering the aspect ratio of the child element and the dimensions * of its parent. It flattens the child style, calculates the required width * and height, and returns the styles necessary for rendering the shimmer. * * @param child - The child JSX element for which to generate shimmer styles. * @param numericWidth - An optional numeric width to use if the child style does not specify one. * @param parentHeight - The height of the parent container (default is the screen height). * @param parentWidth - The width of the parent container (default is the screen width). * @returns An object containing the shimmer styles for the child element. */ declare const shimmerStyles: ({ child, numericWidth, parentHeight, parentWidth, }: { child?: JSX.Element; numericWidth?: number; parentHeight?: DimensionValue | undefined; parentWidth?: number; }) => { shimmerStylesForEachChild: { backgroundColor: string; overflow: "hidden"; margin: number | "auto" | `${number}%` | import("react-native").Animated.AnimatedNode; width: number; height: number; }; }; export default shimmerStyles;