Repository navigation
fix(Reanimated): return full shared values from makeMutable, useScrollOffset and useTimestamp mocks - #11024
Conversation
…lOffset and useTimestamp mocks
|
No actionable comments were generated in the recent review.
|
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
6776e1be-c4e7-46fb-af99-2d082d611d88
Files selected for processing: 3-
packages/react-native-reanimated/__tests__/mock.sharedValueFactories.test.tsxpackages/react-native-reanimated/changelog/mock-shared-value-factories.fix.mdpackages/react-native-reanimated/src/mock.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
-
Note
This pull request was authored by AI on behalf of @tjzel.
Summary
Follow-up to #11003, #10919 and #10920.
The Jest mocks of
makeMutable,useScrollOffset,useScrollViewOffsetanduseTimestampreturned plain values instead of shared values.isSharedValue(makeMutable(0))wasfalse, and code that calledaddListeneron a scroll offset or a timestamp crashed under the mock.I moved the
useSharedValueProxy into acreateMockSharedValuefactory and used it in all of these mocks.useScrollOffsetanduseTimestampkeep one shared value per component withuseState, likeuseSharedValue, anduseScrollOffsetreturns the provided offset when one is passed, like the real hook.Test plan
yarn workspace react-native-reanimated jest mock.sharedValueFactoriesruns the new tests, which fail without the change and pass with it.Changelog
yarn changelog:addfor each changed package, or this PR does not changereact-native-reanimatedorreact-native-worklets.