All Projects → alexZajac → React Native Skeleton Content

alexZajac / React Native Skeleton Content

Licence: mit
A customizable skeleton-like loading placeholder for react native projects using expo.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to React Native Skeleton Content

React Native Skeleton Content Nonexpo
A customizable skeleton-like loading placeholder for react native projects not using expo.
Stars: ✭ 92 (-58.37%)
Mutual labels:  skeleton, component, loader
Awloader
AWLoader is a UI Component that allows you to integrate loader that fits your needs within your app.
Stars: ✭ 11 (-95.02%)
Mutual labels:  component, loader
Reactprimer
React component prototyping tool that generates fully connected class component code.
Stars: ✭ 743 (+236.2%)
Mutual labels:  skeleton, component
React Async Fetcher
React component for asynchronous loading/fetch online data
Stars: ✭ 50 (-77.38%)
Mutual labels:  component, loader
react-skeleton-loader
A react helper for skeleton loaders
Stars: ✭ 61 (-72.4%)
Mutual labels:  skeleton, loader
Ngx Skeleton Loader
Make beautiful, animated loading skeletons that automatically adapt to your Angular apps
Stars: ✭ 278 (+25.79%)
Mutual labels:  skeleton, loader
Skeleton Elements
Skeleton elements - UI for improved perceived performance
Stars: ✭ 27 (-87.78%)
Mutual labels:  skeleton, loader
React Content Loader
⚪ SVG-Powered component to easily create skeleton loadings.
Stars: ✭ 11,830 (+5252.94%)
Mutual labels:  skeleton, loader
Vue Loaders
Vue + loaders.css
Stars: ✭ 127 (-42.53%)
Mutual labels:  component, loader
Vue Api Request
Control your API calls by using an amazing component which supports axios and vue-resource
Stars: ✭ 116 (-47.51%)
Mutual labels:  component, loader
React Native Pulse Loader
tinder-like loader for your react native app
Stars: ✭ 250 (+13.12%)
Mutual labels:  component, loader
Hitchcock
The Master of Suspense 🍿
Stars: ✭ 167 (-24.43%)
Mutual labels:  component, loader
Vue Element Loading
⏳ Loading inside a container or full screen for Vue.js
Stars: ✭ 234 (+5.88%)
Mutual labels:  component, loader
Skeleton
💀 An easy way to create sliding CAGradientLayer animations! Works great for creating skeleton screens for loading content.
Stars: ✭ 587 (+165.61%)
Mutual labels:  skeleton, loader
Vue Content Placeholders
Composable components for rendering fake (progressive) content like facebook in vue
Stars: ✭ 1,547 (+600%)
Mutual labels:  skeleton, loader
React Native Wormhole
⚛️ 🌌 Inter-dimensional Portals for React Native. 👽 🖖
Stars: ✭ 133 (-39.82%)
Mutual labels:  component, loader
Ocskeleton
[OCSkeleton] - Make your loading view a little difference.
Stars: ✭ 184 (-16.74%)
Mutual labels:  skeleton, loader
Browser Kit
The BrowserKit component simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms programmatically.
Stars: ✭ 2,563 (+1059.73%)
Mutual labels:  component
Axs
Stupid simple style components for React
Stars: ✭ 214 (-3.17%)
Mutual labels:  component
React Native Action Button
customizable multi-action-button component for react-native
Stars: ✭ 2,408 (+989.59%)
Mutual labels:  component

React Native Skeleton Content

If you are not using expo, please head up to this page instead.

React native Skeleton Content, a simple yet fully customizable component made to achieve loading animation in a Skeleton-style. Works in both iOS and Android.

New Features

  • The package has been rewritten to Hooks and is using the declarative react-native-reanimated package for animations
  • It now supports nested layouts for children bones, see an example on this snack
  • It finally supports percentages dimensions for bones, for any type of animation!

Build Status Coverage Status npm version

Installation

npm install react-native-skeleton-content

Usage

  1. Import react-native-skeleton-content:
import SkeletonContent from 'react-native-skeleton-content';
  1. Once you create the SkeletonContent, you have two options:
  • 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). Herunder is the example with a custom layout. A key prop for each child is optionnal but highly recommended.
export default function Placeholder() {
  return (
    <SkeletonContent
      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>
    </SkeletonContent>
  );
}
  1. Then simply sync the prop isLoading to your state to show/hide the SkeletonContent when the assets/data are available to the user.
export default function Placeholder () {
  const [loading, setLoading] = useState(true);
  return (
    <SkeletonContent
       containerStyle={{flex: 1, width: 300}}
        isLoading={isLoading}>
        {...otherProps}
    />
  )
}

Props

Name Type Default Description
isLoading bool required Shows the Skeleton bones when true
layout array of objects [] A custom layout for the Skeleton bones
duration number 1200 ms Duration of one cycle of animation
containerStyle object flex: 1 The style applied to the View containing the bones
easing Easing bezier(0.5, 0, 0.25, 1) Easing of the bones animation
animationType string "shiver" The animation to be used for animating the bones (see demos below)
animationDirection string "horizontalRight" Used only for shiver animation, describes the direction and end-point (ex: horizontalRight goes on the x-axis from left to right)
boneColor string "#E1E9EE" Color of the bones
highlightColor string "#F2F8FC" Color of the highlight of the bones

Note: The Easing type function is the one provided by react-native-reanimated, so if you want to change the default you will have to install it as a dependency.

Examples

See the playground section to experiment : 1 - Changing the direction of the animation (animationDirection prop) :

export default function Placeholder () {
  return (
    <SkeletonContent
        containerStyle={{flex: 1, width: 300}}
        animationDirection="horizontalLeft"
        isLoading={true}>
        ...
    />
  )
}

2 - Changing the colors and switching to "pulse" animation (boneColor, highlightColor and animationType prop) :

export default function Placeholder () {
  return (
    <SkeletonContent
        containerStyle={{flex: 1, width: 300}}
        boneColor="#121212"
        highlightColor="#333333"
        animationType="pulse"
        isLoading={true}>
        ...
    />
  )
}

3 - Customizing the layout of the bones (layout prop) :

export default function Placeholder () {
  return (
    <SkeletonContent
        containerStyle={{flex: 1, width: 300}}
        animationDirection="horizontalLeft"
        layout={[
        // long line
        { width: 220, height: 20, marginBottom: 6 },
        // short line
        { width: 180, height: 20, marginBottom: 6 },
        ...
        ]}
        isLoading={true}>
        ...
    />
  )
}

Playground

You can test out the features and different props easily on Snack. Don't hesitate to take contact if anything is unclear !

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].