Skip to content

[MIL-1548] Fix bottom sheet React Native false positive#480

Open
rayhanadev wants to merge 3 commits into
mainfrom
ray/mil-1548-fix-bottom-sheet-react-native-false-positive
Open

[MIL-1548] Fix bottom sheet React Native false positive#480
rayhanadev wants to merge 3 commits into
mainfrom
ray/mil-1548-fix-bottom-sheet-react-native-false-positive

Conversation

@rayhanadev
Copy link
Copy Markdown
Member

@rayhanadev rayhanadev commented May 25, 2026

Why?

rn-bottom-sheet-prefer-native was incorrectly flagging @gorhom/bottom-sheet imports. The rule described Gorhom as a JS-implemented bottom sheet, but Gorhom documents v5 as a performant interactive bottom sheet whose install path requires react-native-reanimated and react-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 documents formSheet as 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, so formSheet is not a general replacement for those use cases (React Native Modal docs, Gorhom methods, Gorhom scrollables, Gorhom backdrop).

What changed?

  • Removed @gorhom/bottom-sheet from the packages flagged by rn-bottom-sheet-prefer-native.
  • Narrowed the remaining recommendation to simple native form-sheet flows instead of claiming parity with snap-point bottom sheets.
  • Added regression coverage proving @gorhom/bottom-sheet is allowed while legacy JS bottom sheet packages are still flagged.

Before:

import BottomSheet from "@gorhom/bottom-sheet";

React Doctor reported rn-bottom-sheet-prefer-native and recommended <Modal presentationStyle=\"formSheet\">.

After:

import BottomSheet from "@gorhom/bottom-sheet";

React Doctor does not report rn-bottom-sheet-prefer-native for Gorhom bottom sheet imports. Legacy packages such as react-native-raw-bottom-sheet are still reported.

Test plan

Users can verify correctness by running:

pnpm --filter oxlint-plugin-react-doctor exec vp test run src/plugin/rules/react-native/rn-bottom-sheet-prefer-native.test.ts
pnpm --filter oxlint-plugin-react-doctor typecheck

@reactreview
Copy link
Copy Markdown

reactreview Bot commented May 25, 2026

No new issues

Reviewed by reactreview for commit c70e1b8. Configure here.

@rayhanadev rayhanadev marked this pull request as ready for review May 25, 2026 18:06
Copilot AI review requested due to automatic review settings May 25, 2026 18:06
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-sheet from the set of packages flagged by rn-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.

@rayhanadev rayhanadev changed the title Fix bottom sheet React Native false positive [MIL-1548] Fix bottom sheet React Native false positive May 25, 2026
@rayhanadev rayhanadev requested a review from aidenybai May 25, 2026 18:13
rayhanadev and others added 3 commits May 25, 2026 13:40
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@rayhanadev rayhanadev force-pushed the ray/mil-1548-fix-bottom-sheet-react-native-false-positive branch from 87d5ba2 to c70e1b8 Compare May 25, 2026 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants