Compare commits

..
41 Commits
Author SHA1 Message Date
github-actions[bot] 9dd71637bb chore(master): release 4.1.1 (#333)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-02-25 16:46:44 +01:00
David Prevost b7e050c9ab fix: Removal of BackHandler.removeEventListener in react-native (#339) 2025-02-21 12:50:07 +01:00
Stephen Tuso 1ce802b8f0 fix: show touch feedback on iOS when using custom action sheet (#329) 2024-12-16 10:48:21 +01:00
BradByte d778588f78 Merge pull request #301 from expo/release-please--branches--master--components--react-native-action-sheet
chore(master): release 4.1.0
2024-05-15 13:42:53 -05:00
Brad Bumbalough bd7183604b chore: update release please 2024-05-15 13:39:51 -05:00
github-actions[bot] c12edae256 chore(master): release 4.1.0 2024-05-15 18:39:27 +00:00
BradByte bc33f9f4d0 feat: update peer dep (#324)
- fixed #323
2024-05-15 13:38:19 -05:00
BradByte b018847868 Merge pull request #322 from expo/dependabot/npm_and_yarn/example/tar-6.2.1
chore(deps): bump tar from 6.1.11 to 6.2.1 in /example
2024-04-16 11:51:23 -05:00
dependabot[bot] fbabe9781c chore(deps): bump tar from 6.1.11 to 6.2.1 in /example
Bumps [tar](https://github.com/isaacs/node-tar) from 6.1.11 to 6.2.1.
- [Release notes](https://github.com/isaacs/node-tar/releases)
- [Changelog](https://github.com/isaacs/node-tar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/isaacs/node-tar/compare/v6.1.11...v6.2.1)

---
updated-dependencies:
- dependency-name: tar
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
2024-04-11 02:49:18 +00:00
BradByte 3ae2918950 Merge pull request #321 from expo/dependabot/npm_and_yarn/example/ip-1.1.9
chore(deps): bump ip from 1.1.5 to 1.1.9 in /example
2024-04-05 23:09:41 -05:00
dependabot[bot] 761f65e36a chore(deps): bump ip from 1.1.5 to 1.1.9 in /example
Bumps [ip](https://github.com/indutny/node-ip) from 1.1.5 to 1.1.9.
- [Commits](https://github.com/indutny/node-ip/compare/v1.1.5...v1.1.9)

---
updated-dependencies:
- dependency-name: ip
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
2024-04-05 06:36:47 +00:00
BradByte 78a162d26d Merge pull request #314 from expo/dependabot/npm_and_yarn/example/babel/traverse-7.23.2
chore(deps): bump @babel/traverse from 7.5.0 to 7.23.2 in /example
2024-04-05 01:36:27 -05:00
BradByte e0f622c79e Merge pull request #315 from expo/dependabot/npm_and_yarn/babel/traverse-7.23.2
chore(deps): bump @babel/traverse from 7.12.9 to 7.23.2
2024-04-05 01:36:17 -05:00
BradByte f344bdbcd1 Merge pull request #316 from keima/fix-connectactionsheet-return-type
Fix connectActionSheet to exclude ActionSheetProps from return type
2024-04-05 01:36:01 -05:00
Kouta Imanaka 8211a81ba9 remove ActionSheetProps 2023-10-23 01:21:50 +09:00
dependabot[bot] 1e7f806438 chore(deps): bump @babel/traverse from 7.12.9 to 7.23.2
Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.12.9 to 7.23.2.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse)

---
updated-dependencies:
- dependency-name: "@babel/traverse"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
2023-10-17 01:58:32 +00:00
dependabot[bot] a78534b9e7 chore(deps): bump @babel/traverse from 7.5.0 to 7.23.2 in /example
Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.5.0 to 7.23.2.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse)

---
updated-dependencies:
- dependency-name: "@babel/traverse"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
2023-10-17 01:58:31 +00:00
BradByte e3c2306169 Merge pull request #308 from expo/dependabot/npm_and_yarn/example/semver-5.7.2
chore(deps): bump semver from 5.7.0 to 5.7.2 in /example
2023-08-02 11:06:26 -05:00
BradByte f800cb2a1d Merge pull request #309 from expo/dependabot/npm_and_yarn/semver-5.7.2
chore(deps): bump semver from 5.7.1 to 5.7.2
2023-08-02 11:06:15 -05:00
BradByte a76bc0bf22 Merge pull request #310 from expo/dependabot/npm_and_yarn/word-wrap-1.2.4
chore(deps): bump word-wrap from 1.2.3 to 1.2.4
2023-08-02 11:06:01 -05:00
dependabot[bot] 312db874f5 chore(deps): bump word-wrap from 1.2.3 to 1.2.4
Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.4)

---
updated-dependencies:
- dependency-name: word-wrap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
2023-07-19 00:36:23 +00:00
dependabot[bot] ecc8acb3a9 chore(deps): bump semver from 5.7.1 to 5.7.2
Bumps [semver](https://github.com/npm/node-semver) from 5.7.1 to 5.7.2.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/v5.7.2/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v5.7.1...v5.7.2)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
2023-07-12 09:15:27 +00:00
dependabot[bot] 7d1941dbde chore(deps): bump semver from 5.7.0 to 5.7.2 in /example
Bumps [semver](https://github.com/npm/node-semver) from 5.7.0 to 5.7.2.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/v5.7.2/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v5.7.0...v5.7.2)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
2023-07-11 16:23:31 +00:00
dependabot[bot] a918aec770 chore(deps): bump minimatch from 3.0.4 to 3.1.2 (#305)
Bumps [minimatch](https://github.com/isaacs/minimatch) from 3.0.4 to 3.1.2.
- [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/minimatch/compare/v3.0.4...v3.1.2)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-09 22:20:53 -06:00
dependabot[bot] 93bc73bf22 chore(deps): bump minimatch from 3.0.4 to 3.1.2 in /example (#304)
Bumps [minimatch](https://github.com/isaacs/minimatch) from 3.0.4 to 3.1.2.
- [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/minimatch/compare/v3.0.4...v3.1.2)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-09 22:19:13 -06:00
dependabot[bot] d2d0843790 chore(deps): bump @xmldom/xmldom from 0.7.5 to 0.7.10 in /example (#303)
Bumps [@xmldom/xmldom](https://github.com/xmldom/xmldom) from 0.7.5 to 0.7.10.
- [Release notes](https://github.com/xmldom/xmldom/releases)
- [Changelog](https://github.com/xmldom/xmldom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/xmldom/xmldom/compare/0.7.5...0.7.10)

---
updated-dependencies:
- dependency-name: "@xmldom/xmldom"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-09 22:10:47 -06:00
dependabot[bot] 929a1dbc54 chore(deps): bump @sideway/formula from 3.0.0 to 3.0.1 in /example (#302)
Bumps [@sideway/formula](https://github.com/sideway/formula) from 3.0.0 to 3.0.1.
- [Commits](https://github.com/sideway/formula/compare/v3.0.0...v3.0.1)

---
updated-dependencies:
- dependency-name: "@sideway/formula"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-09 22:10:33 -06:00
dependabot[bot] 0468951ed4 chore(deps): bump ua-parser-js from 0.7.28 to 0.7.33 (#294)
Bumps [ua-parser-js](https://github.com/faisalman/ua-parser-js) from 0.7.28 to 0.7.33.
- [Release notes](https://github.com/faisalman/ua-parser-js/releases)
- [Changelog](https://github.com/faisalman/ua-parser-js/blob/master/changelog.md)
- [Commits](https://github.com/faisalman/ua-parser-js/compare/0.7.28...0.7.33)

---
updated-dependencies:
- dependency-name: ua-parser-js
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-09 22:05:33 -06:00
dependabot[bot] c73938f4de chore(deps): bump ua-parser-js from 0.7.28 to 0.7.33 in /example (#293)
Bumps [ua-parser-js](https://github.com/faisalman/ua-parser-js) from 0.7.28 to 0.7.33.
- [Release notes](https://github.com/faisalman/ua-parser-js/releases)
- [Changelog](https://github.com/faisalman/ua-parser-js/blob/master/changelog.md)
- [Commits](https://github.com/faisalman/ua-parser-js/compare/0.7.28...0.7.33)

---
updated-dependencies:
- dependency-name: ua-parser-js
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-09 22:05:22 -06:00
dependabot[bot] aec473fb02 chore(deps): bump json5 from 1.0.1 to 1.0.2 (#290)
Bumps [json5](https://github.com/json5/json5) from 1.0.1 to 1.0.2.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](https://github.com/json5/json5/compare/v1.0.1...v1.0.2)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-09 22:04:01 -06:00
dependabot[bot] 21d10edbd0 chore(deps): bump decode-uri-component from 0.2.0 to 0.2.2 in /example (#289)
Bumps [decode-uri-component](https://github.com/SamVerschueren/decode-uri-component) from 0.2.0 to 0.2.2.
- [Release notes](https://github.com/SamVerschueren/decode-uri-component/releases)
- [Commits](https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.0...v0.2.2)

---
updated-dependencies:
- dependency-name: decode-uri-component
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-09 22:03:38 -06:00
dependabot[bot] ecb6b23caa chore(deps): bump decode-uri-component from 0.2.0 to 0.2.2 (#288)
Bumps [decode-uri-component](https://github.com/SamVerschueren/decode-uri-component) from 0.2.0 to 0.2.2.
- [Release notes](https://github.com/SamVerschueren/decode-uri-component/releases)
- [Commits](https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.0...v0.2.2)

---
updated-dependencies:
- dependency-name: decode-uri-component
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-09 22:03:22 -06:00
dependabot[bot] 2f9346bcd7 chore(deps): bump shell-quote from 1.6.1 to 1.7.4 in /example (#284)
Bumps [shell-quote](https://github.com/ljharb/shell-quote) from 1.6.1 to 1.7.4.
- [Release notes](https://github.com/ljharb/shell-quote/releases)
- [Changelog](https://github.com/ljharb/shell-quote/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ljharb/shell-quote/compare/1.6.1...v1.7.4)

---
updated-dependencies:
- dependency-name: shell-quote
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-09 22:03:04 -06:00
BradByte b35a403a21 fix: use release-please instead of semantic release (#300)
* fix: use release-please instead of semantic release

* chore: update ci steps
2023-05-09 22:01:20 -06:00
Eleftherios Myteletsis 3b698da831 chore: Update README.md (#291) 2023-01-18 08:36:30 -06:00
semantic-release-bot c583287d00 chore(release): 4.0.1 [skip ci]
## [4.0.1](https://github.com/expo/react-native-action-sheet/compare/v4.0.0...v4.0.1) (2022-11-04)

### Bug Fixes

* expose ref on ActionSheetProvider for statically invoking ([#283](https://github.com/expo/react-native-action-sheet/issues/283)) ([b2f5f43](https://github.com/expo/react-native-action-sheet/commit/b2f5f433ff2070c77fdd62b273d2d80e636efd3a))
2022-11-04 20:14:25 +00:00
BradByte b2f5f433ff fix: expose ref on ActionSheetProvider for statically invoking (#283)
This fixes an unknown breaking change from 4.0.0 where attempting to put a ref directly on `ActionSheetProvider` would error. For simplicity, the ref on that component will now return an object containing `showActionSheetWithOptions()`, but for backwards compatibility `getContext()` is also available.
2022-11-04 15:13:18 -05:00
semantic-release-bot fc9cefa2c1 chore(release): 4.0.0 [skip ci]
# [4.0.0](https://github.com/expo/react-native-action-sheet/compare/v3.14.0...v4.0.0) (2022-10-26)

### Features

* iOS use custom action sheet ([#281](https://github.com/expo/react-native-action-sheet/issues/281)) ([372dc80](https://github.com/expo/react-native-action-sheet/commit/372dc8065006a4da510ef5f31c27225d14a71ff3))

### BREAKING CHANGES

* This implementation is backwards compatible, but just to be safe I'm marking this as breaking so that it bumps the major version.
2022-10-26 17:39:06 +00:00
BradByte 372dc80650 feat: iOS use custom action sheet (#281)
BREAKING CHANGE: This implementation is backwards compatible, but just to be safe I'm marking this as breaking so that it bumps the major version.
2022-10-26 12:38:17 -05:00
BradByte 86fabab32b docs: add link to expo snack (#280) 2022-10-05 10:10:07 -05:00
BradByte b75a00a233 docs: update the docs, add better example, iOS props (#279) 2022-10-04 10:53:01 -05:00
15 changed files with 2818 additions and 4435 deletions

No files matched your search

+18 -10
View File
@@ -2,21 +2,29 @@ name: CI
on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
- name: 🗂️ Checkout
uses: actions/checkout@v3
- name: ⚙️ Setup Node
uses: actions/setup-node@v3
with:
node-version: '14'
cache: 'yarn'
- run: yarn install
- run: npm run type-check
- run: npm run lint-check
- name: 🧱 Build
run: yarn
- name: 🚧 Type Check
run: npm run type-check
- name: 🛟 Lint Check
run: npm run lint-check
+30 -14
View File
@@ -2,22 +2,38 @@ name: Release
on:
push:
branches: [ master ]
jobs:
release:
runs-on: ubuntu-latest
branches: [master]
jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release-created: ${{ steps.release.outputs.releases_created }}
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
- uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: node
package-name: '@expo/react-native-action-sheet'
deploy:
needs: [release-please]
if: needs.release-please.outputs.release-created == 'true'
runs-on: ubuntu-latest
steps:
- name: 🗂️ Checkout
uses: actions/checkout@v3
- name: ⚙️ Setup Node
uses: actions/setup-node@v3
with:
node-version: '14'
cache: 'yarn'
- run: yarn install
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
- name: 🧱 Build
run: yarn
- name: 🚀 Deploy
uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
+39
View File
@@ -1,5 +1,44 @@
# Changelog
## [4.1.1](https://github.com/expo/react-native-action-sheet/compare/v4.1.0...v4.1.1) (2025-02-21)
### Bug Fixes
* Removal of `BackHandler.removeEventListener` in react-native ([#339](https://github.com/expo/react-native-action-sheet/issues/339)) ([b7e050c](https://github.com/expo/react-native-action-sheet/commit/b7e050c9abab17b9a3ac21afed5bc73cecbecd6d))
* show touch feedback on iOS when using custom action sheet ([#329](https://github.com/expo/react-native-action-sheet/issues/329)) ([1ce802b](https://github.com/expo/react-native-action-sheet/commit/1ce802b8f095f9c553002dd84cae694a30c2dc01))
## [4.1.0](https://github.com/expo/react-native-action-sheet/compare/v4.0.1...v4.1.0) (2024-05-15)
### Features
* update peer dep ([#324](https://github.com/expo/react-native-action-sheet/issues/324)) ([bc33f9f](https://github.com/expo/react-native-action-sheet/commit/bc33f9f4d0c171ff17c098f94fab1b22ed6816ed))
### Bug Fixes
* use release-please instead of semantic release ([#300](https://github.com/expo/react-native-action-sheet/issues/300)) ([b35a403](https://github.com/expo/react-native-action-sheet/commit/b35a403a213d596252ec5e8a20db5291396fafc0))
## [4.0.1](https://github.com/expo/react-native-action-sheet/compare/v4.0.0...v4.0.1) (2022-11-04)
### Bug Fixes
* expose ref on ActionSheetProvider for statically invoking ([#283](https://github.com/expo/react-native-action-sheet/issues/283)) ([b2f5f43](https://github.com/expo/react-native-action-sheet/commit/b2f5f433ff2070c77fdd62b273d2d80e636efd3a))
# [4.0.0](https://github.com/expo/react-native-action-sheet/compare/v3.14.0...v4.0.0) (2022-10-26)
### Features
* iOS use custom action sheet ([#281](https://github.com/expo/react-native-action-sheet/issues/281)) ([372dc80](https://github.com/expo/react-native-action-sheet/commit/372dc8065006a4da510ef5f31c27225d14a71ff3))
### BREAKING CHANGES
* This implementation is backwards compatible, but just to be safe I'm marking this as breaking so that it bumps the major version.
# [3.14.0](https://github.com/expo/react-native-action-sheet/compare/v3.13.1...v3.14.0) (2022-10-03)
+107 -120
View File
@@ -1,92 +1,101 @@
# react-native-action-sheet
# @expo/react-native-action-sheet
[![npm](https://img.shields.io/npm/v/@expo/react-native-action-sheet.svg?style=flat-square)](https://www.npmjs.com/package/@expo/react-native-action-sheet)
[![License: MIT](https://img.shields.io/github/license/nd-02110114/goofi-mobile.svg)](https://opensource.org/licenses/MIT)
[![Discord](https://img.shields.io/badge/discord-expo-green?style=flat-square&logo=discord)](https://discord.gg/4gtbPAdpaE)
ActionSheet 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](https://facebook.github.io/react-native/docs/actionsheetios.html) except it cannot be called statically.
React Native Action Sheet is a cross-platform React Native component that uses the native UIActionSheet on iOS and a pure JS implementation on Android.
| iOS | Android | Web |
| -------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------- |
| <img src="https://raw.githubusercontent.com/expo/react-native-action-sheet/master/gif/ios.gif" width="200" height="400"/> | <img src="https://raw.githubusercontent.com/expo/react-native-action-sheet/master/gif/android.gif" width="200" height="400"/> | <img src="https://raw.githubusercontent.com/expo/react-native-action-sheet/master/gif/web.gif" width="400" height="400"/> |
## [Check out the example snack here!](https://snack.expo.dev/@expo-action-sheet/example)
## Installation
```
$ npm install @expo/react-native-action-sheet -S
npm install @expo/react-native-action-sheet
```
or
```
$ yarn add @expo/react-native-action-sheet
yarn add @expo/react-native-action-sheet
```
## A basic ActionSheet Setup
### 1. Wrap your top-level component with `<ActionSheetProvider />`
```es6
ReactNativeActionSheet uses React context to allow your components to invoke the menu. This means your app needs to be wrapped with the `ActionSheetProvider` component first.
```jsx
import { ActionSheetProvider } from '@expo/react-native-action-sheet';
class AppContainer extends React.Component {
render() {
return (
<ActionSheetProvider>
<ConnectedApp />
</ActionSheetProvider>
);
}
export default function AppContainer() {
return (
<ActionSheetProvider>
<App />
</ActionSheetProvider>
);
}
```
### 2. Connect your component which uses showActionSheetWithOptions.
### 2. Call the `showActionSheetWithOptions` method with a hook or a higher order component.
```es6
import { connectActionSheet } from '@expo/react-native-action-sheet';
```tsx
// Using the provided hook
import { useActionSheet } from '@expo/react-native-action-sheet';
class App extends React.Component {
/* ... */
}
export default Menu() {
const { showActionSheetWithOptions } = useActionSheet();
const ConnectedApp = connectActionSheet(App);
const onPress = () => {
const options = ['Delete', 'Save', 'Cancel'];
const destructiveButtonIndex = 0;
const cancelButtonIndex = 2;
export default ConnectedApp;
```
`App` component can access the actionSheet method as `this.props.showActionSheetWithOptions`
```es6
_onOpenActionSheet = () => {
// Same interface as https://facebook.github.io/react-native/docs/actionsheetios.html
const options = ['Delete', 'Save', 'Cancel'];
const destructiveButtonIndex = 0;
const cancelButtonIndex = 2;
this.props.showActionSheetWithOptions(
{
showActionSheetWithOptions({
options,
cancelButtonIndex,
destructiveButtonIndex,
},
(buttonIndex) => {
// Do something here depending on the button index selected
}
);
destructiveButtonIndex
}, (selectedIndex: number) => {
switch (selectedIndex) {
case 1:
// Save
break;
case destructiveButtonIndex:
// Delete
break;
case cancelButtonIndex:
// Canceled
}});
}
return (
<Button title="Menu" onPress={onPress}/>
)
};
```
You can use a hook instead of the higher order component if you are on React 16.8 or newer.
Alternatively, any component can use the higher order component to access the context and pass the `showActionSheetWithOptions` as a prop.
```es6
import { useActionSheet } from '@expo/react-native-action-sheet';
```tsx
// Using a Higher Order Component to wrap your component
import { connectActionSheet } from '@expo/react-native-action-sheet';
export default function App() {
const { showActionSheetWithOptions } = useActionSheet();
function Menu({ showActionSheetWithOptions }) {
/* ... */
}
export default connectActionSheet(Menu);
```
`Menu` component can now access the actionSheet prop as `showActionSheetWithOptions`.
## Options
The goal of this library is to mimic the native iOS and Android ActionSheets as closely as possible.
@@ -95,97 +104,75 @@ This library can also be used in the browser with Expo for web.
### Universal Props
The same options available on React Native's [ActionSheetIOS](https://reactnative.dev/docs/0.64/actionsheetios#showactionsheetwithoptions) component exist for both iOS and Android in this library. Note: `disabledButtonIndices` is only available for iOS in Expo 43+ or RN 0.64.0+.
| Name | Type | Description |
| ------------------------ | -------------------------- | ------------------------------------------------------------- |
| `options` | array of strings | A list of button titles **(required)** |
| `cancelButtonIndex` | number | Index of cancel button in options |
| `cancelButtonTintColor` | string | Color used for the change the text color of the cancel button |
| `destructiveButtonIndex` | number or array of numbers | Indices of destructive buttons in options |
| `title` | string | Title to show above the action sheet |
| `message` | string | Message to show below the title |
| `tintColor` | string | Color used for non-destructive button titles |
| `disabledButtonIndices` | array of numbers | Indices of disabled buttons in options |
### iOS Only Props
| Name | Type | Required | Default |
| ------------------ | ------ | -------- | ------- |
| anchor | number | No | |
| userInterfaceStyle | string | No | |
| Name | Type | Description |
| -------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `anchor` | number | iPad only option that allows for docking the action sheet to a node. See [ShowActionSheetButton.tsx](/example/ShowActionSheetButton.tsx) for an example on how to implement this. |
| `userInterfaceStyle` | string | The interface style used for the action sheet, can be set to `light` or `dark`, otherwise the default system style will be used. |
#### `anchor` (optional)
iPad only option that allows for docking the action sheet to a node. See [ShowActionSheetButton.tsx](/example/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.
### Android/Web-Only Props
### Custom Action Sheet Only (Android/Web) Props
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](https://github.com/expo/react-native-action-sheet/issues/164)).
#### `destructiveColor`: (optional)
Modify color for text of destructive option.
| Name | Type | Description |
| ------------------ | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `icons` | array of required images or icons | 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` | boolean | 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` | TextStyle | Apply any text style props to the options. If the `tintColor` option is provided, it takes precedence over a color text style prop. |
| `titleTextStyle` | TextStyle | Apply any text style props to the title if present. |
| `messageTextStyle` | TextStyle | Apply any text style props to the message if present. |
| `autoFocus` | boolean | If `true`, this 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` | boolean | Show separators between items. On iOS, separators always show so this prop has no effect. |
| `containerStyle` | ViewStyle | Apply any view style props to the container rather than use the default look (e.g. dark mode). |
| `separatorStyle` | ViewStyle | Modify the look of the separators rather than use the default look. |
| `useModal` | boolean | Defaults to `false` (`true` if autoFocus is also `true`) Wraps the ActionSheet with a Modal, in order to show in front of other Modals that were already opened ([issue reference](https://github.com/expo/react-native-action-sheet/issues/164)). |
| `destructiveColor` | string | Modify color for text of destructive option. Defaults to `#d32f2f`. |
## ActionSheetProvider Props
The following props can be set directly on the `ActionSheetProvider`
#### `useNativeDriver` (optional)
| Name | Type | Description |
| ---------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `useCustomActionSheet` | boolean | iOS only prop that uses the custom pure JS action sheet (Android/Web version) instead of the native ActionSheetIOS component. Defaults to `false`. |
| `useNativeDriver` | boolean | Windows only option that provides the option to disable the [native animation](https://reactnative.dev/docs/animated#using-the-native-driver) 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](https://microsoft.github.io/react-native-windows/docs/win10-compat) so if your project is targeting that, you don't need to set this prop. |
Windows only option that provides the option to disable the [native animation](https://reactnative.dev/docs/animated#using-the-native-driver) 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](https://microsoft.github.io/react-native-windows/docs/win10-compat) so if your project is targeting that, you don't need to set this prop.
```jsx
// example of using useCustomActionSheet on iOS
export default function AppContainer() {
return (
<ActionSheetProvider useCustomActionSheet={true}>
<App />
</ActionSheetProvider>
);
}
```
## Callback
The second parameter of the `showActionSheetWithOptions` function is a callback for when a button is selected. The callback takes a single argument which will be the zero-based index of the pressed option. You can check the value against your `cancelButtonIndex` to determine if the action was cancelled or not.
```tsx
function onButtonPress(selectedIndex: number) {
// handle it!
}
```
## Try it out
Try it in Expo: https://expo.io/@community/react-native-action-sheet-example
Try it in Expo Snack: https://snack.expo.dev/@expo-action-sheet/example.
## Example
+48 -10
View File
@@ -3,7 +3,9 @@ import {
connectActionSheet,
ActionSheetProps,
} from '@expo/react-native-action-sheet';
import { Entypo } from '@expo/vector-icons';
import * as React from 'react';
import { useState } from 'react';
import {
Modal,
StyleSheet,
@@ -13,11 +15,15 @@ import {
SafeAreaView,
TouchableOpacity,
Share,
Platform,
} from 'react-native';
import ShowActionSheetButton from './ShowActionSheetButton';
type Props = ActionSheetProps;
type Props = ActionSheetProps & {
useCustomActionSheet: boolean;
setUseCustomActionSheet: (next: boolean) => void;
};
interface State {
selectedIndex?: number | null;
@@ -77,6 +83,35 @@ class App extends React.Component<Props, State> {
style={{
alignItems: 'center',
}}>
<View
style={{
alignItems: 'center',
display: Platform.OS === 'ios' ? 'flex' : 'none',
}}>
{this._renderSectionHeader('Use Custom Action Sheet')}
<Text style={{ marginBottom: 10 }}>
On iOS the default action sheet will be the native UI. However, you can optionally
enable the custom JS action sheet by setting the useCustomActionSheet prop on the
provider.
</Text>
<Entypo.Button
backgroundColor={this.props.useCustomActionSheet ? '#3e3e3e' : 'white'}
name={this.props.useCustomActionSheet ? 'check' : 'circle'}
color={this.props.useCustomActionSheet ? '#fff' : '#3e3e3e'}
style={{
borderColor: '#3e3e3e',
borderWidth: 2,
}}
onPress={() => this.props.setUseCustomActionSheet(!this.props.useCustomActionSheet)}>
<Text
style={{
fontSize: 15,
color: this.props.useCustomActionSheet ? '#fff' : '#3e3e3e',
}}>
Use Custom Action Sheet
</Text>
</Entypo.Button>
</View>
{this._renderSectionHeader('Universal Options')}
<ShowActionSheetButton
title="Options Only"
@@ -217,16 +252,19 @@ class App extends React.Component<Props, State> {
}
}
const ConnectedApp = connectActionSheet<object>(App);
const ConnectedApp = connectActionSheet<any>(App);
export default class AppContainer extends React.Component {
render() {
return (
<ActionSheetProvider>
<ConnectedApp />
</ActionSheetProvider>
);
}
export default function WrappedApp() {
const [useCustomActionSheet, setUseCustomActionSheet] = useState(false);
return (
<ActionSheetProvider useCustomActionSheet={useCustomActionSheet}>
<ConnectedApp
useCustomActionSheet={useCustomActionSheet}
setUseCustomActionSheet={setUseCustomActionSheet}
/>
</ActionSheetProvider>
);
}
const styles = StyleSheet.create({
+1 -1
View File
@@ -18,7 +18,7 @@
"hoist-non-react-statics": "^3.3.0",
"react": "18.0.0",
"react-dom": "18.0.0",
"react-native": "0.69.6",
"react-native": "0.69.9",
"react-native-web": "~0.18.7"
},
"devDependencies": {
+157 -175
View File
@@ -38,6 +38,14 @@
dependencies:
"@babel/highlight" "^7.18.6"
"@babel/code-frame@^7.22.13":
version "7.22.13"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.22.13.tgz#e3c1c099402598483b7a8c46a721d1038803755e"
integrity sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==
dependencies:
"@babel/highlight" "^7.22.13"
chalk "^2.4.2"
"@babel/compat-data@^7.13.11", "@babel/compat-data@^7.15.0":
version "7.15.0"
resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.15.0.tgz#2dbaf8b85334796cafbb0f5793a90a2fc010b176"
@@ -69,15 +77,6 @@
json5 "^2.2.1"
semver "^6.3.0"
"@babel/generator@^7.12.5":
version "7.12.5"
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.12.5.tgz#a2c50de5c8b6d708ab95be5e6053936c1884a4de"
integrity sha512-m16TQQJ8hPt7E+OS/XVQg/7U184MLXtvuGbCdA7na61vha+ImkyyNM/9DDA0unYCVZn3ZOhng+qz48/KBOT96A==
dependencies:
"@babel/types" "^7.12.5"
jsesc "^2.5.1"
source-map "^0.5.0"
"@babel/generator@^7.14.0", "@babel/generator@^7.19.3":
version "7.19.3"
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.19.3.tgz#d7f4d1300485b4547cb6f94b27d10d237b42bf59"
@@ -87,25 +86,15 @@
"@jridgewell/gen-mapping" "^0.3.2"
jsesc "^2.5.1"
"@babel/generator@^7.15.4":
version "7.15.4"
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.15.4.tgz#85acb159a267ca6324f9793986991ee2022a05b0"
integrity sha512-d3itta0tu+UayjEORPNz6e1T3FtvWlP5N4V5M+lhp/CxT4oAA7/NcScnpRyspUMLK6tu9MNHmQHxRykuN2R7hw==
"@babel/generator@^7.23.0":
version "7.23.0"
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.23.0.tgz#df5c386e2218be505b34837acbcb874d7a983420"
integrity sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==
dependencies:
"@babel/types" "^7.15.4"
"@babel/types" "^7.23.0"
"@jridgewell/gen-mapping" "^0.3.2"
"@jridgewell/trace-mapping" "^0.3.17"
jsesc "^2.5.1"
source-map "^0.5.0"
"@babel/generator@^7.5.0":
version "7.5.0"
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.5.0.tgz#f20e4b7a91750ee8b63656073d843d2a736dca4a"
integrity sha512-1TTVrt7J9rcG5PMjvO7VEG3FrEoEJNHxumRq66GemPmzboLWtIjjcJgk8rokuAS7IiRSpgVSu5Vb9lc99iJkOA==
dependencies:
"@babel/types" "^7.5.0"
jsesc "^2.5.1"
lodash "^4.17.11"
source-map "^0.5.0"
trim-right "^1.0.1"
"@babel/helper-annotate-as-pure@^7.0.0":
version "7.0.0"
@@ -273,6 +262,11 @@
resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz#0c0cee9b35d2ca190478756865bb3528422f51be"
integrity sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==
"@babel/helper-environment-visitor@^7.22.20":
version "7.22.20"
resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz#96159db61d34a29dba454c959f5ae4a649ba9167"
integrity sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==
"@babel/helper-explode-assignable-expression@^7.1.0":
version "7.1.0"
resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.1.0.tgz#537fa13f6f1674df745b0c00ec8fe4e99681c8f6"
@@ -323,6 +317,14 @@
"@babel/template" "^7.18.10"
"@babel/types" "^7.19.0"
"@babel/helper-function-name@^7.23.0":
version "7.23.0"
resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz#1f9a3cdbd5b2698a670c30d2735f9af95ed52759"
integrity sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==
dependencies:
"@babel/template" "^7.22.15"
"@babel/types" "^7.23.0"
"@babel/helper-get-function-arity@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0.tgz#83572d4320e2a4657263734113c42868b64e49c3"
@@ -351,12 +353,12 @@
dependencies:
"@babel/types" "^7.15.4"
"@babel/helper-hoist-variables@^7.18.6":
version "7.18.6"
resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz#d4d2c8fb4baeaa5c68b99cc8245c56554f926678"
integrity sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==
"@babel/helper-hoist-variables@^7.22.5":
version "7.22.5"
resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz#c01a007dac05c085914e8fb652b339db50d823bb"
integrity sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==
dependencies:
"@babel/types" "^7.18.6"
"@babel/types" "^7.22.5"
"@babel/helper-hoist-variables@^7.4.4":
version "7.4.4"
@@ -619,7 +621,7 @@
dependencies:
"@babel/types" "^7.18.9"
"@babel/helper-split-export-declaration@^7.10.4", "@babel/helper-split-export-declaration@^7.11.0":
"@babel/helper-split-export-declaration@^7.10.4":
version "7.11.0"
resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.11.0.tgz#f8a491244acf6a676158ac42072911ba83ad099f"
integrity sha512-74Vejvp6mHkGE+m+k5vHY93FX2cAtrw1zXrZXRlG4l410Nm9PxfEiVTn1PjDPV5SnmieiueY4AFg2xqhNFuuZg==
@@ -640,6 +642,13 @@
dependencies:
"@babel/types" "^7.18.6"
"@babel/helper-split-export-declaration@^7.22.6":
version "7.22.6"
resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz#322c61b7310c0997fe4c323955667f18fcefb91c"
integrity sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==
dependencies:
"@babel/types" "^7.22.5"
"@babel/helper-split-export-declaration@^7.4.4":
version "7.4.4"
resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.4.4.tgz#ff94894a340be78f53f06af038b205c49d993677"
@@ -652,6 +661,11 @@
resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.18.10.tgz#181f22d28ebe1b3857fa575f5c290b1aaf659b56"
integrity sha512-XtIfWmeNY3i4t7t4D2t02q50HvqHybPqW2ki1kosnvWCwuCMeo81Jf0gwr85jy/neUdg5XDdeFE/80DXiO+njw==
"@babel/helper-string-parser@^7.22.5":
version "7.22.5"
resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz#533f36457a25814cf1df6488523ad547d784a99f"
integrity sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==
"@babel/helper-validator-identifier@^7.10.4":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz#a78c7a7251e01f616512d31b10adcf52ada5e0d2"
@@ -667,6 +681,11 @@
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2"
integrity sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==
"@babel/helper-validator-identifier@^7.22.20":
version "7.22.20"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0"
integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==
"@babel/helper-validator-option@^7.14.5":
version "7.14.5"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.14.5.tgz#6e72a1fff18d5dfcb878e1e62f1a021c4b72d5a3"
@@ -742,6 +761,15 @@
chalk "^2.0.0"
js-tokens "^4.0.0"
"@babel/highlight@^7.22.13":
version "7.22.20"
resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.22.20.tgz#4ca92b71d80554b01427815e06f2df965b9c1f54"
integrity sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==
dependencies:
"@babel/helper-validator-identifier" "^7.22.20"
chalk "^2.4.2"
js-tokens "^4.0.0"
"@babel/parser@^7.12.7":
version "7.12.7"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.7.tgz#fee7b39fe809d0e73e5b25eecaf5780ef3d73056"
@@ -757,7 +785,12 @@
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.15.7.tgz#0c3ed4a2eb07b165dfa85b3cc45c727334c4edae"
integrity sha512-rycZXvQ+xS9QyIcJ9HXeDWf1uxqlbVFAUq0Rq0dbc50Zb/+wUe/ehyfzGfm9KZZF0kBejYgxltBXocP+gKdL2g==
"@babel/parser@^7.4.4", "@babel/parser@^7.5.0":
"@babel/parser@^7.22.15", "@babel/parser@^7.23.0":
version "7.23.0"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.0.tgz#da950e622420bf96ca0d0f2909cdddac3acd8719"
integrity sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==
"@babel/parser@^7.4.4":
version "7.5.0"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.5.0.tgz#3e0713dff89ad6ae37faec3b29dcfc5c979770b7"
integrity sha512-I5nW8AhGpOXGCCNYGc+p7ExQIBxRFnS2fd/d862bNOKvmoEPjYPcfIjsfdy0ujagYOIYPczKgD9l3FsgTkAzKA==
@@ -1902,68 +1935,32 @@
"@babel/parser" "^7.18.10"
"@babel/types" "^7.18.10"
"@babel/traverse@^7.1.0", "@babel/traverse@^7.4.4":
version "7.5.0"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.5.0.tgz#4216d6586854ef5c3c4592dab56ec7eb78485485"
integrity sha512-SnA9aLbyOCcnnbQEGwdfBggnc142h/rbqqsXcaATj2hZcegCl903pUD/lfpsNBlBSuWow/YDfRyJuWi2EPR5cg==
"@babel/template@^7.22.15":
version "7.22.15"
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.22.15.tgz#09576efc3830f0430f4548ef971dde1350ef2f38"
integrity sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==
dependencies:
"@babel/code-frame" "^7.0.0"
"@babel/generator" "^7.5.0"
"@babel/helper-function-name" "^7.1.0"
"@babel/helper-split-export-declaration" "^7.4.4"
"@babel/parser" "^7.5.0"
"@babel/types" "^7.5.0"
debug "^4.1.0"
globals "^11.1.0"
lodash "^4.17.11"
"@babel/code-frame" "^7.22.13"
"@babel/parser" "^7.22.15"
"@babel/types" "^7.22.15"
"@babel/traverse@^7.12.5":
version "7.12.9"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.12.9.tgz#fad26c972eabbc11350e0b695978de6cc8e8596f"
integrity sha512-iX9ajqnLdoU1s1nHt36JDI9KG4k+vmI8WgjK5d+aDTwQbL2fUnzedNedssA645Ede3PM2ma1n8Q4h2ohwXgMXw==
"@babel/traverse@^7.1.0", "@babel/traverse@^7.12.5", "@babel/traverse@^7.13.0", "@babel/traverse@^7.14.0", "@babel/traverse@^7.15.4", "@babel/traverse@^7.19.0", "@babel/traverse@^7.19.1", "@babel/traverse@^7.19.3", "@babel/traverse@^7.4.4":
version "7.23.2"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.2.tgz#329c7a06735e144a506bdb2cad0268b7f46f4ad8"
integrity sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw==
dependencies:
"@babel/code-frame" "^7.10.4"
"@babel/generator" "^7.12.5"
"@babel/helper-function-name" "^7.10.4"
"@babel/helper-split-export-declaration" "^7.11.0"
"@babel/parser" "^7.12.7"
"@babel/types" "^7.12.7"
debug "^4.1.0"
globals "^11.1.0"
lodash "^4.17.19"
"@babel/traverse@^7.13.0", "@babel/traverse@^7.15.4":
version "7.15.4"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.15.4.tgz#ff8510367a144bfbff552d9e18e28f3e2889c22d"
integrity sha512-W6lQD8l4rUbQR/vYgSuCAE75ADyyQvOpFVsvPPdkhf6lATXAsQIG9YdtOcu8BB1dZ0LKu+Zo3c1wEcbKeuhdlA==
dependencies:
"@babel/code-frame" "^7.14.5"
"@babel/generator" "^7.15.4"
"@babel/helper-function-name" "^7.15.4"
"@babel/helper-hoist-variables" "^7.15.4"
"@babel/helper-split-export-declaration" "^7.15.4"
"@babel/parser" "^7.15.4"
"@babel/types" "^7.15.4"
"@babel/code-frame" "^7.22.13"
"@babel/generator" "^7.23.0"
"@babel/helper-environment-visitor" "^7.22.20"
"@babel/helper-function-name" "^7.23.0"
"@babel/helper-hoist-variables" "^7.22.5"
"@babel/helper-split-export-declaration" "^7.22.6"
"@babel/parser" "^7.23.0"
"@babel/types" "^7.23.0"
debug "^4.1.0"
globals "^11.1.0"
"@babel/traverse@^7.14.0", "@babel/traverse@^7.19.0", "@babel/traverse@^7.19.1", "@babel/traverse@^7.19.3":
version "7.19.3"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.19.3.tgz#3a3c5348d4988ba60884e8494b0592b2f15a04b4"
integrity sha512-qh5yf6149zhq2sgIXmwjnsvmnNQC2iw70UFjp4olxucKrWd/dvlUsBI88VSLUsnMNF7/vnOiA+nk1+yLoCqROQ==
dependencies:
"@babel/code-frame" "^7.18.6"
"@babel/generator" "^7.19.3"
"@babel/helper-environment-visitor" "^7.18.9"
"@babel/helper-function-name" "^7.19.0"
"@babel/helper-hoist-variables" "^7.18.6"
"@babel/helper-split-export-declaration" "^7.18.6"
"@babel/parser" "^7.19.3"
"@babel/types" "^7.19.3"
debug "^4.1.0"
globals "^11.1.0"
"@babel/types@^7.0.0", "@babel/types@^7.3.0", "@babel/types@^7.4.4", "@babel/types@^7.5.0":
"@babel/types@^7.0.0", "@babel/types@^7.3.0", "@babel/types@^7.4.4":
version "7.5.0"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.5.0.tgz#e47d43840c2e7f9105bc4d3a2c371b4d0c7832ab"
integrity sha512-UFpDVqRABKsW01bvw7/wSUe56uy6RXM5+VJibVVAybDGxEW25jdwiFJEf7ASvSaC7sN7rbE/l3cLp2izav+CtQ==
@@ -1998,6 +1995,15 @@
"@babel/helper-validator-identifier" "^7.19.1"
to-fast-properties "^2.0.0"
"@babel/types@^7.22.15", "@babel/types@^7.22.5", "@babel/types@^7.23.0":
version "7.23.0"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.23.0.tgz#8c1f020c9df0e737e4e247c0619f58c68458aaeb"
integrity sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==
dependencies:
"@babel/helper-string-parser" "^7.22.5"
"@babel/helper-validator-identifier" "^7.22.20"
to-fast-properties "^2.0.0"
"@expo/[email protected]", "@expo/bunyan@^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/@expo/bunyan/-/bunyan-4.0.0.tgz#be0c1de943c7987a9fbd309ea0b1acd605890c7b"
@@ -2375,6 +2381,11 @@
resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78"
integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==
"@jridgewell/resolve-uri@^3.1.0":
version "3.1.1"
resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721"
integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==
"@jridgewell/set-array@^1.0.0", "@jridgewell/set-array@^1.0.1":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72"
@@ -2385,6 +2396,19 @@
resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24"
integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==
"@jridgewell/sourcemap-codec@^1.4.14":
version "1.4.15"
resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32"
integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==
"@jridgewell/trace-mapping@^0.3.17":
version "0.3.19"
resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz#f8a3249862f91be48d3127c3cfe992f79b4b8811"
integrity sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw==
dependencies:
"@jridgewell/resolve-uri" "^3.1.0"
"@jridgewell/sourcemap-codec" "^1.4.14"
"@jridgewell/trace-mapping@^0.3.9":
version "0.3.15"
resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.15.tgz#aba35c48a38d3fd84b37e66c9c0423f9744f9774"
@@ -2631,9 +2655,9 @@
"@hapi/hoek" "^9.0.0"
"@sideway/formula@^3.0.0":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@sideway/formula/-/formula-3.0.0.tgz#fe158aee32e6bd5de85044be615bc08478a0a13c"
integrity sha512-vHe7wZ4NOXVfkoRb8T5otiENVlT7a3IAiw7H5M2+GO+9CDgcVUUsX1zalAztCmwyOr2RUTGJdgB+ZvSVqmdHmg==
version "3.0.1"
resolved "https://registry.yarnpkg.com/@sideway/formula/-/formula-3.0.1.tgz#80fcbcbaf7ce031e0ef2dd29b1bfc7c3f583611f"
integrity sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg==
"@sideway/pinpoint@^2.0.0":
version "2.0.0"
@@ -2749,9 +2773,9 @@
wonka "^4.0.14"
"@xmldom/xmldom@~0.7.0":
version "0.7.5"
resolved "https://registry.yarnpkg.com/@xmldom/xmldom/-/xmldom-0.7.5.tgz#09fa51e356d07d0be200642b0e4f91d8e6dd408d"
integrity sha512-V3BIhmY36fXZ1OtVcI9W+FxQqxVLsPKcNjWigIaa81dLC9IolJl5Mt4Cvhmr0flUnjSpTdrbMTSbXqYqV5dT6A==
version "0.7.10"
resolved "https://registry.yarnpkg.com/@xmldom/xmldom/-/xmldom-0.7.10.tgz#b1f4a7dc63ac35b2750847644d5dacf5b4ead12f"
integrity sha512-hb9QhOg5MGmpVkFcoZ9XJMe1em5gd0e2eqqjK87O1dwULedXsnY/Zg/Ju6lcohA+t6jVkmKpe7I1etqhvdRdrQ==
abort-controller@^3.0.0:
version "3.0.0"
@@ -2894,21 +2918,6 @@ arr-union@^3.1.0:
resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4"
integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=
array-filter@~0.0.0:
version "0.0.1"
resolved "https://registry.yarnpkg.com/array-filter/-/array-filter-0.0.1.tgz#7da8cf2e26628ed732803581fd21f67cacd2eeec"
integrity sha1-fajPLiZijtcygDWB/SH2fKzS7uw=
array-map@~0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/array-map/-/array-map-0.0.0.tgz#88a2bab73d1cf7bcd5c1b118a003f66f665fa662"
integrity sha1-iKK6tz0c97zVwbEYoAP2b2ZfpmI=
array-reduce@~0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/array-reduce/-/array-reduce-0.0.0.tgz#173899d3ffd1c7d9383e4479525dbe278cab5f2b"
integrity sha1-FziZ0//Rx9k4PkR5Ul2+J4yrXys=
array-union@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d"
@@ -3747,9 +3756,9 @@ decamelize@^1.2.0:
integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=
decode-uri-component@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545"
integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=
version "0.2.2"
resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.2.tgz#e69dbe25d37941171dd540e024c444cd5188e1e9"
integrity sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==
deep-extend@^0.6.0:
version "0.6.0"
@@ -4750,9 +4759,9 @@ ip-regex@^2.1.0:
integrity sha512-58yWmlHpp7VYfcdTwMTvwMmqx/Elfxjd9RXTDyMsbL7lLWmhMylLEqiYVLKuLzOZqVgiWXD9MfR62Vv89VRxkw==
ip@^1.1.5:
version "1.1.5"
resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.5.tgz#bdded70114290828c0a039e72ef25f5aaec4354a"
integrity sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=
version "1.1.9"
resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.9.tgz#8dfbcc99a754d07f425310b86a99546b1151e396"
integrity sha512-cyRxvOEpNHNtchU3Ln9KC/auJgup87llfQpQ+t5ghoC/UhL16SWzbueiCsdTnWmqAWl7LadfuwhlqmtOaqMHdQ==
ipaddr.js@^1.9.0:
version "1.9.1"
@@ -5201,11 +5210,6 @@ jsonfile@^6.0.1:
optionalDependencies:
graceful-fs "^4.1.6"
jsonify@~0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73"
integrity sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=
kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0:
version "3.2.2"
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64"
@@ -5747,20 +5751,13 @@ mimic-fn@^2.1.0:
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b"
integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==
"minimatch@2 || 3", minimatch@^3.1.1:
"minimatch@2 || 3", minimatch@^3.0.2, minimatch@^3.0.4, minimatch@^3.1.1:
version "3.1.2"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==
dependencies:
brace-expansion "^1.1.7"
minimatch@^3.0.2, minimatch@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==
dependencies:
brace-expansion "^1.1.7"
[email protected]:
version "0.0.8"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d"
@@ -5811,6 +5808,11 @@ minipass@^3.0.0, minipass@^3.1.1:
dependencies:
yallist "^4.0.0"
minipass@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/minipass/-/minipass-5.0.0.tgz#3e9788ffb90b694a5d0ec94479a45b5d8738133d"
integrity sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==
minizlib@^2.1.1:
version "2.1.2"
resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-2.1.2.tgz#e90d3466ba209b932451508a11ce3d3632145931"
@@ -6544,10 +6546,10 @@ react-native-web@~0.18.7:
postcss-value-parser "^4.2.0"
styleq "^0.1.2"
[email protected].6:
version "0.69.6"
resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.69.6.tgz#cdd1a5757d902b91b165c28fdda4e518ed6f683a"
integrity sha512-wwXpqM+12kdEYdBZCJUb5SBu95CzgejrwFeYJ78RzHZV/Sj6DBRekbsHGrDDsY4R25QXALQxy4DQYQCObVvWjA==
[email protected].9:
version "0.69.9"
resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.69.9.tgz#c988dfc2e21b3b586d35a8cc57b102537e760edc"
integrity sha512-I1xqIn47RWxBToO4E6yqyIPSaK9mZnMiscMfrFpWjQr3Gdkicr9y+twmtrRszxaLdQLjHzh/M3y4qOqc3hZnpg==
dependencies:
"@jest/create-cache-key-function" "^27.0.1"
"@react-native-community/cli" "^8.0.4"
@@ -6970,19 +6972,19 @@ [email protected]:
integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==
semver@^5.5.0, semver@^5.5.1, semver@^5.6.0:
version "5.7.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b"
integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==
version "5.7.2"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8"
integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==
semver@^6.1.1, semver@^6.1.2, semver@^6.3.0:
version "6.3.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==
version "6.3.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4"
integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==
semver@^7.3.5:
version "7.3.5"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7"
integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==
version "7.5.4"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e"
integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==
dependencies:
lru-cache "^6.0.0"
@@ -7107,20 +7109,10 @@ shebang-regex@^3.0.0:
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172"
integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==
shell-quote@^1.6.1:
version "1.6.1"
resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.6.1.tgz#f4781949cce402697127430ea3b3c5476f481767"
integrity sha1-9HgZSczkAmlxJ0MOo7PFR29IF2c=
dependencies:
array-filter "~0.0.0"
array-map "~0.0.0"
array-reduce "~0.0.0"
jsonify "~0.0.0"
shell-quote@^1.7.3:
version "1.7.3"
resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.3.tgz#aa40edac170445b9a431e17bb62c0b881b9c4123"
integrity sha512-Vpfqwm4EnqGdlsBFNmHhxhElJYrdfcxPThu+ryKS5J8L/fhAwLazFZtq+S+TWZ9ANj2piSQLGj6NQg+lKPmxrw==
shell-quote@^1.6.1, shell-quote@^1.7.3:
version "1.7.4"
resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.4.tgz#33fe15dee71ab2a81fcbd3a52106c5cfb9fb75d8"
integrity sha512-8o/QEhSSRb1a5i7TFR0iM4G16Z0vYB2OQVs4G3aAFXjn3T6yEx8AZxy1PgDF7I00LZHYA3WxaSYIf5e5sAX8Rw==
signal-exit@^3.0.0, signal-exit@^3.0.2:
version "3.0.2"
@@ -7214,7 +7206,7 @@ source-map-url@^0.4.0:
resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3"
integrity sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=
source-map@^0.5.0, source-map@^0.5.6:
source-map@^0.5.6:
version "0.5.7"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=
@@ -7404,13 +7396,13 @@ supports-hyperlinks@^2.0.0:
supports-color "^7.0.0"
tar@^6.0.2, tar@^6.0.5:
version "6.1.11"
resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.11.tgz#6760a38f003afa1b2ffd0ffe9e9abbd0eab3d621"
integrity sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==
version "6.2.1"
resolved "https://registry.yarnpkg.com/tar/-/tar-6.2.1.tgz#717549c541bc3c2af15751bea94b1dd068d4b03a"
integrity sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==
dependencies:
chownr "^2.0.0"
fs-minipass "^2.0.0"
minipass "^3.0.0"
minipass "^5.0.0"
minizlib "^2.1.1"
mkdirp "^1.0.3"
yallist "^4.0.0"
@@ -7574,11 +7566,6 @@ traverse@~0.6.6:
resolved "https://registry.yarnpkg.com/traverse/-/traverse-0.6.6.tgz#cbdf560fd7b9af632502fed40f918c157ea97137"
integrity sha512-kdf4JKs8lbARxWdp7RKdNzoJBhGUcIalSYibuGyHJbmk40pOysQ0+QPvlkCOICOivDWU2IJo2rkrxyTK2AH4fw==
trim-right@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003"
integrity sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=
ts-interface-checker@^0.1.9:
version "0.1.13"
resolved "https://registry.yarnpkg.com/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz#784fd3d679722bc103b1b4b8030bcddb5db2a699"
@@ -7637,15 +7624,10 @@ typescript@^4.6.3:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.4.tgz#c464abca159669597be5f96b8943500b238e60e6"
integrity sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==
ua-parser-js@^0.7.18:
version "0.7.28"
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.28.tgz#8ba04e653f35ce210239c64661685bf9121dec31"
integrity sha512-6Gurc1n//gjp9eQNXjD9O3M/sMwVtN5S8Lv9bvOYBfKfDNiIIhqiyi01vMBO45u4zkDE420w/e0se7Vs+sIg+g==
ua-parser-js@^0.7.30:
version "0.7.31"
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.31.tgz#649a656b191dffab4f21d5e053e27ca17cbff5c6"
integrity sha512-qLK/Xe9E2uzmYI3qLeOmI0tEOt+TBBQyUIAh4aAgU05FVYzeZrKUdkAZfBNVGRaHVgV0TDkdEngJSw/SyQchkQ==
ua-parser-js@^0.7.18, ua-parser-js@^0.7.30:
version "0.7.33"
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.33.tgz#1d04acb4ccef9293df6f70f2c3d22f3030d8b532"
integrity sha512-s8ax/CeZdK9R/56Sui0WM6y9OFREJarMRHqLB2EwkovemBxNQ+Bqu8GAsUnVcXKgphb++ghr/B2BZx4mahujPw==
uglify-es@^3.1.9:
version "3.3.9"
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@expo/react-native-action-sheet",
"version": "3.14.0",
"version": "4.1.1",
"description": "A cross-platform ActionSheet for React Native",
"react-native": "lib/module/index.js",
"types": "lib/typescript/index.d.ts",
@@ -43,13 +43,13 @@
"husky": "^3.0.0",
"lint-staged": "^9.2.0",
"prettier": "^2.3.2",
"react": "^16.8.6",
"react-native": "https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz",
"semantic-release": "^19.0.3",
"react": "18.0.0",
"react-dom": "18.0.0",
"react-native": "0.69.9",
"typescript": "^3.5.3"
},
"peerDependencies": {
"react": ">=16.3.0"
"react": ">=18.0.0"
},
"@react-native-community/bob": {
"source": "src",
+340
View File
@@ -0,0 +1,340 @@
import * as React from 'react';
import {
Animated,
BackHandler,
Easing,
Modal,
NativeEventSubscription,
Platform,
StyleSheet,
TouchableWithoutFeedback,
View,
ViewProps,
} from 'react-native';
import { ActionSheetOptions } from '../types';
import ActionGroup from './ActionGroup';
interface State {
isVisible: boolean;
isAnimating: boolean;
options: ActionSheetOptions | null;
onSelect: ((i: number) => void) | null;
overlayOpacity: any;
sheetOpacity: any;
}
export interface Props {
readonly children: React.ReactNode;
readonly useNativeDriver?: boolean;
readonly pointerEvents?: ViewProps['pointerEvents'];
}
const OPACITY_ANIMATION_IN_TIME = 225;
const OPACITY_ANIMATION_OUT_TIME = 195;
const EASING_OUT = Easing.bezier(0.25, 0.46, 0.45, 0.94);
const EASING_IN = Easing.out(EASING_OUT);
const ESCAPE_KEY = 'Escape';
// Has same API as https://facebook.github.io/react-native/docs/actionsheetios.html
export default class CustomActionSheet extends React.Component<Props, State> {
_actionSheetHeight = 360;
_backHandlerListener: NativeEventSubscription | undefined;
state: State = {
isVisible: false,
isAnimating: false,
options: null,
onSelect: null,
overlayOpacity: new Animated.Value(0),
sheetOpacity: new Animated.Value(0),
};
_deferAfterAnimation?: () => void = undefined;
componentDidMount() {
if (Platform.OS === 'web') {
document.addEventListener('keydown', this._handleWebKeyDown);
}
}
componentWillUnmount() {
if (Platform.OS === 'web') {
document.removeEventListener('keydown', this._handleWebKeyDown);
}
}
_handleWebKeyDown = (event: KeyboardEvent): void => {
if (event.key === ESCAPE_KEY && this.state.isVisible) {
event.preventDefault();
this._selectCancelButton();
}
};
_setActionSheetHeight = ({ nativeEvent }: any) =>
(this._actionSheetHeight = nativeEvent.layout.height);
render() {
const { isVisible, overlayOpacity, options } = this.state;
const useModal = options ? options.autoFocus || options.useModal === true : false;
const overlay = isVisible ? (
<Animated.View
style={[
styles.overlay,
{
opacity: overlayOpacity,
},
]}
/>
) : null;
// While the sheet is visible, hide the rest of the app's content from screen readers.
const appContent = (
<View
style={styles.flexContainer}
importantForAccessibility={isVisible ? 'no-hide-descendants' : 'auto'}>
{React.Children.only(this.props.children)}
</View>
);
return (
<View pointerEvents={this.props.pointerEvents} style={styles.flexContainer}>
{appContent}
{isVisible && !useModal && (
<>
{overlay}
{this._renderSheet()}
</>
)}
{isVisible && useModal && (
<Modal animationType="none" transparent onRequestClose={this._selectCancelButton}>
{overlay}
{this._renderSheet()}
</Modal>
)}
</View>
);
}
_renderSheet() {
const { options, isAnimating, sheetOpacity } = this.state;
if (!options) {
return null;
}
const {
options: optionsArray,
icons,
tintIcons,
destructiveButtonIndex,
disabledButtonIndices,
destructiveColor,
textStyle,
tintColor,
title,
titleTextStyle,
message,
messageTextStyle,
autoFocus,
showSeparators,
containerStyle,
separatorStyle,
cancelButtonIndex,
cancelButtonTintColor,
} = options;
return (
<TouchableWithoutFeedback importantForAccessibility="yes" onPress={this._selectCancelButton}>
<Animated.View
needsOffscreenAlphaCompositing={isAnimating}
style={[
styles.sheetContainer,
{
opacity: sheetOpacity,
transform: [
{
translateY: sheetOpacity.interpolate({
inputRange: [0, 1],
outputRange: [this._actionSheetHeight, 0],
}),
},
],
},
]}>
<View style={styles.sheet} onLayout={this._setActionSheetHeight}>
<ActionGroup
options={optionsArray}
icons={icons}
tintIcons={tintIcons === undefined ? true : tintIcons}
cancelButtonIndex={cancelButtonIndex}
cancelButtonTintColor={cancelButtonTintColor}
destructiveButtonIndex={destructiveButtonIndex}
destructiveColor={destructiveColor}
disabledButtonIndices={disabledButtonIndices}
onSelect={this._onSelect}
startIndex={0}
length={optionsArray.length}
textStyle={textStyle || {}}
tintColor={tintColor}
title={title || undefined}
titleTextStyle={titleTextStyle}
message={message || undefined}
messageTextStyle={messageTextStyle}
autoFocus={autoFocus}
showSeparators={showSeparators}
containerStyle={containerStyle}
separatorStyle={separatorStyle}
/>
</View>
</Animated.View>
</TouchableWithoutFeedback>
);
}
showActionSheetWithOptions = (options: ActionSheetOptions, onSelect: (i: number) => void) => {
const { isVisible, overlayOpacity, sheetOpacity } = this.state;
const { useNativeDriver = true } = this.props;
if (isVisible) {
this._deferAfterAnimation = this.showActionSheetWithOptions.bind(this, options, onSelect);
return;
}
this.setState({
options,
onSelect,
isVisible: true,
isAnimating: true,
});
overlayOpacity.setValue(0);
sheetOpacity.setValue(0);
Animated.parallel([
Animated.timing(overlayOpacity, {
toValue: 0.32,
easing: EASING_OUT,
duration: OPACITY_ANIMATION_IN_TIME,
useNativeDriver,
}),
Animated.timing(sheetOpacity, {
toValue: 1,
easing: EASING_OUT,
duration: OPACITY_ANIMATION_IN_TIME,
useNativeDriver,
}),
]).start((result) => {
if (result.finished) {
this.setState({
isAnimating: false,
});
this._deferAfterAnimation = undefined;
}
});
this._backHandlerListener = BackHandler.addEventListener(
// @ts-ignore: Argument of type '"actionSheetHardwareBackPress"' is not assignable to parameter of type '"hardwareBackPress"'
'actionSheetHardwareBackPress',
this._selectCancelButton
);
};
_selectCancelButton = () => {
const { options } = this.state;
if (!options) {
return false;
}
if (typeof options.cancelButtonIndex === 'undefined') {
return false;
} else if (typeof options.cancelButtonIndex === 'number') {
return this._onSelect(options.cancelButtonIndex);
} else {
return this._animateOut();
}
};
_onSelect = (index: number): boolean => {
const { isAnimating, onSelect } = this.state;
if (isAnimating) {
return false;
}
if (onSelect) {
this._deferAfterAnimation = onSelect.bind(this, index);
}
return this._animateOut();
};
_animateOut = (): boolean => {
const { isAnimating, overlayOpacity, sheetOpacity } = this.state;
const { useNativeDriver = true } = this.props;
if (isAnimating) {
return false;
}
if (this._backHandlerListener) {
this._backHandlerListener.remove();
}
this.setState({
isAnimating: true,
});
Animated.parallel([
Animated.timing(overlayOpacity, {
toValue: 0,
easing: EASING_IN,
duration: OPACITY_ANIMATION_OUT_TIME,
useNativeDriver,
}),
Animated.timing(sheetOpacity, {
toValue: 0,
easing: EASING_IN,
duration: OPACITY_ANIMATION_OUT_TIME,
useNativeDriver,
}),
]).start((result) => {
if (result.finished) {
this.setState({
isVisible: false,
isAnimating: false,
});
if (this._deferAfterAnimation) {
this._deferAfterAnimation();
}
}
});
return true;
};
}
const styles = StyleSheet.create({
flexContainer: {
flex: 1,
},
overlay: {
position: 'absolute',
top: 0,
right: 0,
bottom: 0,
left: 0,
backgroundColor: 'black',
},
sheetContainer: {
position: 'absolute',
left: 0,
right: 0,
bottom: 0,
top: 0,
backgroundColor: 'transparent',
alignItems: 'flex-end',
justifyContent: 'center',
flexDirection: 'row',
},
sheet: {
flex: 1,
backgroundColor: 'transparent',
},
});
@@ -7,7 +7,7 @@ import {
TouchableWithoutFeedbackProps,
} from 'react-native';
// This TouchableOpacity has the same staic method of TouchableNativeFeedback
// This TouchableOpacity has the same static method of TouchableNativeFeedback
class CustomTouchableOpacity extends React.Component {
static SelectableBackground = () => ({});
static SelectableBackgroundBorderless = () => ({});
@@ -19,8 +19,8 @@ class CustomTouchableOpacity extends React.Component {
}
const TouchableComponent = Platform.select({
web: CustomTouchableOpacity,
default: Platform.Version <= 20 ? CustomTouchableOpacity : TouchableNativeFeedback,
default: CustomTouchableOpacity,
android: Platform.Version <= 20 ? CustomTouchableOpacity : TouchableNativeFeedback,
});
type Props = TouchableWithoutFeedbackProps & {
+2 -334
View File
@@ -1,334 +1,2 @@
import * as React from 'react';
import {
Animated,
BackHandler,
Easing,
Modal,
Platform,
StyleSheet,
TouchableWithoutFeedback,
View,
ViewProps,
} from 'react-native';
import { ActionSheetOptions } from '../types';
import ActionGroup from './ActionGroup';
interface State {
isVisible: boolean;
isAnimating: boolean;
options: ActionSheetOptions | null;
onSelect: ((i: number) => void) | null;
overlayOpacity: any;
sheetOpacity: any;
}
interface Props {
readonly useNativeDriver: boolean | undefined;
readonly pointerEvents?: ViewProps['pointerEvents'];
}
const OPACITY_ANIMATION_IN_TIME = 225;
const OPACITY_ANIMATION_OUT_TIME = 195;
const EASING_OUT = Easing.bezier(0.25, 0.46, 0.45, 0.94);
const EASING_IN = Easing.out(EASING_OUT);
const ESCAPE_KEY = 'Escape';
// Has same API as https://facebook.github.io/react-native/docs/actionsheetios.html
export default class ActionSheet extends React.Component<Props, State> {
static defaultProps = {
useNativeDriver: true,
};
_actionSheetHeight = 360;
state: State = {
isVisible: false,
isAnimating: false,
options: null,
onSelect: null,
overlayOpacity: new Animated.Value(0),
sheetOpacity: new Animated.Value(0),
};
_deferAfterAnimation?: () => void = undefined;
componentDidMount() {
if (Platform.OS === 'web') {
document.addEventListener('keydown', this._handleWebKeyDown);
}
}
componentWillUnmount() {
if (Platform.OS === 'web') {
document.removeEventListener('keydown', this._handleWebKeyDown);
}
}
_handleWebKeyDown = (event: KeyboardEvent): void => {
if (event.key === ESCAPE_KEY && this.state.isVisible) {
event.preventDefault();
this._selectCancelButton();
}
};
_setActionSheetHeight = ({ nativeEvent }: any) =>
(this._actionSheetHeight = nativeEvent.layout.height);
render() {
const { isVisible, overlayOpacity, options } = this.state;
const useModal = options ? options.autoFocus || options.useModal === true : false;
const overlay = isVisible ? (
<Animated.View
style={[
styles.overlay,
{
opacity: overlayOpacity,
},
]}
/>
) : null;
// While the sheet is visible, hide the rest of the app's content from screen readers.
const appContent = (
<View
style={styles.flexContainer}
importantForAccessibility={isVisible ? 'no-hide-descendants' : 'auto'}>
{React.Children.only(this.props.children)}
</View>
);
return (
<View pointerEvents={this.props.pointerEvents} style={styles.flexContainer}>
{appContent}
{isVisible && !useModal && (
<>
{overlay}
{this._renderSheet()}
</>
)}
{isVisible && useModal && (
<Modal animationType="none" transparent onRequestClose={this._selectCancelButton}>
{overlay}
{this._renderSheet()}
</Modal>
)}
</View>
);
}
_renderSheet() {
const { options, isAnimating, sheetOpacity } = this.state;
if (!options) {
return null;
}
const {
options: optionsArray,
icons,
tintIcons,
destructiveButtonIndex,
disabledButtonIndices,
destructiveColor,
textStyle,
tintColor,
title,
titleTextStyle,
message,
messageTextStyle,
autoFocus,
showSeparators,
containerStyle,
separatorStyle,
cancelButtonIndex,
cancelButtonTintColor,
} = options;
return (
<TouchableWithoutFeedback importantForAccessibility="yes" onPress={this._selectCancelButton}>
<Animated.View
needsOffscreenAlphaCompositing={isAnimating}
style={[
styles.sheetContainer,
{
opacity: sheetOpacity,
transform: [
{
translateY: sheetOpacity.interpolate({
inputRange: [0, 1],
outputRange: [this._actionSheetHeight, 0],
}),
},
],
},
]}>
<View style={styles.sheet} onLayout={this._setActionSheetHeight}>
<ActionGroup
options={optionsArray}
icons={icons}
tintIcons={tintIcons === undefined ? true : tintIcons}
cancelButtonIndex={cancelButtonIndex}
cancelButtonTintColor={cancelButtonTintColor}
destructiveButtonIndex={destructiveButtonIndex}
destructiveColor={destructiveColor}
disabledButtonIndices={disabledButtonIndices}
onSelect={this._onSelect}
startIndex={0}
length={optionsArray.length}
textStyle={textStyle || {}}
tintColor={tintColor}
title={title || undefined}
titleTextStyle={titleTextStyle}
message={message || undefined}
messageTextStyle={messageTextStyle}
autoFocus={autoFocus}
showSeparators={showSeparators}
containerStyle={containerStyle}
separatorStyle={separatorStyle}
/>
</View>
</Animated.View>
</TouchableWithoutFeedback>
);
}
showActionSheetWithOptions = (options: ActionSheetOptions, onSelect: (i: number) => void) => {
const { isVisible, overlayOpacity, sheetOpacity } = this.state;
if (isVisible) {
this._deferAfterAnimation = this.showActionSheetWithOptions.bind(this, options, onSelect);
return;
}
this.setState({
options,
onSelect,
isVisible: true,
isAnimating: true,
});
overlayOpacity.setValue(0);
sheetOpacity.setValue(0);
Animated.parallel([
Animated.timing(overlayOpacity, {
toValue: 0.32,
easing: EASING_OUT,
duration: OPACITY_ANIMATION_IN_TIME,
useNativeDriver: this.props.useNativeDriver,
}),
Animated.timing(sheetOpacity, {
toValue: 1,
easing: EASING_OUT,
duration: OPACITY_ANIMATION_IN_TIME,
useNativeDriver: this.props.useNativeDriver,
}),
]).start((result) => {
if (result.finished) {
this.setState({
isAnimating: false,
});
this._deferAfterAnimation = undefined;
}
});
// @ts-ignore: Argument of type '"actionSheetHardwareBackPress"' is not assignable to parameter of type '"hardwareBackPress"'
BackHandler.addEventListener('actionSheetHardwareBackPress', this._selectCancelButton);
};
_selectCancelButton = () => {
const { options } = this.state;
if (!options) {
return false;
}
if (typeof options.cancelButtonIndex === 'undefined') {
return false;
} else if (typeof options.cancelButtonIndex === 'number') {
return this._onSelect(options.cancelButtonIndex);
} else {
return this._animateOut();
}
};
_onSelect = (index: number): boolean => {
const { isAnimating, onSelect } = this.state;
if (isAnimating) {
return false;
}
if (onSelect) {
this._deferAfterAnimation = onSelect.bind(this, index);
}
return this._animateOut();
};
_animateOut = (): boolean => {
const { isAnimating, overlayOpacity, sheetOpacity } = this.state;
if (isAnimating) {
return false;
}
// @ts-ignore: Argument of type '"actionSheetHardwareBackPress"' is not assignable to parameter of type '"hardwareBackPress"'
BackHandler.removeEventListener('actionSheetHardwareBackPress', this._selectCancelButton);
this.setState({
isAnimating: true,
});
Animated.parallel([
Animated.timing(overlayOpacity, {
toValue: 0,
easing: EASING_IN,
duration: OPACITY_ANIMATION_OUT_TIME,
useNativeDriver: this.props.useNativeDriver,
}),
Animated.timing(sheetOpacity, {
toValue: 0,
easing: EASING_IN,
duration: OPACITY_ANIMATION_OUT_TIME,
useNativeDriver: this.props.useNativeDriver,
}),
]).start((result) => {
if (result.finished) {
this.setState({
isVisible: false,
isAnimating: false,
});
if (this._deferAfterAnimation) {
this._deferAfterAnimation();
}
}
});
return true;
};
}
const styles = StyleSheet.create({
flexContainer: {
flex: 1,
},
overlay: {
position: 'absolute',
top: 0,
right: 0,
bottom: 0,
left: 0,
backgroundColor: 'black',
},
sheetContainer: {
position: 'absolute',
left: 0,
right: 0,
bottom: 0,
top: 0,
backgroundColor: 'transparent',
alignItems: 'flex-end',
justifyContent: 'center',
flexDirection: 'row',
},
sheet: {
flex: 1,
backgroundColor: 'transparent',
},
});
import CustomActionSheet from './CustomActionSheet';
export default CustomActionSheet;
+39 -26
View File
@@ -1,41 +1,54 @@
import * as React from 'react';
import ActionSheet from './ActionSheet';
// NativeActionSheet will always be custom when on Android/web
import NativeActionSheet from './ActionSheet';
import CustomActionSheet from './ActionSheet/CustomActionSheet';
import { Provider } from './context';
import { ActionSheetOptions, ActionSheetProps } from './types';
import { ActionSheetOptions, ActionSheetProviderRef } from './types';
interface Props {
children: React.ReactNode;
useNativeDriver?: boolean;
useCustomActionSheet?: boolean;
}
export default class ActionSheetProvider extends React.Component<Props> {
_actionSheetRef: React.RefObject<ActionSheet>;
_context: ActionSheetProps;
export default React.forwardRef<ActionSheetProviderRef, Props>(function ActionSheetProvider(
{ children, useNativeDriver, useCustomActionSheet = false },
ref
) {
const actionSheetRef = React.useRef<NativeActionSheet>(null);
constructor(props: Props) {
super(props);
this._actionSheetRef = React.createRef();
this._context = {
const context = React.useMemo(
() => ({
showActionSheetWithOptions: (options: ActionSheetOptions, callback: (i: number) => void) => {
if (this._actionSheetRef.current != null) {
this._actionSheetRef.current.showActionSheetWithOptions(options, callback);
if (actionSheetRef.current) {
actionSheetRef.current.showActionSheetWithOptions(options, callback);
}
},
};
}
}),
[actionSheetRef]
);
getContext(): ActionSheetProps {
return this._context;
}
React.useImperativeHandle(
ref,
() => ({
// backwards compatible with 13.x before context was being passed right on the ref
getContext: () => context,
showActionSheetWithOptions: context.showActionSheetWithOptions,
}),
[context]
);
render() {
return (
<Provider value={this._context}>
<ActionSheet ref={this._actionSheetRef} useNativeDriver={this.props.useNativeDriver}>
{React.Children.only(this.props.children)}
</ActionSheet>
</Provider>
);
}
}
const ActionSheet = React.useMemo(
() => (useCustomActionSheet ? CustomActionSheet : NativeActionSheet),
[useCustomActionSheet]
);
return (
<Provider value={context}>
<ActionSheet ref={actionSheetRef} useNativeDriver={useNativeDriver}>
{React.Children.only(children)}
</ActionSheet>
</Provider>
);
});
+1 -1
View File
@@ -6,7 +6,7 @@ import { ActionSheetProps } from './types';
export default function connectActionSheet<OwnProps = any>(
WrappedComponent: React.ComponentType<OwnProps & ActionSheetProps>
): React.FunctionComponent<OwnProps & ActionSheetProps> {
): React.FunctionComponent<OwnProps> {
const ConnectedActionSheet = (props: OwnProps) => {
return (
<Consumer>
+7
View File
@@ -8,6 +8,13 @@ export interface ActionSheetProps {
) => void;
}
export interface ActionSheetProviderRef extends ActionSheetProps {
/**
* @deprecated Simply call `showActionSheetWithOptions()` directly from the ref now
*/
getContext: () => ActionSheetProps;
}
// for iOS
export interface ActionSheetIOSOptions {
options: string[];
+2021 -3736
View File
File diff suppressed because it is too large. Load diff