An open API service indexing awesome lists of open source software.

https://github.com/iagormoraes/react-native-skelleton

A simple skeleton component view
https://github.com/iagormoraes/react-native-skelleton

Last synced: about 1 year ago
JSON representation

A simple skeleton component view

Awesome Lists containing this project

README

          

# react-native-skelleton

A skelleton solution done in native view, with it you can wrap any view component to enhance your user experience.

## Installation

##### NPM
```sh
npm install react-native-skelleton
```

##### Yarn
```sh
yarn add react-native-skelleton
```

## Usage

```typescript jsx
import SkelletonView from 'react-native-skelleton';

...
render() {
return(

)
}
```

### With SkelletonGroupView

```typescript jsx
import SkelletonView, { SkelletonGroupView } from 'react-native-skelleton';

render() {
return (



)
}
```
This component accepts any children component class, it will search recursively for the SkelletonView class and animate them.

⚠️ Use this if you to animate a group of skeletons in sync, without it they will not be in sync as the timer is not controlled by the AnimatorSet.

## Props and types

```typescript
export enum SkelletonRepeatMode {
RESTART = 1,
REVERSE = 2,
}

// default is AccelerateDecelerateInterpolator
export type SkelletonInterpolator =
| 'AccelerateDecelerateInterpolator'
| 'AccelerateInterpolator'
| 'AnticipateInterpolator'
| 'AnticipateOvershootInterpolator'
| 'BounceInterpolator'
| 'CycleInterpolator'
| 'DecelerateInterpolator'
| 'LinearInterpolator'
| 'OvershootInterpolator';

export type SkelletonGroupProps = {
children?: React.ReactElement | React.ReactElement[];
duration?: number;
startDelay?: number;
interpolator?: SkelletonInterpolator;
style?: ViewStyle;
};

export type SkelletonProps = {
children?: React.ReactElement | React.ReactElement[];
color?: string;
autoStart?: boolean;
duration?: number;
startDelay?: number;
repeatDelay?: number;
repeatMode?: SkelletonRepeatMode.RESTART | SkelletonRepeatMode.REVERSE;
repeatCount?: number;
interpolator?: SkelletonInterpolator;
style?: ViewStyle;
};
```

## Known Issues

- animation between views that are not wrapped with SkelletonGroupView is not 100% in sync.
- repeatDelay only works without using SkelletonGroupView.

## Contributing

See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.

## License

MIT