Skip to content

Commit 1fbebb9

Browse files
committed
chore(container): reanimated pass dependencies
1 parent db84df6 commit 1fbebb9

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

lib/src/components/Container.tsx

+10-7
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,15 @@ const Container: FC<ContainerProps> = ({children}) => {
7474
const pressed = useSharedValue<boolean>(false)
7575
const expanded = useSharedValue<boolean>(false)
7676

77-
const animateHeightStyles = useAnimatedStyle(() => ({
78-
height:
79-
(expanded.value ? heightExpanded.value : heightCollapsed.value) +
80-
heightKnob.value +
81-
heightOffset.value,
82-
}))
77+
const animateHeightStyles = useAnimatedStyle(
78+
() => ({
79+
height:
80+
(expanded.value ? heightExpanded.value : heightCollapsed.value) +
81+
heightKnob.value +
82+
heightOffset.value,
83+
}),
84+
[expanded, heightExpanded, heightCollapsed, heightKnob, heightOffset],
85+
)
8386

8487
const animateCollapsedStyles = useAnimatedStyle(() => {
8588
if (heightOffset.value === 0) {
@@ -92,7 +95,7 @@ const Container: FC<ContainerProps> = ({children}) => {
9295
return {
9396
opacity: expanded.value ? diff : 1 - diff,
9497
}
95-
})
98+
}, [heightOffset, expanded, heightExpanded, heightCollapsed])
9699

97100
return (
98101
<GestureHandlerRootView>

lib/src/components/KnobContainer.tsx

+9-6
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,15 @@ const KnobContainer: FC<KnobContainerProps> = ({
7979

8080
const tap = Gesture.Tap().onEnd(handleTapEnd)
8181

82-
const animatedStyles = useAnimatedStyle(() => ({
83-
transform: [
84-
{translateY: offset.value},
85-
// {scale: withTiming(pressed.value ? 1.2 : 1)},
86-
],
87-
}))
82+
const animatedStyles = useAnimatedStyle(
83+
() => ({
84+
transform: [
85+
{translateY: offset.value},
86+
// {scale: withTiming(pressed.value ? 1.2 : 1)},
87+
],
88+
}),
89+
[offset],
90+
)
8891

8992
return (
9093
<GestureDetector gesture={Gesture.Exclusive(tap, pan)}>

0 commit comments

Comments
 (0)