Skip to content

Commit

Permalink
fix liner reanimated API
Browse files Browse the repository at this point in the history
  • Loading branch information
sumo-slonik committed Jan 7, 2025
1 parent be4015e commit 53fd209
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/components/Accordion/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,29 @@ function Accordion({isExpanded, children, duration = 300, style}: AccordionProps
const styles = useThemeStyles();

const derivedHeight = useDerivedValue(() =>
withTiming(height.value * Number(isExpanded.value), {
withTiming(height.get() * Number(isExpanded.get()), {
duration,
easing: Easing.inOut(Easing.quad),
}),
);

const derivedOpacity = useDerivedValue(() =>
withTiming(isExpanded.value ? 1 : 0, {
withTiming(isExpanded.get() ? 1 : 0, {
duration,
easing: Easing.inOut(Easing.quad),
}),
);

const bodyStyle = useAnimatedStyle(() => ({
height: derivedHeight.value,
opacity: derivedOpacity.value,
height: derivedHeight.get(),
opacity: derivedOpacity.get(),
}));

return (
<Animated.View style={[bodyStyle, style]}>
<View
onLayout={(e) => {
height.value = e.nativeEvent.layout.height;
height.set(e.nativeEvent.layout.height);
}}
style={[styles.pAbsolute, styles.l0, styles.r0, styles.t0]}
>
Expand Down

0 comments on commit 53fd209

Please sign in to comment.