Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/animate-react-native/stagger
A cross-platform React Native Stagger component, powered by Reanimated
https://github.com/animate-react-native/stagger
react-native react-native-animation react-native-layout-animation react-native-stagger react-native-stagger-view reanimated2 reanimated3 stagger-animation
Last synced: 3 days ago
JSON representation
A cross-platform React Native Stagger component, powered by Reanimated
- Host: GitHub
- URL: https://github.com/animate-react-native/stagger
- Owner: animate-react-native
- License: mit
- Created: 2023-08-31T09:05:22.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-12T09:46:27.000Z (11 months ago)
- Last Synced: 2024-12-27T09:06:34.255Z (13 days ago)
- Topics: react-native, react-native-animation, react-native-layout-animation, react-native-stagger, react-native-stagger-view, reanimated2, reanimated3, stagger-animation
- Language: TypeScript
- Homepage: https://www.animatereactnative.com
- Size: 4.24 MB
- Stars: 160
- Watchers: 3
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
React Native Stagger
[![NPM Version](https://img.shields.io/npm/v/@animatereactnative/stagger.svg?style=flat&color=black)](https://www.npmjs.org/package/@animatereactnative/stagger) [![runs with expo](https://img.shields.io/badge/Runs%20with%20Expo-4630EB.svg?style=flat-square&logo=EXPO&labelColor=f3f3f3&logoColor=000)](https://expo.io/) [![npm](https://img.shields.io/npm/l/@animatereactnative/stagger?style=flat-square)](https://www.npmjs.com/package/@animatereactnative/stagger) [![npm](https://img.shields.io/badge/types-included-blue?style=flat-square)](https://www.npmjs.com/package/@animatereactnative/stagger)
React Native Stagger component, a cross-platform stagger orchestrator component, powered by Reanimated:
- 🔋 Powered by **Reanimated 3** Layout Animations
- 📱 Works with **Expo**
- ✅ Cross-platform (iOS, Android, Web - requires `reanimated@>=3.4.0`)
- ⚡️ 60-120fps
- 🪝 Works with any React Native element/component
- ⌨️ Written in TypeScript## Installation
```sh
npm install @animatereactnative/stagger
```> Also, you need to install [react-native-reanimated](https://github.com/software-mansion/react-native-reanimated), and follow their installation instructions.
## Usage
```js
import { Stagger } from '@animatereactnative/stagger';// ...
export function Example() {
return (
ZoomInEasyDown.springify()}
exiting={() => FadeOutDown.springify()}
style={{
flexDirection: 'row',
flexWrap: 'wrap',
justifyContent: 'center',
gap: 12,
}}
>
1. Custom duration
2. Custom stagger
3. Custom animation
4. Custom enter/exit direction
AnimateReactNative.com
Powered by Reanimated 3
Works with Expo ❤️
);
}
```## Props
| name | description | required | type | default |
| ---------------------- | ------------------------------------------------------------------------------------------------------------ | -------- | ------------------------------- | ------------- |
| `children` | Any component that you'd like to apply infinite scrolling / marquee effect | YES | `React.ReactNode` | 1 |
| `enabled` | Enable stagger animation | NO | `boolean` | true |
| `stagger` | Stagger duration between elements | NO | `number` | 50 |
| `duration` | Enter/Exit animation duration | NO | `number` | 400 |
| `enterDirection` | The direction of the animation. `1 -> top to bottom`, `-1 -> bottom to top` | NO | `number` | 0 |
| `exitDirection` | The direction of the animation. `1 -> top to bottom`, `-1 -> bottom to top` | NO | `number` | 0 |
| `initialEnteringDelay` | Initial enter animation delay | NO | number | 1 |
| `initialExistingDelay` | Initial exit animation delay | NO | number | -1 |
| `onEnterFinished` | callback to announce when the last item animation has finished (direction dependent) | NO | () => void | undefined |
| `onExitFinished` | callback to announce when the last item animation has finished (direction dependent) | NO | () => void | undefined |
| `enter` | [Reanimated Enter animation](https://www.reanimated3.com/docs/layout-animations/entering-exiting-animations) | NO | `() => ComplexAnimationBuilder` | `FadeInDown` |
| `exiting` | [Reanimated Exit animation](https://www.reanimated3.com/docs/layout-animations/entering-exiting-animations) | NO | `() => ComplexAnimationBuilder` | `FadeOutDown` |
| `style` | View style to be applied to Marquee container. | NO | `StyleProp` | |## Contributing
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
## License
[MIT](./LICENSE)
---