Repository navigation
refactor(Reanimated): back AnimatedRef with a Shareable instead of a handle - #10413
Conversation
41f1911 to
30bda5f
Compare
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughAnimated references now use Merge Risk: 🟡 Moderate · up to This refactor changes animated references to use shared state internally, but detached references may retain stale native wrapper state and the changelog describes the migrated type incorrectly. The bounded correctness and documentation issues should be fixed or explicitly accepted before merging. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
30bda5f to
c1a14ec
Compare
AnimatedRef with a Mutable instead of a handleAnimatedRef with a Shareable instead of a handle
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: eeef0486-090d-45a4-b67a-b0103b5300ed
📒 Files selected for processing (3)
packages/react-native-reanimated/CHANGELOG.mdpackages/react-native-reanimated/src/hook/commonTypes.tspackages/react-native-reanimated/src/hook/useAnimatedRef.native.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.
c1a14ec to
d8171d6
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: a768545c-1556-4be4-91c6-0e08f7a131be
📒 Files selected for processing (1)
packages/react-native-reanimated/src/hook/useAnimatedRef.native.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.
f30fc59 to
6c81517
Compare
## 📜 Description Fixed crash in `KeyboardChatScrollView` when `extraContentPadding` gets changed with reanimated 4.7+. ## 💡 Motivation and Context <!-- Why is this change required? What problem does it solve? --> <!-- If it fixes an open issue, please link to the issue here. --> As per software-mansion/react-native-reanimated#10413 `useAnimatedRef` now returns shared value instead of function. In this PR we are reflecting latest changes. Mostly this is the same changes as from #1656 with one important difference - we moved it to re-usable helper. Potentially we may try to ask deferred scroll in other places too, so better to have re-usable block instead of duplicating if-statements (especially now, when we need to check multiple conditions). I decided to use `safeScrollTo` everywhere in `useExtraContentPadding` - mixture of `scrollTo`/`safeScrollTo` would produce more questions, so let's just be consisitent. I'm also in the middle of investigation whether it's possible to get rid off asynchronous code and synchronously modify insets + scroll, but it's a future work. For now let's just fix a crash 🤞 Closes #1656 #1655 ## 📢 Changelog <!-- High level overview of important changes --> <!-- For example: fixed status bar manipulation; added new types declarations; --> <!-- If your changes don't affect one of platform/language below - then remove this platform/language --> ### JS - added separate `safeScrollTo` handler (in `components/utils` folder); - handle function/shared value cases in `safeScrollTo` handler; - added unit tests for `safeScrollTo` handler; - use `safeScrollTo` instead of `scrollTo` in `useExtraContentPadding`; ## 🤔 How Has This Been Tested? Tested on Pixel 7 Pro (API 37). ## 📸 Screenshots (if appropriate): |Before|After| |-------|-----| |<video src="https://github.com/user-attachments/assets/bc6de522-9e17-40ed-9a54-f626362ddac5">|<video src="https://github.com/user-attachments/assets/51663d93-9a62-44c5-ad45-6e004aecd5fb">| ## 📝 Checklist - [x] CI successfully passed - [x] I added new mocks and corresponding unit-tests if library API was changed
Summary
Use plain
Shareableas internal implementation ofuseAnimatedRef.Test plan
Reanimated runtime tests pass.
Changelog
Unpublishedsection of each changed package'sCHANGELOG.md, or this PR does not changereact-native-reanimatedorreact-native-worklets.