From ff29e92d7b069ea851658b85264a3b5926f18dd1 Mon Sep 17 00:00:00 2001 From: osama jamil Date: Tue, 26 Sep 2023 02:01:14 +0300 Subject: [PATCH 1/2] feat: added enabled prop --- src/index.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/index.tsx b/src/index.tsx index c3216a1..67f0d8b 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -9,6 +9,10 @@ import Animated, { import type { ViewStyle } from 'react-native'; export type StaggerProps = React.PropsWithChildren<{ + enabled?: boolean; + /** + * to enable or disable the stagger animation + */ stagger?: number; /** * The direction of the enter animation. @@ -54,6 +58,7 @@ export type StaggerProps = React.PropsWithChildren<{ }>; export function Stagger({ children, + enabled = true, stagger = 50, enterDirection = 1, exitDirection = -1, @@ -68,6 +73,10 @@ export function Stagger({ return null; } + if (!enabled) { + return {children}; + } + return ( {React.Children.map(children, (child, index) => { @@ -101,4 +110,4 @@ export function Stagger({ })} ); -} +} \ No newline at end of file From 104771c2184248459318c36be421a7d00b00a7b2 Mon Sep 17 00:00:00 2001 From: osama jamil Date: Tue, 26 Sep 2023 02:01:41 +0300 Subject: [PATCH 2/2] docs: enabled prop documentation --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 72c7b66..29d88a1 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ export function Example() { | 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 |