mirror of
https://github.com/expo/react-native-action-sheet.git
synced 2026-11-14 19:11:42 -10:00
Compare commits
15
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
64b8529472 | ||
|
|
a918aec770 | ||
|
|
93bc73bf22 | ||
|
|
d2d0843790 | ||
|
|
929a1dbc54 | ||
|
|
0468951ed4 | ||
|
|
c73938f4de | ||
|
|
aec473fb02 | ||
|
|
21d10edbd0 | ||
|
|
ecb6b23caa | ||
|
|
2f9346bcd7 | ||
|
|
b35a403a21 | ||
|
|
3b698da831 | ||
|
|
c583287d00 | ||
|
|
b2f5f433ff |
No files matched your search
+18
-10
@@ -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
|
||||
@@ -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.release_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 }}
|
||||
@@ -1,5 +1,12 @@
|
||||
# Changelog
|
||||
|
||||
## [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)
|
||||
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ import { useActionSheet } from '@expo/react-native-action-sheet';
|
||||
export default Menu() {
|
||||
const { showActionSheetWithOptions } = useActionSheet();
|
||||
|
||||
const onPress() => {
|
||||
const onPress = () => {
|
||||
const options = ['Delete', 'Save', 'Cancel'];
|
||||
const destructiveButtonIndex = 0;
|
||||
const cancelButtonIndex = 2;
|
||||
|
||||
@@ -14,17 +14,17 @@
|
||||
"dependencies": {
|
||||
"@expo/react-native-action-sheet": "../src",
|
||||
"@expo/vector-icons": "^13.0.0",
|
||||
"expo": "^46.0.0",
|
||||
"expo": "^48.0.0",
|
||||
"hoist-non-react-statics": "^3.3.0",
|
||||
"react": "18.0.0",
|
||||
"react-dom": "18.0.0",
|
||||
"react-native": "0.69.6",
|
||||
"react-native-web": "~0.18.7"
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
"react-native": "0.71.3",
|
||||
"react-native-web": "~0.18.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "~18.0.0",
|
||||
"@types/react-native": "~0.69.1",
|
||||
"babel-preset-expo": "~9.2.0",
|
||||
"typescript": "^4.6.3"
|
||||
"@types/react": "~18.2.0",
|
||||
"@types/react-native": "~0.71.3",
|
||||
"babel-preset-expo": "^9.3.0",
|
||||
"typescript": "^4.9.4"
|
||||
}
|
||||
}
|
||||
+1787
-1304
File diff suppressed because it is too large.
Load diff
+1
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@expo/react-native-action-sheet",
|
||||
"version": "4.0.0",
|
||||
"version": "4.0.1",
|
||||
"description": "A cross-platform ActionSheet for React Native",
|
||||
"react-native": "lib/module/index.js",
|
||||
"types": "lib/typescript/index.d.ts",
|
||||
@@ -45,7 +45,6 @@
|
||||
"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",
|
||||
"typescript": "^3.5.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@@ -4,7 +4,7 @@ import * as React from 'react';
|
||||
import NativeActionSheet from './ActionSheet';
|
||||
import CustomActionSheet from './ActionSheet/CustomActionSheet';
|
||||
import { Provider } from './context';
|
||||
import { ActionSheetOptions } from './types';
|
||||
import { ActionSheetOptions, ActionSheetProviderRef } from './types';
|
||||
|
||||
interface Props {
|
||||
children: React.ReactNode;
|
||||
@@ -12,11 +12,10 @@ interface Props {
|
||||
useCustomActionSheet?: boolean;
|
||||
}
|
||||
|
||||
export default function ActionSheetProvider({
|
||||
children,
|
||||
useNativeDriver,
|
||||
useCustomActionSheet = false,
|
||||
}: Props) {
|
||||
export default React.forwardRef<ActionSheetProviderRef, Props>(function ActionSheetProvider(
|
||||
{ children, useNativeDriver, useCustomActionSheet = false },
|
||||
ref
|
||||
) {
|
||||
const actionSheetRef = React.useRef<NativeActionSheet>(null);
|
||||
|
||||
const context = React.useMemo(
|
||||
@@ -30,6 +29,16 @@ export default function ActionSheetProvider({
|
||||
[actionSheetRef]
|
||||
);
|
||||
|
||||
React.useImperativeHandle(
|
||||
ref,
|
||||
() => ({
|
||||
// backwards compatible with 13.x before context was being passed right on the ref
|
||||
getContext: () => context,
|
||||
showActionSheetWithOptions: context.showActionSheetWithOptions,
|
||||
}),
|
||||
[context]
|
||||
);
|
||||
|
||||
const ActionSheet = React.useMemo(
|
||||
() => (useCustomActionSheet ? CustomActionSheet : NativeActionSheet),
|
||||
[useCustomActionSheet]
|
||||
@@ -42,4 +51,4 @@ export default function ActionSheetProvider({
|
||||
</ActionSheet>
|
||||
</Provider>
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -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[];
|
||||
|
||||
Reference in new issue
Block a user