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

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

Android
iOS
Web
Included in Expo Go
Bundled version:
2.5.7

它就像一个高级的单选按钮,或者用苹果的话说:“一个水平控件,由多个部分组成,每个部分都作为独立的按钮功能”(source)。该组件在 iOS 上渲染为 UISegmentedControl,在 Android 和网页上则渲染为对该控件的忠实再现(因为在这些平台的标准库中没有等效控件)。

🌐 It's like a fancy radio button, or in Apple's words: "A horizontal control that consists of multiple segments, each segment functioning as a discrete button" (source). This component renders to a UISegmentedControl on iOS, and to faithful recreations of that control on Android and web (because no equivalent exists on those platforms' standard libraries).

安装

🌐 Installation

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.

了解更多

🌐 Learn more

访问官方文档

获取有关 API 及其使用的完整信息。