Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): Android environment toggles toggle instead of opening the row #21041

Closedt3dotgg(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromfix/android-env-switch-toggleopened View on GitHub

On Android, the environment toggles did not toggle. A tap on the switch opened the environment detail view instead. On the detail view, a tap on the switch expanded the row instead.

The Android switch is a Jetpack Compose view inside a row Pressable. Now an RN Pressable around the switch handles the tap, and the Compose view has pointerEvents="none", so it only draws the switch. The innermost Pressable gets the tap, so the row's onPress cannot run instead of the toggle.

This is the shared Android NativeSwitch, so all Android switches now use this tap path. You can no longer drag the thumb on Android.

Testing on emulators (Pixel 8 on API 36, Pixel Fold on API 37, both phone and unfolded layouts):

  • With this change, the Environments list switch and the environment detail switch toggle off and on. The list stays open and the detail row stays closed. A tap on the row still opens the details. A normal settings switch (Thread behavior) still toggles and keeps its label for accessibility.
  • With the old code, the emulators did not reproduce the bug. The switch toggled there too. The bug was seen on a Galaxy Fold (Android 17) connected through T3 Connect. This PR has the mobile preview label so it can be checked on that device.

Reviewed with sol-loop: 1 round with GPT-6.1 Sol. Sol verdict: approved

Made with Claude Opus 5.5 in Claude Code (T3 Code).

🤖 Generated with Claude Code

    1. juliusmarminge added labelsmacroscope-review

    2. Approvability

      Verdict: Approved at a9f0fd4

      Macroscope's review found this PR approvable — This is a focused, one-file Android bug fix that redirects switch taps to the existing toggle callback and prevents them from opening the enclosing environment row. It leaves other platforms and the surrounding switch contract unchanged, with no product-default, static-analysis, schema, or sensitive-area changes.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration
      • Configuration used: Path: .coderabbit.config.ts
      • Review profile: CHILL
      • Plan: Team
      • Run ID: d50e9ed6-8e60-4ba7-88da-b107de00f426
      📥 Commits

      Reviewing files that changed from the base of the PR and between 16918b57d6754d6f145e9b6367c825aa31a740da and a9f0fd4fff216ae0c2a4bae870fa4f3bcd235940.

      📒 Files selected for processing: 1
      • apps/mobile/src/components/ui/NativeSwitch.android.tsx

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

      📝 Walkthrough

      The Android NativeSwitch now uses a Pressable to toggle its value. It disables the Pressable when props.disabled is true and places the Compose switch in a non-interactive, accessibility-hidden View.

      Changes: Android NativeSwitch

      Layer / File(s)Summary
      Press handling
      apps/mobile/src/components/ui/NativeSwitch.android.tsx
      The wrapper changes from View to Pressable, which toggles the value when pressed and is disabled when props.disabled is true. The inner View ignores pointer events. The previous explicit accessibility activate action and handler are removed.

      Priority: ➖ Normal

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Bug fix

      Suggested reviewers: juliusmarminge

      Merge Risk: ⚪ Minimal · up to a9f0f

      Android switch taps toggle without also navigating or expanding their parent row. No concrete merge-blocking issue is established; the change is ready for normal checks.

      Pre-merge checks: Passed 3 · Failed 1
      Failed Failed checks: 1 warning
      Check nameStatusExplanationResolution
      Description checkWarningThe description explains the problem, implementation, testing, limitations, and agent usage. It does not include the required Scope and approval section or explain the applicable approval exemption. I…Add a Scope and approval section with the triaged issue or maintainer approval, or explain why this focused obvious bug qualifies for the exemption. Add clear before-and-after screenshots for the UI change, and include a recording if needed…
      Passed Passed checks: 3 passed
      Check nameStatusExplanation
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Title checkPassedThe title clearly and concisely describes the Android switch behavior being fixed.
      Full details: Description check

      Explanation

      The description explains the problem, implementation, testing, limitations, and agent usage. It does not include the required Scope and approval section or explain the applicable approval exemption. It also omits the required before-and-after UI screenshots.

      Resolution

      Add a Scope and approval section with the triaged issue or maintainer approval, or explain why this focused obvious bug qualifies for the exemption. Add clear before-and-after screenshots for the UI change, and include a recording if needed to demonstrate the interaction behavior.

      • Fix all pre-merge checks with AI
      ✨ Finishing Touches
      📝 Generate docstrings
      • Commit to this branch
      • Create a new PR
      🧪 Generate unit tests (beta)
      • Commit to this branch
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
      Comment `@coderabbitai help` to get the list of available commands.
    4. t3dotgg(GitHub profile, opens in a new tab) added labels🚀 Mobile Continuous Deployment

    5. 🚀 Expo continuous deployment is ready!

      • Project → t3-code
      • Platforms → android, ios
      • Scheme → t3code-preview
       🤖 Android🍎 iOS
      Fingerprinte9a166de320920bf3553e5431ecb128eb39c75f94234d33f57bbfc9d8956cd01f43948d871583608
      Build DetailsBuild Permalink
      DetailsDistribution: INTERNAL
      Build profile: preview:dev
      Runtime version: e9a166de320920bf3553e5431ecb128eb39c75f9
      App version: 2.0.0
      Git commit: 3149651a3ff95fa8437bd7beeb2bed1844b568b7
      Build Permalink
      DetailsDistribution: INTERNAL
      Build profile: preview:dev
      Runtime version: 4234d33f57bbfc9d8956cd01f43948d871583608
      App version: 2.0.0
      Git commit: 3149651a3ff95fa8437bd7beeb2bed1844b568b7
      Update DetailsUpdate Permalink
      DetailsBranch: pr-21041
      Runtime version: e9a166de320920bf3553e5431ecb128eb39c75f9
      Git commit: 3149651a3ff95fa8437bd7beeb2bed1844b568b7
      Update Permalink
      DetailsBranch: pr-21041
      Runtime version: 4234d33f57bbfc9d8956cd01f43948d871583608
      Git commit: 3149651a3ff95fa8437bd7beeb2bed1844b568b7
      Update QR
    6. Note

      🤖 Claude Opus 5.5 responding on behalf of Theo

      Closing: this change shipped in #21071, which combined it with the other Android foldable fixes.

    7. Note

      Grok responding on behalf of Julius.

      Closing as superseded: this change landed on main as part of #21071, which combined the four Android foldable PRs (#21049, #21044, #21043, #21041).

Sign in to join this conversation.