Fix ReanimatedDrawerLayout animation speed after rerender - #4470
Conversation
|
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 8 included reviews per hour; 6 remain after this review. 📝 WalkthroughSummary by CodeRabbit
Walkthrough
ChangesDrawer animation speed
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
Full details: Linked Issues checkExplanation The change adds animationSpeedProp to animateDrawer’s callback dependencies. This directly fixes the stale prop captured after rerender and ensures later openDrawer() and closeDrawer() calls use the latest animation speed described in issue 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 |
There was a problem hiding this comment.
Pull request overview
Fixes a stale-closure bug in ReanimatedDrawerLayout where programmatic openDrawer() / closeDrawer() continued using the initial animationSpeed prop after a rerender, and adds a regression test to lock in the expected behavior.
Changes:
- Add
animationSpeedProptoanimateDrawer’suseCallbackdependency list so updated props are reflected in subsequent imperative calls. - Add a Jest regression test that verifies the computed spring
massupdates after rerendering with a newanimationSpeed.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/react-native-gesture-handler/src/components/ReanimatedDrawerLayout.tsx | Fixes stale animationSpeed capture by tracking animationSpeedProp in animateDrawer callback deps. |
| packages/react-native-gesture-handler/src/tests/reanimatedDrawerLayoutAnimationSpeed.test.tsx | Adds regression test asserting withSpring receives updated mass after prop-only rerender. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Description
Fixes #4469.
ReanimatedDrawerLayoutmemoizedanimateDrawerwithoutanimationSpeedProp, so changing the prop did not affect later programmaticopenDrawer()orcloseDrawer()calls. The callback now tracks the prop and the imperative methods receive the latest default spring speed after a rerender.Test plan
yarn workspace react-native-gesture-handler test --runInBand— 159 tests passedyarn workspace react-native-gesture-handler ts-checkyarn workspace react-native-gesture-handler lint-js— no errors (existing warnings remain)yarn workspace react-native-gesture-handler build