Skip to content

Commit d6a5657

Browse files
author
Petr Konecny
committed
fix: some additional fixes
1 parent 34ccc8f commit d6a5657

File tree

6 files changed

+19
-5
lines changed

6 files changed

+19
-5
lines changed

example/examples/BasicExample.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default function BasicExample() {
3030
}, [])
3131

3232
return (
33-
<CarouselContextProvider disableInfiniteScroll>
33+
<CarouselContextProvider>
3434
<SafeAreaView style={styles.container}>
3535
<View style={styles.container}>
3636
<HeroCarousel>
@@ -59,7 +59,6 @@ const styles = StyleSheet.create({
5959
width: '100%',
6060
height: '100%',
6161
transformOrigin: 'center',
62-
transform: [{ scale: 1.6 }],
6362
},
6463
gradient: {
6564
position: 'absolute',

example/examples/EnteringAnimationExample.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ const styles = StyleSheet.create({
8686
width: '100%',
8787
height: '100%',
8888
transformOrigin: 'center',
89-
transform: [{ scale: 1.6 }],
9089
},
9190
gradient: {
9291
position: 'absolute',

example/examples/OffsetExample.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ const styles = StyleSheet.create({
148148
width: '100%',
149149
height: '100%',
150150
transformOrigin: 'center',
151-
transform: [{ scale: 1.6 }],
152151
},
153152
gradient: {
154153
position: 'absolute',

example/examples/TimerPaginationExample.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ const styles = StyleSheet.create({
9393
width: '100%',
9494
height: '100%',
9595
transformOrigin: 'center',
96-
transform: [{ scale: 1.6 }],
9796
},
9897
gradient: {
9998
position: 'absolute',

src/utils/__tests__/interpolateInsideCarousel.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,23 @@ describe('interpolateInsideCarousel', () => {
264264
expect(result).toBe(1)
265265
})
266266

267+
it('should correclty mirror between first and last slide', () => {
268+
const result = interpolateInsideCarousel(6, 6, 7, {
269+
valueBefore: 0,
270+
thisValue: 1,
271+
valueAfter: 0,
272+
offset: 0,
273+
})
274+
expect(result).toBe(1)
275+
const result2 = interpolateInsideCarousel(6, 1, 7, {
276+
valueBefore: 0,
277+
thisValue: 1,
278+
valueAfter: 0,
279+
offset: 0,
280+
})
281+
expect(result2).toBe(1)
282+
})
283+
267284
it('should correctly mirror between last and first slide with offset', () => {
268285
const result = interpolateInsideCarousel(6, 1, 7, {
269286
valueBefore: 1,

src/utils/interpolateInsideCarousel.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export const interpolateInsideCarousel = (
2929
const getAdjustedIndex = (slideIndex: number) => {
3030
if (slideIndex === 0) return Math.max(totalLength - 2, 0)
3131
if (slideIndex === totalLength - 1) return 1
32+
if (slideIndex === 1) return totalLength - 1
3233
return slideIndex
3334
}
3435

0 commit comments

Comments
 (0)