All Projects → alexZajac → React Native Skeleton Content Nonexpo

alexZajac / React Native Skeleton Content Nonexpo

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

Programming Languages

typescript
32286 projects

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

React Native Skeleton Content
A customizable skeleton-like loading placeholder for react native projects using expo.
Stars: ✭ 221 (+140.22%)
Mutual labels:  skeleton, component, loader
React Content Loader
⚪ SVG-Powered component to easily create skeleton loadings.
Stars: ✭ 11,830 (+12758.7%)
Mutual labels:  skeleton, loader
React Native Pulse Loader
tinder-like loader for your react native app
Stars: ✭ 250 (+171.74%)
Mutual labels:  component, loader
Ocskeleton
[OCSkeleton] - Make your loading view a little difference.
Stars: ✭ 184 (+100%)
Mutual labels:  skeleton, loader
React Native Wormhole
⚛️ 🌌 Inter-dimensional Portals for React Native. 👽 🖖
Stars: ✭ 133 (+44.57%)
Mutual labels:  component, loader
Hitchcock
The Master of Suspense 🍿
Stars: ✭ 167 (+81.52%)
Mutual labels:  component, loader
Vue Content Placeholders
Composable components for rendering fake (progressive) content like facebook in vue
Stars: ✭ 1,547 (+1581.52%)
Mutual labels:  skeleton, loader
Reactprimer
React component prototyping tool that generates fully connected class component code.
Stars: ✭ 743 (+707.61%)
Mutual labels:  skeleton, component
Skeleton
💀 An easy way to create sliding CAGradientLayer animations! Works great for creating skeleton screens for loading content.
Stars: ✭ 587 (+538.04%)
Mutual labels:  skeleton, loader
Ngx Skeleton Loader
Make beautiful, animated loading skeletons that automatically adapt to your Angular apps
Stars: ✭ 278 (+202.17%)
Mutual labels:  skeleton, loader
Vue Loaders
Vue + loaders.css
Stars: ✭ 127 (+38.04%)
Mutual labels:  component, loader
Awloader
AWLoader is a UI Component that allows you to integrate loader that fits your needs within your app.
Stars: ✭ 11 (-88.04%)
Mutual labels:  component, loader
Vue Api Request
Control your API calls by using an amazing component which supports axios and vue-resource
Stars: ✭ 116 (+26.09%)
Mutual labels:  component, loader
Vue Element Loading
⏳ Loading inside a container or full screen for Vue.js
Stars: ✭ 234 (+154.35%)
Mutual labels:  component, loader
react-skeleton-loader
A react helper for skeleton loaders
Stars: ✭ 61 (-33.7%)
Mutual labels:  skeleton, loader
Skeleton Elements
Skeleton elements - UI for improved perceived performance
Stars: ✭ 27 (-70.65%)
Mutual labels:  skeleton, loader
React Async Fetcher
React component for asynchronous loading/fetch online data
Stars: ✭ 50 (-45.65%)
Mutual labels:  component, loader
React Swipeable List
Swipeable list component for React.
Stars: ✭ 86 (-6.52%)
Mutual labels:  component
Ngx Youtube Player
(ngx) A youtube component wrapped with Angular (typescript)
Stars: ✭ 89 (-3.26%)
Mutual labels:  component
Security Core
Security provides an infrastructure for sophisticated authorization systems, which makes it possible to easily separate the actual authorization logic from so called user providers that hold the users credentials. It is inspired by the Java Spring framework.
Stars: ✭ 1,264 (+1273.91%)
Mutual labels:  component

React Native Skeleton Content Nonexpo

This the not-expo dependant version of this package.

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-nonexpo

This package requires the react-native-linear-gradient package, make sure it's installed and working on your project.

Also install the following peer dependencies as the package depends on them. We prefer you install these dependencies inorder to prevent double instance errors.

npm install react-native-reanimated

Usage

  1. Import react-native-skeleton-content:
import SkeletonContent from 'react-native-skeleton-content-nonexpo';
  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 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].