[Android] Initialize the Handler fields eagerly - #4461
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 (5)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughSummary by CodeRabbit
WalkthroughThe Android gesture handlers now create main-looper ChangesGesture handler callback lifecycle
Merge Risk: ⚪ Minimal · up to The change eagerly initializes gesture-handler fields without any supplied evidence of a concrete correctness or production-impact risk; no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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 |
There was a problem hiding this comment.
Pull request overview
Initializes Android gesture-handler Handler instances eagerly and removes nullable access patterns, while documenting Hover’s delayed exit behavior.
Changes:
- Eagerly initializes handlers for Tap, Pan, LongPress, Fling, and Hover.
- Removes null checks and non-null assertions.
- Documents the 4 ms Hover delay.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/core/TapGestureHandler.kt | Updated as part of this pull request. |
| packages/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/core/PanGestureHandler.kt | Updated as part of this pull request. |
| packages/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/core/LongPressGestureHandler.kt | Updated as part of this pull request. |
| packages/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/core/HoverGestureHandler.kt | Updated as part of this pull request. |
| packages/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/core/FlingGestureHandler.kt | Updated as part of this pull request. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Description
Tap,LongPress,Fling,PanandHovergesture handlers kept theirHandleras a nullable field created on first use, guarded by null checks and!!at every call site (with aTODO: lazy initleft inTapsince the Kotlin conversion).Handlerobject was never cleared anyway (exceptLongPress, where it used to serve as a flag, andHover).Also adds a comment explaining the 4 ms delay in
HoverGestureHandler.Test plan
:react-native-gesture-handler:compileDebugKotlinbuilds clean in basic-exampleyarn format:androidpassesTested on the following code: