Skip to content

Commit 2756dbe

Browse files
author
Petr Konecny
committed
chore: rename slide to item
1 parent 891f599 commit 2756dbe

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

src/components/HeroCarousel/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { HeroCarouselAdapter } from '../AnimatedPagedView/Adapter'
66
import { useAutoScroll } from '../../hooks/useAutoScroll'
77
import { useInfiniteScroll } from '../../hooks/useInfiniteScroll'
88
import { DEFAULT_INTERVAL } from './index.preset'
9-
import { SlideAnimatedView } from '../SlideAnimatedView'
9+
import { ItemAnimatedView } from '../ItemAnimatedView'
1010

1111
export type HeroCarouselProps = {
1212
children: React.ReactNode[]
@@ -74,7 +74,7 @@ const HeroCarousel = ({ children }: HeroCarouselProps) => {
7474
)
7575
}
7676

77-
HeroCarousel.AnimatedView = SlideAnimatedView
77+
HeroCarousel.AnimatedView = ItemAnimatedView
7878
HeroCarousel.Provider = CarouselContextProvider
7979
HeroCarousel.Item = HeroCarouselSlide
8080

src/components/HeroCarouselSlide/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { View } from 'react-native'
2-
import { HeroCarouselSlideContext } from '../../context/SlideContext'
2+
import { ItemContext } from '../../context/ItemContext'
33
import { useAutoScroll } from '../../hooks/useAutoScroll'
44
import { useMemo } from 'react'
55
import { useManualScroll } from '../../hooks/useManualScroll'
@@ -21,14 +21,14 @@ export const HeroCarouselSlide = ({
2121
}) => {
2222
return (
2323
<View style={{ flex: 1, width, minWidth: width }}>
24-
<HeroCarouselSlideContext.Provider
24+
<ItemContext.Provider
2525
value={useMemo(
2626
() => ({ index, total, runAutoScroll, goToPage }),
2727
[index, total, runAutoScroll, goToPage],
2828
)}
2929
>
3030
{children}
31-
</HeroCarouselSlideContext.Provider>
31+
</ItemContext.Provider>
3232
</View>
3333
)
3434
}

src/components/SlideAnimatedView/index.tsx renamed to src/components/ItemAnimatedView/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { useState } from 'react'
88
import { ViewProps } from 'react-native'
99
import { useInterpolateInsideCarousel } from '../../hooks/useInterpolateInsideCarousel'
1010

11-
type SlideAnimatedViewProps = {
11+
type ItemAnimatedViewProps = {
1212
children: React.ReactNode
1313
entering?: AnimatedProps<ViewProps>['entering']
1414
exiting?: AnimatedProps<ViewProps>['exiting']
@@ -19,7 +19,7 @@ type SlideAnimatedViewProps = {
1919
keepVisibleAfterExiting?: boolean
2020
}
2121

22-
export const SlideAnimatedView = ({
22+
export const ItemAnimatedView = ({
2323
children,
2424
entering,
2525
exiting,
@@ -28,7 +28,7 @@ export const SlideAnimatedView = ({
2828
exitingThreshold = 0.01,
2929
keepVisibleAfterExiting = false,
3030
style,
31-
}: SlideAnimatedViewProps) => {
31+
}: ItemAnimatedViewProps) => {
3232
const progress = useInterpolateInsideCarousel({
3333
valueBefore: 0,
3434
thisValue: 1,
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ import { createContext, useContext } from 'react'
22
import { useAutoScroll } from '../../hooks/useAutoScroll'
33
import { useManualScroll } from '../../hooks/useManualScroll'
44

5-
export const HeroCarouselSlideContext = createContext<{
5+
export const ItemContext = createContext<{
66
index: number
77
total: number
88
runAutoScroll: ReturnType<typeof useAutoScroll>['runAutoScroll']
99
goToPage: ReturnType<typeof useManualScroll>['goToPage']
1010
} | null>(null)
1111

1212
export const useAutoCarouselSlideIndex = () => {
13-
const context = useContext(HeroCarouselSlideContext)
13+
const context = useContext(ItemContext)
1414
if (!context) {
1515
throw new Error('useAutoCarouselSlideIndex must be used within a AutoCarouselSlide')
1616
}

src/context/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
export { useCarouselContext } from './CarouselContext'
2-
export * from './SlideContext'
2+
export * from './ItemContext'

0 commit comments

Comments
 (0)