Skip to content

Commit

Permalink
refactor: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
andreialecu committed May 5, 2022
1 parent 3975d6c commit ab57352
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 0 additions & 2 deletions src/Container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,6 @@ export const Container = React.memo(

const onTabPress = React.useCallback(
(name: TabName) => {
// simplify logic by preventing index change
// when is scrolling or gliding.
const i = tabNames.value.findIndex((n) => n === name)

if (name === focusedTab.value) {
Expand Down
9 changes: 3 additions & 6 deletions src/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,10 @@ export const useScrollHandlerY = (name: TabName) => {
headerScrollDistance.value * snapThreshold
) {
// snap down
accDiffClamp.value = withTiming(0, undefined)
accDiffClamp.value = withTiming(0)
} else if (accDiffClamp.value < headerScrollDistance.value) {
// snap up
accDiffClamp.value = withTiming(
headerScrollDistance.value,
undefined
)
accDiffClamp.value = withTiming(headerScrollDistance.value)

if (scrollYCurrent.value < headerScrollDistance.value) {
scrollTo(
Expand All @@ -320,7 +317,7 @@ export const useScrollHandlerY = (name: TabName) => {
}
}
} else {
accDiffClamp.value = withTiming(0, undefined)
accDiffClamp.value = withTiming(0)
}
}
} else {
Expand Down

0 comments on commit ab57352

Please sign in to comment.