Reference version

This is documentation for the next SDK version. For up-to-date documentation, see the latest version (SDK 56).

@react-native-segmented-control/segmented-control

一个 React Native 库,提供用于渲染 iOS 中 UISegmentedControl 的组件。

Android
iOS
Web
Included in Expo Go

For the complete documentation index, see llms.txt. Use this file to discover all available pages.

重要 @expo/ui provides a drop-in replacement for @react-native-segmented-control/segmented-control, powered by Jetpack Compose on Android and SwiftUI on iOS.

它就像一个花哨的单选按钮,或者用苹果的话说:“一种由多个段组成的水平控件,每个段都可作为一个独立按钮使用”(来源)。这个组件在 iOS 上会渲染为 UISegmentedControl,在 Android 和 web 上则会渲染为对该控件的忠实复刻(因为这些平台的标准库中没有对应的控件)。

安装

Terminal
npx expo install @react-native-segmented-control/segmented-control

If you are installing this in an existing React Native app, make sure to install expo in your project. Then, follow the installation instructions provided in the library's README or documentation.

了解更多

访问官方文档

获取 API 及其用法的完整信息。