Skip to content

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

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

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

Conversation

@gdvsbp
Copy link
Copy Markdown

@gdvsbp gdvsbp commented Mar 14, 2026

… 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
Copy link
Copy Markdown

changeset-bot bot commented Mar 14, 2026

🦋 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
Copy link
Copy Markdown

vercel bot commented Mar 14, 2026

@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!

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
Copy link
Copy Markdown
Author

gdvsbp commented Mar 26, 2026

@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