Technetium 101(React Native): Skeleton Screens Packages
*This article covers the Skeleton Screen Packages in React Native options crafted to encourage usability.
A skeleton UI resembles the page’s actual UI, so users will understand how quickly the mobile app will load even before the content has shown up. Here are the skeleton screens packages you might want to consider using in your next project:
Skeleton Screen Packages in React Native
rn-placeholder
- Style
- Make use of it as component
- Props Animation
- Fade
- Loader
- Progressive
- Raw
- Shine
- ShineOverlay
- Props
- PlaceholderMedia = image placeholder
- PlaceholderLine = text placeholder
- Example
- importPlaceholderPlaceholderMediaPlaceholderLineFadefrom "rn-placeholder";const App =<PlaceholderAnimation={Fade} style={{ marginVertical: 6, marginHorizontal: 15, borderRadius: 4, }} Left={props => ( <PlaceholderMedia style={[ props.style, { width: responsiveWidth(22), height: responsiveHeight(16), }, ]} /> )} > <PlaceholderLine style={{ marginTop: responsiveHeight(1) }} width={70} /> <PlaceholderLine style={{ marginTop: responsiveHeight(1.5) }} width={50} /> <PlaceholderLine width={50} /> </Placeholder>;
react-native-skeleton-content-nonexpo
- Style
- Make use of it as wrapper/inline styling
- Child Layout : The component will figure out the layout of its bones with the dimensions of its direct children.
- Custom Layout : You provide a prop layout to the component specifying the size of the bones (see the Examples section below).
- A key prop is optional but highly recommended.
- Props animationType
- shiver (default)
- pulse
- Props
- isLoading = boolean (required)
- animationDirection = "horizontalRight" (default), "horizontalLeft"
- boneColor = Color of the bones "#E1E9EE" (default)
- highlightColor = Color of the highlight of the bones "#F2F8FC" (default)
- duration = 1200 ms (default)
- Example
- import SkeletonContent from "react-native-skeleton-content-nonexpo";const App =<SkeletonContentcontainerStyle={{flex:1, flexDirection:'row', padding:10}} // animationDirection="horizontalLeft" // boneColor="#121212" // highlightColor="#333333" // animationType="pulse" isLoading={!this.state.isLoading} layout={[ { key: "title" , width: 100, height: 100}, { flex:1, flexDirection: 'column', marginLeft: 10, children: [ { width: "100%", height: "50%", marginBottom: 10 }, { width: "50%", height: "20%", marginBottom: 10 } ] }, ]} >...{your data}...</SkeletonContent>;
Comments
Post a Comment