在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:expo/react-native-action-sheet开源软件地址:https://github.com/expo/react-native-action-sheet开源编程语言:TypeScript 99.5%开源软件介绍:react-native-action-sheetActionSheet is a cross-platform React Native component that uses the native UIActionSheet on iOS and a JS implementation on Android. Almost a drop in replacement for ActionSheetIOS except it cannot be called statically.
Installation
or
A basic ActionSheet Setup
1. Wrap your top-level component with |
Name | Type | Required | Default |
---|---|---|---|
anchor | number | No | |
userInterfaceStyle | string | No |
anchor
(optional)iPad only option that allows for docking the action sheet to a node. See ShowActionSheetButton.tsx for an example on how to implement this.
userInterfaceStyle
(optional)The interface style used for the action sheet, can be set to light
or dark
, otherwise the default system style will be used.
The below props allow modification of the Android ActionSheet. They have no effect on the look on iOS as the native iOS Action Sheet does not have options for modifying these options.
Name | Type | Required | Default |
---|---|---|---|
icons | array of required images or icons | No | |
tintIcons | boolean | No | true |
textStyle | TextStyle | No | |
titleTextStyle | TextStyle | No | |
messageTextStyle | TextStyle | No | |
autoFocus | boolean | No | false |
showSeparators | boolean | No | false |
containerStyle | ViewStyle | No | |
separatorStyle | ViewStyle | No | |
useModal | boolean | No | false (true if autoFocus is true) |
destructiveColor | string | No | #d32f2f |
icons
(optional)Show icons to go along with each option. If image source paths are provided via require
, images will be rendered for you. Alternatively, you can provide an array of elements such as vector icons, pre-rendered Images, etc.
tintIcons
(optional)Icons by default will be tinted to match the text color. When set to false, the icons will be the color of the source image. This is useful if you want to use multicolor icons. If you provide your own nodes/pre-rendered icons rather than required images in the icons
array, you will need to tint them appropriately before providing them in the array of icons
; tintColor
will not be applied to icons unless they are images from a required source.
textStyle
(optional)Apply any text style props to the options. If the tintColor
option is provided, it takes precedence over a color text style prop.
titleTextStyle
(optional)Apply any text style props to the title if present.
messageTextStyle
(optional)Apply any text style props to the message if present.
autoFocus
: (optional)If true, will give the first option screen reader focus automatically when the action sheet becomes visible. On iOS, this is the default behavior of the native action sheet.
showSeparators
: (optional)Show separators between items. On iOS, separators always show so this prop has no effect.
containerStyle
: (optional)Apply any view style props to the container rather than use the default look (e.g. dark mode).
separatorStyle
: (optional)Modify the look of the separators rather than use the default look.
useModal
: (optional)Wrap the ActionSheet with a Modal, in order to show in front of other Modals that were already opened (issue reference).
destructiveColor
: (optional)Modify color for text of destructive option.
The following props can be set directly on the ActionSheetProvider
useNativeDriver
(optional)Windows only option that provides the option to disable the native animation driver for React Native Windows projects targeting Windows 10 Version-1809 ; Build-10.0.17763.0 and earlier. useNativeDriver
is supported in Version-1903 and later so if your project is targeting that, you don't need to set this prop.
Try it in Expo: https://expo.io/@community/react-native-action-sheet-example
See the example app.
$ cd example
$ yarn
// build simulator
$ yarn ios
$ yarn android
// web
$ yarn web
$ git clone [email protected]:expo/react-native-action-sheet.git
$ cd react-native-action-sheet
$ yarn
We use bob.
$ yarn build
// tsc
$ yarn type-check
// ESLint + Prettier
$ yarn lint
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论