Skip to content

Commit

Permalink
fix: indicator glitch because scrollX was being reset (#131)
Browse files Browse the repository at this point in the history
In reanimated 2 rc.0, useSharedValue actually recomputes the value and acts as useDerivedValue unless false is passed to the second parameter.

This can cause a glitch in the indicator mid-snap if the container needs to re-render, because scrollX will be briefly reset to a full snapped position.
  • Loading branch information
andreialecu authored Feb 15, 2021
1 parent d855670 commit 49a1348
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ const Container = React.forwardRef<CollapsibleRef, CollapsibleProps>(
initialTabName ? tabNames.value.findIndex((n) => n === initialTabName) : 0
)
const scrollX: ContextType['scrollX'] = useSharedValue(
index.value * windowWidth
index.value * windowWidth,
false
)
const pagerOpacity = useSharedValue(
initialHeaderHeight === undefined || index.value !== 0 ? 0 : 1,
Expand Down

0 comments on commit 49a1348

Please sign in to comment.