Skip to content

[ui][iOS] - Toggle component#41675

Merged
intergalacticspacehighway merged 8 commits intomainfrom
toggle-component
Dec 17, 2025
Merged

[ui][iOS] - Toggle component#41675
intergalacticspacehighway merged 8 commits intomainfrom
toggle-component

Conversation

@intergalacticspacehighway
Copy link
Copy Markdown
Contributor

@intergalacticspacehighway intergalacticspacehighway commented Dec 16, 2025

Why

Follows our current efforts to match Expo UI API with SwiftUI's. Adds Toggle component. Currently we have a Switch component which is handling custom checkbox UI, switch and button styles. The Toggle replaces the switch and button. Custom checkbox can be created using HStack and Image. Since it is custom i think we should not support it with native code as it has opinionated styling.

How

  • Added Toggle component, toggleStyle and labelsHidden modifiers.
  • Matched Expo UI API with SwiftUI.
  • Added docs and examples.
  • Removed Switch Component.

Test Plan

Tested example and docs.

Simulator.Screen.Recording.-.iPhone.17.Pro.-.2025-12-16.at.20.44.53.mov

Checklist

@github-actions
Copy link
Copy Markdown
Contributor

Subscribed to pull request

File Patterns Mentions
docs/** @amandeepmittal
packages/expo-ui/** @aleqsio, @behenate, @douglowder
tools/** @Kudo

Generated by CodeMention

@expo-bot expo-bot added the bot: suggestions ExpoBot has some suggestions label Dec 16, 2025
@expo-bot
Copy link
Copy Markdown
Collaborator

expo-bot commented Dec 16, 2025

The Pull Request introduced fingerprint changes against the base commit: ec03b0f

Fingerprint diff
[
  {
    "op": "changed",
    "beforeSource": {
      "type": "dir",
      "filePath": "../../packages/expo-ui/ios",
      "reasons": [
        "expoAutolinkingIos"
      ],
      "hash": "f5f18ef35a5a035b63719a7a281766860d6d035e"
    },
    "afterSource": {
      "type": "dir",
      "filePath": "../../packages/expo-ui/ios",
      "reasons": [
        "expoAutolinkingIos"
      ],
      "hash": "fef8553f168c152639237c414c3e315be4177941"
    }
  }
]

Generated by PR labeler 🤖

@expo-bot expo-bot added bot: passed checks ExpoBot has nothing to complain about and removed bot: suggestions ExpoBot has some suggestions labels Dec 16, 2025
Co-authored-by: Aman Mittal <amandeepmittal@live.com>
Copy link
Copy Markdown
Contributor

@aleqsio aleqsio left a comment

Choose a reason for hiding this comment

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

LGTM

@intergalacticspacehighway intergalacticspacehighway merged commit de722b9 into main Dec 17, 2025
15 of 16 checks passed
@intergalacticspacehighway intergalacticspacehighway deleted the toggle-component branch December 17, 2025 01:20
aleqsio pushed a commit that referenced this pull request Dec 22, 2025
# Why

Follows our current efforts to match Expo UI API with SwiftUI's. Adds
`Toggle` component. Currently we have a `Switch` component which is
handling custom checkbox UI, `switch` and `button` styles. The `Toggle`
replaces the `switch` and `button`. Custom checkbox can be created using
`HStack` and `Image`. Since it is custom i think we should not support
it with native code as it has opinionated styling.

<!--
Please describe the motivation for this PR, and link to relevant GitHub
issues, forums posts, or feature requests.
-->

# How

- Added
[Toggle](https://developer.apple.com/documentation/SwiftUI/Toggle)
component,
[toggleStyle](https://developer.apple.com/documentation/swiftui/view/togglestyle(_:))
and
[labelsHidden](https://developer.apple.com/documentation/swiftui/view/labelshidden())
modifiers.
- Matched Expo UI API with SwiftUI.
- Added docs and examples.
- Removed `Switch` Component.

<!--
How did you build this feature or fix this bug and why?
-->

# Test Plan

Tested example and docs.


https://github.com/user-attachments/assets/3a776ce6-f787-4be5-9ef9-366edcf4bfbc



<!--
Please describe how you tested this change and how a reviewer could
reproduce your test, especially if this PR does not include automated
tests! If possible, please also provide terminal output and/or
screenshots demonstrating your test/reproduction.
-->

# Checklist

<!--
Please check the appropriate items below if they apply to your diff.
-->

- [x] I added a `changelog.md` entry and rebuilt the package sources
according to [this short
guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting)
- [x] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
- [x] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)

---------

Co-authored-by: Aman Mittal <amandeepmittal@live.com>
shubh73 added a commit to shubh73/expo that referenced this pull request Jan 26, 2026
The native SwitchView was removed in expo#41675 and replaced with Toggle, but the TypeScript exports were left behind. This removes the orphaned Switch component and updates all examples/docs to use Toggle instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot: fingerprint changed bot: passed checks ExpoBot has nothing to complain about

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants