Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Commit

Permalink
fix: animatedIndex on initial position
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Smith authored and Andrew Smith committed Oct 2, 2019
1 parent 470c172 commit ba5708e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion example/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const App = () => {
<View
style={{flex: 1, backgroundColor: 'white', justifyContent: 'center'}}>
<PagerProvider activeIndex={activeIndex} onChange={onChange}>
<SwipeCards />
<MyPager />
</PagerProvider>
</View>
</SafeAreaView>
Expand Down
3 changes: 2 additions & 1 deletion src/pager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,8 @@ function Pager({
neq(config.toValue, nextPosition),
set(config.toValue, nextPosition)
),

set(animatedIndex, divide(state.position, max(dimension, 1), -1)),
],
[
set(state.position, translationValue),
Expand Down Expand Up @@ -443,7 +445,6 @@ function Pager({
]),
set(swiping, 0),
set(translationValue, runSpring(position)),
set(animatedIndex, divide(translationValue, max(dimension, 1), -1)),
translationValue,
]
),
Expand Down

0 comments on commit ba5708e

Please sign in to comment.