Skip to content

Commit

Permalink
* destructure animationConfig outside useAnimatedStyle (reanimated v3…
Browse files Browse the repository at this point in the history
… throws error while destructuring in the
  • Loading branch information
PdoubleU committed Nov 28, 2023
1 parent 642bfdd commit 180f412
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/core/hooks/useAnimationAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,22 @@ export const useAnimationAPI = ({

const handleDragStateChange = dragStateHandler(dismiss, resetDrag)

const animatedStyles = useAnimatedStyle(() => {
const animationBuilder: AnimationBuilder = animationConfig as AnimationBuilder
const { transitionInStyles, transitionOutStyles } = animationConfig
const {
transitionInStyles,
transitionOutStyles,
transitionInStylesQueue,
transitionOutStylesQueue,
} = animationConfig as AnimationBuilder

const animatedStyles = useAnimatedStyle(() => {
if (
['out', 'idle_active'].includes(currentTransitionType.value) &&
animationBuilder.transitionOutStylesQueue?.length > 0
transitionOutStylesQueue.length > 0
) {
return mergeStylesFunctions(animationBuilder.transitionOutStylesQueue, progress)
return mergeStylesFunctions(transitionOutStylesQueue, progress)
}
if (animationBuilder?.transitionInStylesQueue?.length > 0) {
return mergeStylesFunctions(animationBuilder.transitionInStylesQueue, progress)
if (transitionInStylesQueue.length > 0) {
return mergeStylesFunctions(transitionInStylesQueue, progress)
}
if (['out', 'idle_active'].includes(currentTransitionType.value) && transitionOutStyles) {
return { opacity: 1, ...(transitionOutStyles(progress) as unknown as {}) }
Expand Down

0 comments on commit 180f412

Please sign in to comment.