Skip to content

fix: ensure useOnProgressChange responds to new offsetX and sizeReady…#906

Open
gdvsbp wants to merge 1 commit into
dohooo:v4.x.xfrom
gdvsbp:patch-1
Open

fix: ensure useOnProgressChange responds to new offsetX and sizeReady…#906
gdvsbp wants to merge 1 commit into
dohooo:v4.x.xfrom
gdvsbp:patch-1

Conversation

@gdvsbp

@gdvsbp gdvsbp commented Mar 14, 2026

Copy link
Copy Markdown

… instances

Description

useOnProgressChange will not re-run useAnimatedReaction if new SharedValue instance of offsetX is passed as option because it doesn't exist in useAnimatedReaction's dependency array.

image

Ran into this issue at work and patched it in our project so I wanted to contribute the same fix back to the project.

Review

  • I self-reviewed this PR

Testing

  • I added/updated tests
  • I manually tested

Saw onProgressChange called with updated values when given new instances of shared values were passed

@changeset-bot

changeset-bot Bot commented Mar 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 20c513a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
react-native-reanimated-carousel Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Mar 14, 2026

Copy link
Copy Markdown

@gdvsbp is attempting to deploy a commit to the Caspian's Team Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Mar 14, 2026
@dosubot dosubot Bot added the bug Something isn't working label Mar 14, 2026
@KasperGam

Copy link
Copy Markdown

I found this same issue and created a patch for it for our usage, would love for this to be merged so our team can remove the patch!

Comment thread src/hooks/useOnProgressChange.ts Outdated
Passing new offsetX instance to useOnProgressChange hook would not cause useAnimatedReaction hook to re-run despite it using that value. Adding this shared value as a dependency of the hook.
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Mar 26, 2026
@gdvsbp

gdvsbp commented Mar 26, 2026

Copy link
Copy Markdown
Author

@dohooo Can you review this when you're available?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants