How to use Skeleton with Custom Layout
mainIn Custom Layout mode, you provide a layout prop to the Skeleton component. This prop is an array of objects where each object specifies the dimensions and styling for a specific bone. It is highly recommended to provide a unique key for each object in the layout array. This mode is useful when you want the skeleton to look different from the actual content being loaded.
import Skeleton from "react-native-reanimated-skeleton";
export default function Placeholder() {
return (
<Skeleton
containerStyle={{ flex: 1, width: 300 }}
isLoading={false}
layout=[
{ key: "someId", width: 220, height: 20, marginBottom: 6 },
{ key: "someOtherId", width: 180, height: 20, marginBottom: 6 },
]
>
<Text style={styles.normalText}>Your content</Text>
<Text style={styles.bigText}>Other content</Text>
</Skeleton>
);
}