Skip to content

Commit

Permalink
fix: correct typo "cancelLazyFazeIn"
Browse files Browse the repository at this point in the history
  • Loading branch information
PedroBern committed Jan 26, 2021
1 parent 4d60583 commit 2b8b194
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions src/createCollapsibleTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const createCollapsibleTabs = <
cancelTranslation,
containerStyle,
lazy,
cancelLazyFazeIn,
cancelLazyFadeIn,
tabBarProps,
pagerProps,
}) => {
Expand Down Expand Up @@ -171,15 +171,15 @@ const createCollapsibleTabs = <
// set startMounted to initial scene instead of 0,
// to support starting on specific tab
startMounted={i === 0}
cancelLazyFazeIn={cancelLazyFazeIn}
cancelLazyFadeIn={cancelLazyFadeIn}
>
{children[i]}
</Lazy>
) : (
children[i]
)
},
[children, lazy, tabNames.value, cancelLazyFazeIn]
[children, lazy, tabNames.value, cancelLazyFadeIn]
)

const stylez = useAnimatedStyle(() => {
Expand Down Expand Up @@ -339,12 +339,12 @@ const createCollapsibleTabs = <
const Lazy: React.FC<{
name: T
startMounted?: boolean
cancelLazyFazeIn?: boolean
cancelLazyFadeIn?: boolean
children: React.ReactElement
}> = ({ children, name, startMounted, cancelLazyFazeIn }) => {
}> = ({ children, name, startMounted, cancelLazyFadeIn }) => {
const { focusedTab, refMap, scrollY, tabNames } = useTabsContext()
const [canMount, setCanMount] = React.useState(!!startMounted)
const opacity = useSharedValue(cancelLazyFazeIn ? 1 : 0)
const opacity = useSharedValue(cancelLazyFadeIn ? 1 : 0)

const allowToMount = React.useCallback(() => {
// wait the scene to be at least 50 ms focused, before mouting
Expand Down Expand Up @@ -372,9 +372,9 @@ const createCollapsibleTabs = <
const tabIndex = tabNames.value.findIndex((n) => n === name)
// @ts-ignore
scrollTo(refMap[name], 0, scrollY.value[tabIndex], false)
if (!cancelLazyFazeIn) opacity.value = withTiming(1)
if (!cancelLazyFadeIn) opacity.value = withTiming(1)
}
}, [canMount, cancelLazyFazeIn])
}, [canMount, cancelLazyFadeIn])

const stylez = useAnimatedStyle(() => {
return {
Expand All @@ -383,12 +383,12 @@ const createCollapsibleTabs = <
}, [])

return canMount ? (
cancelLazyFazeIn ? (
cancelLazyFadeIn ? (
children
) : (
<Animated.View
pointerEvents="box-none"
style={[styles.container, !cancelLazyFazeIn && stylez]}
style={[styles.container, !cancelLazyFadeIn && stylez]}
>
{children}
</Animated.View>
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export type CollapsibleProps<
containerStyle?: ViewStyle
cancelTranslation?: boolean
lazy?: boolean
cancelLazyFazeIn?: boolean
cancelLazyFadeIn?: boolean
tabBarProps?: Omit<TP, keyof TabBarProps<any>>
pagerProps?: Omit<
RNFlatListProps<number>,
Expand Down

0 comments on commit 2b8b194

Please sign in to comment.