2.0.9 • Published 4 years ago

rn-skeleton v2.0.9

Weekly downloads
1
License
ISC
Repository
github
Last release
4 years ago

SkeletonPlaceholder

SkeletonPlaceholder is a React Native library to easily create an amazing loading effect. ANDROID & IOS

npm.io

Installation

Note: If your project already includes the react-native-linear-gradient you can skip the Step #1

Step #1

Using yarn:

yarn add react-native-linear-gradient

Using npm:

npm install  react-native-linear-gradient --save

If you are running a react-native version below 0.60:

react-native link react-native-linear-gradient

Otherwise:

cd ios
pod install

  

Step #2

Using yarn:

yarn add react-native-skeleton-placeholder

Using npm:

npm install react-native-skeleton-placeholder --save

Usage

There are two ways to use this package:

with SkeletonPlacehoder.Item 🆕

import React from "react";
import { View } from "react-native";
import SkeletonPlaceholder from "react-native-skeleton-placeholder";

const App = () => {
  return (
    <SkeletonPlaceholder>
      <SkeletonPlaceholder.Item flexDirection="row" alignItems="center">
        <SkeletonPlaceholder.Item width={60} height={60} borderRadius={50} />
        <SkeletonPlaceholder.Item marginLeft={20}>
          <SkeletonPlaceholder.Item width={120} height={20} borderRadius={4} />
          <SkeletonPlaceholder.Item
            marginTop={6}
            width={80}
            height={20}
            borderRadius={4}
          />
        </SkeletonPlaceholder.Item>
      </SkeletonPlaceholder.Item>
    </SkeletonPlaceholder>
  );
};

or with View

import React from "react";
import { View } from "react-native";
import SkeletonPlaceholder from "react-native-skeleton-placeholder";

const App = () => {
  return (
    <SkeletonPlaceholder>
      <View style={{ flexDirection: "row", alignItems: "center" }}>
        <View style={{ width: 60, height: 60, borderRadius: 50 }} />
        <View style={{ marginLeft: 20 }}>
          <View style={{ width: 120, height: 20, borderRadius: 4 }} />
          <View
            style={{ marginTop: 6, width: 80, height: 20, borderRadius: 4 }}
          />
        </View>
      </View>
    </SkeletonPlaceholder>
  );
};

Properties

SkeletonPlaceholder

PropDescriptionTypeDefault
backgroundColorDetermines the color of placeholderstring#E1E9EE
highlightColorDetermines the highlight color of placeholderstring#F2F8FC
speedDetermines the animation speed in millisecondsnumber800

SkeletonPlaceholder.Item

PropDescriptionTypeDefault
anyAny view style props was acceptedany

Contributing

Any help this module will be appreciated!

License

MIT

2.0.9

4 years ago

2.0.7

4 years ago

2.0.8

4 years ago

2.0.6

4 years ago

2.0.5

4 years ago

2.0.4

4 years ago

2.0.3

4 years ago