[MIL-1548] Fix bottom sheet React Native false positive#480
Open
rayhanadev wants to merge 3 commits into
Open
Conversation
|
✅ No new issues Reviewed by reactreview for commit c70e1b8. Configure here. |
There was a problem hiding this comment.
Pull request overview
This PR fixes a false positive in the rn-bottom-sheet-prefer-native React Native rule by no longer flagging @gorhom/bottom-sheet, and updates the rule messaging to avoid claiming feature parity with snap-point bottom sheets. It also adds a regression test to ensure Gorhom is allowed while legacy JS bottom sheet packages remain flagged.
Changes:
- Removed
@gorhom/bottom-sheetfrom the set of packages flagged byrn-bottom-sheet-prefer-native. - Narrowed the rule’s recommendation/message to “simple form-sheet flows” instead of implying snap-point/detent parity.
- Added tests covering the Gorhom allow-case and a legacy-package flag-case.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/oxlint-plugin-react-doctor/src/plugin/rules/react-native/rn-bottom-sheet-prefer-native.ts | Updates the rule package allow/deny set and refines the user-facing recommendation/message. |
| packages/oxlint-plugin-react-doctor/src/plugin/rules/react-native/rn-bottom-sheet-prefer-native.test.ts | Adds regression coverage to prevent reintroducing the Gorhom false positive. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
87d5ba2 to
c70e1b8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why?
rn-bottom-sheet-prefer-nativewas incorrectly flagging@gorhom/bottom-sheetimports. The rule described Gorhom as a JS-implemented bottom sheet, but Gorhom documents v5 as a performant interactive bottom sheet whose install path requiresreact-native-reanimatedandreact-native-gesture-handler, and the project README states that v5 is written with Reanimated v3 and Gesture Handler v2 (Gorhom v5 docs, Gorhom README).That matters because the old rule rationale was specifically about JS-thread gesture/animation work. Reanimated documents worklets as functions that can run on the UI thread and says Reanimated code is often automatically workletized and run there by default; Gesture Handler documents native touch handling, close Reanimated integration, and gesture callbacks executing on the UI thread by default when Reanimated integration is enabled (Reanimated glossary, Gesture Handler introduction, Gesture Handler Reanimated integration).
The previous recommendation also suggested replacing bottom sheets with
<Modal presentationStyle=\"formSheet\">, but React Native documentsformSheetas a narrow centered modal presentation style on larger iOS devices, not as a snap-point bottom sheet API. Gorhom documents bottom-sheet-specific capabilities such as snapping to indexes/positions, integrated scrollables, and configurable backdrops, soformSheetis not a general replacement for those use cases (React Native Modal docs, Gorhom methods, Gorhom scrollables, Gorhom backdrop).What changed?
@gorhom/bottom-sheetfrom the packages flagged byrn-bottom-sheet-prefer-native.@gorhom/bottom-sheetis allowed while legacy JS bottom sheet packages are still flagged.Before:
React Doctor reported
rn-bottom-sheet-prefer-nativeand recommended<Modal presentationStyle=\"formSheet\">.After:
React Doctor does not report
rn-bottom-sheet-prefer-nativefor Gorhom bottom sheet imports. Legacy packages such asreact-native-raw-bottom-sheetare still reported.Test plan
Users can verify correctness by running: