Skip to content

Commit 156f91c

Browse files
author
Petr Konecny
committed
feat: add keepVisibleAfterExiting prop to SlideAnimatedVIew
1 parent f5f85be commit 156f91c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,6 @@
7272
"publishConfig": {
7373
"access": "public"
7474
},
75-
"repository": "https://github.com/strvcom/react-native-hero-carousel"
75+
"repository": "https://github.com/strvcom/react-native-hero-carousel",
76+
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
7677
}

src/components/SlideAnimatedView/index.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ type SlideAnimatedViewProps = {
1717
enteringThreshold?: number
1818
exitingThreshold?: number
1919
style?: AnimatedProps<ViewProps>['style']
20+
keepVisibleAfterExiting?: boolean
2021
}
2122

2223
export const SlideAnimatedView = ({
@@ -26,6 +27,7 @@ export const SlideAnimatedView = ({
2627
layout,
2728
enteringThreshold = 0.99,
2829
exitingThreshold = 0.01,
30+
keepVisibleAfterExiting = false,
2931
style,
3032
}: SlideAnimatedViewProps) => {
3133
const { index, total } = useAutoCarouselSlideIndex()
@@ -56,6 +58,9 @@ export const SlideAnimatedView = ({
5658
currentValue <= exitingThreshold &&
5759
(previousValue === null || previousValue > exitingThreshold)
5860
) {
61+
if (keepVisibleAfterExiting) {
62+
return
63+
}
5964
runOnJS(setShouldShow)(false)
6065
}
6166
},

0 commit comments

Comments
 (0)