Skeleton
Moti's skeleton component is great for showing animated loading states. It works on all platforms, including web.
Install#
Prior to version 0.17.0, the skeleton was installed as its own package. This is no longer the case.
If you have @motify/skeleton in your package.json, be sure to delete it and upgrade moti.
Peer dependency#
You'll also want to install expo-linear-gradient.
Please note that you must have Reanimated 2 installed. See installation steps for more info.
If you're using Expo:#
If you aren't using Expo:#
- npm
- Yarn
Please make sure you complete any installation steps required for Expo's linear gradient component.
Video#
Usage#
Show/hide#
Skeleton will hide when data exists by default.
You can always show the skeleton:
Or hide it:
Border radius#
Use radius to show a circle, square, or custom border radius. Defaults to 8.
Circle#
Square#
Custom radius#
Color modes#
light or dark
Custom animation delay#
Custom animation transition#
Full example#
Here's the code from the video above:
<Skeleton.Group />#
If you have many skeleton components, you can now wrap them with a single <Skeleton.Group show={loading} /> component. This will help you achieve this type of effect.