mirror of
https://github.com/expo/react-native-action-sheet.git
synced 2026-11-15 17:39:01 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1df8d22613 | ||
|
|
2dcd54c56f | ||
|
|
6244df4549 | ||
|
|
f46a5cfc47 | ||
|
|
9c6f5be31d | ||
|
|
0147d326f9 | ||
|
|
47a1711c3c | ||
|
|
758050480d | ||
|
|
e4f4246880 | ||
|
|
da6105e8a0 | ||
|
|
3822febbf8 | ||
|
|
8999650323 | ||
|
|
6e22c372d3 | ||
|
|
02b2db8947 | ||
|
|
880fe21224 | ||
|
|
df363ead72 | ||
|
|
9ea2d088e6 | ||
|
|
0f534dc1f5 | ||
|
|
55005ba0fb | ||
|
|
bd0c001215 | ||
|
|
c4c3f8b873 | ||
|
|
1fb3411f57 |
No files matched your search
@@ -0,0 +1,22 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
cache: 'yarn'
|
||||
- run: yarn install
|
||||
- run: npm run type-check
|
||||
- run: npm run lint-check
|
||||
@@ -0,0 +1,23 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v2
|
||||
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
|
||||
+28
-1
@@ -1,5 +1,32 @@
|
||||
# Changelog
|
||||
|
||||
# [3.14.0](https://github.com/expo/react-native-action-sheet/compare/v3.13.1...v3.14.0) (2022-10-03)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* support cancelButtonTintColor ([#278](https://github.com/expo/react-native-action-sheet/issues/278)) ([2dcd54c](https://github.com/expo/react-native-action-sheet/commit/2dcd54c56f35a64c66f8d9a7d09a9475801cf037))
|
||||
|
||||
## [3.13.1](https://github.com/expo/react-native-action-sheet/compare/v3.13.0...v3.13.1) (2022-10-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add return type to connectActionSheet ([#273](https://github.com/expo/react-native-action-sheet/issues/273)) ([f46a5cf](https://github.com/expo/react-native-action-sheet/commit/f46a5cfc473807478c558a733c8adb1440941017))
|
||||
|
||||
# [3.13.0](https://github.com/expo/react-native-action-sheet/compare/v3.12.0...v3.13.0) (2022-01-10)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* defer calling onSelect until after animation ([#248](https://github.com/expo/react-native-action-sheet/issues/248)) ([1fb3411](https://github.com/expo/react-native-action-sheet/commit/1fb3411f575b4fa1cb762a804fc38cf3e2a5c73b)), closes [#203](https://github.com/expo/react-native-action-sheet/issues/203)
|
||||
* stabilize the identity of the context provider value ([#251](https://github.com/expo/react-native-action-sheet/issues/251)) ([55005ba](https://github.com/expo/react-native-action-sheet/commit/55005ba0fb4bc6aff546390cf324619bf2e0ed2a))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* support closing actionsheet with Esc key on web ([#247](https://github.com/expo/react-native-action-sheet/issues/247)) ([c4c3f8b](https://github.com/expo/react-native-action-sheet/commit/c4c3f8b873d76ff40daf8d2061d9f43346a3577f)), closes [#194](https://github.com/expo/react-native-action-sheet/issues/194)
|
||||
|
||||
# [3.12.0](https://github.com/expo/react-native-action-sheet/compare/v3.11.0...v3.12.0) (2021-10-14)
|
||||
|
||||
|
||||
@@ -10,7 +37,7 @@
|
||||
|
||||
### Features
|
||||
|
||||
* adds support for disabledButtonIndicies ([#246](https://github.com/expo/react-native-action-sheet/issues/246)) ([feed1f7](https://github.com/expo/react-native-action-sheet/commit/feed1f78b4c85855d48c1742fe9f8a67c0604609)), closes [#224](https://github.com/expo/react-native-action-sheet/issues/224)
|
||||
* adds support for disabledButtonIndices ([#246](https://github.com/expo/react-native-action-sheet/issues/246)) ([feed1f7](https://github.com/expo/react-native-action-sheet/commit/feed1f78b4c85855d48c1742fe9f8a67c0604609)), closes [#224](https://github.com/expo/react-native-action-sheet/issues/224)
|
||||
|
||||
# [3.11.0](https://github.com/expo/react-native-action-sheet/compare/v3.10.0...v3.11.0) (2021-09-07)
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ 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: `disabledButtonIndicies` is only available for iOS in Expo 43+ or RN 0.64.0+.
|
||||
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+.
|
||||
|
||||
### iOS Only Props
|
||||
|
||||
|
||||
+45
-4
@@ -12,6 +12,7 @@ import {
|
||||
ScrollView,
|
||||
SafeAreaView,
|
||||
TouchableOpacity,
|
||||
Share,
|
||||
} from 'react-native';
|
||||
|
||||
import ShowActionSheetButton from './ShowActionSheetButton';
|
||||
@@ -19,7 +20,7 @@ import ShowActionSheetButton from './ShowActionSheetButton';
|
||||
type Props = ActionSheetProps;
|
||||
|
||||
interface State {
|
||||
selectedIndex: number | null;
|
||||
selectedIndex?: number | null;
|
||||
isModalOpen: boolean;
|
||||
}
|
||||
|
||||
@@ -29,7 +30,7 @@ class App extends React.Component<Props, State> {
|
||||
isModalOpen: false,
|
||||
};
|
||||
|
||||
_updateSelectionText = (selectedIndex: number) => {
|
||||
_updateSelectionText = (selectedIndex?: number) => {
|
||||
this.setState({
|
||||
selectedIndex,
|
||||
});
|
||||
@@ -38,7 +39,9 @@ class App extends React.Component<Props, State> {
|
||||
_renderSelectionText = () => {
|
||||
const { selectedIndex } = this.state;
|
||||
const text =
|
||||
selectedIndex === null ? 'No Option Selected' : `Option #${selectedIndex + 1} Selected`;
|
||||
selectedIndex === null || selectedIndex === undefined
|
||||
? 'No Option Selected'
|
||||
: `Option #${selectedIndex + 1} Selected`;
|
||||
return <Text style={styles.selectionText}>{text}</Text>;
|
||||
};
|
||||
|
||||
@@ -50,6 +53,23 @@ class App extends React.Component<Props, State> {
|
||||
this.setState((prevState) => ({ isModalOpen: !prevState.isModalOpen }));
|
||||
};
|
||||
|
||||
async _onShare() {
|
||||
try {
|
||||
const result = await Share.share({
|
||||
message: 'React Native | A framework for building native apps using React',
|
||||
});
|
||||
if (result.action === Share.sharedAction) {
|
||||
if (result.activityType) {
|
||||
// shared with activity type of result.activityType
|
||||
} else {
|
||||
// shared
|
||||
}
|
||||
} else if (result.action === Share.dismissedAction) {
|
||||
// dismissed
|
||||
}
|
||||
} catch (error) {}
|
||||
}
|
||||
|
||||
_renderButtons() {
|
||||
const { showActionSheetWithOptions } = this.props;
|
||||
return (
|
||||
@@ -76,6 +96,12 @@ class App extends React.Component<Props, State> {
|
||||
onSelection={this._updateSelectionText}
|
||||
showActionSheetWithOptions={showActionSheetWithOptions}
|
||||
/>
|
||||
<ShowActionSheetButton
|
||||
title="Cancel Button Tint Color"
|
||||
withCancelButtonTintColor
|
||||
onSelection={this._updateSelectionText}
|
||||
showActionSheetWithOptions={showActionSheetWithOptions}
|
||||
/>
|
||||
<ShowActionSheetButton
|
||||
title="iPad Anchor"
|
||||
withAnchor
|
||||
@@ -86,7 +112,7 @@ class App extends React.Component<Props, State> {
|
||||
<ShowActionSheetButton
|
||||
title="Nested Action Sheets"
|
||||
onSelection={(index) => {
|
||||
if (index < 3) {
|
||||
if (!index || index < 3) {
|
||||
showActionSheetWithOptions(
|
||||
{
|
||||
title: 'Sub Action Sheet',
|
||||
@@ -99,6 +125,21 @@ class App extends React.Component<Props, State> {
|
||||
}}
|
||||
showActionSheetWithOptions={showActionSheetWithOptions}
|
||||
/>
|
||||
<ShowActionSheetButton
|
||||
title="Share Menu"
|
||||
showActionSheetWithOptions={() =>
|
||||
showActionSheetWithOptions(
|
||||
{
|
||||
title: 'Share Menu',
|
||||
options: ['Share', 'Cancel'],
|
||||
cancelButtonIndex: 1,
|
||||
},
|
||||
(i) => {
|
||||
i === 0 && this._onShare();
|
||||
}
|
||||
)
|
||||
}
|
||||
/>
|
||||
{this._renderSectionHeader('Android-Only Options')}
|
||||
<ShowActionSheetButton
|
||||
title="Icons"
|
||||
|
||||
@@ -11,14 +11,15 @@ interface Props {
|
||||
title: string;
|
||||
showActionSheetWithOptions: (
|
||||
options: ActionSheetOptions,
|
||||
callback: (buttonIndex: number) => void
|
||||
callback: (buttonIndex?: number) => void
|
||||
) => void;
|
||||
onSelection: (index: number) => void;
|
||||
onSelection: (index?: number) => void;
|
||||
withTitle?: boolean;
|
||||
withMessage?: boolean;
|
||||
withIcons?: boolean;
|
||||
withSeparators?: boolean;
|
||||
withCustomStyles?: boolean;
|
||||
withCancelButtonTintColor?: boolean;
|
||||
withAnchor?: boolean;
|
||||
useModal?: boolean;
|
||||
}
|
||||
@@ -32,6 +33,7 @@ export default class ShowActionSheetButton extends React.PureComponent<Props> {
|
||||
withSeparators: false,
|
||||
withCustomStyles: false,
|
||||
withAnchor: false,
|
||||
withCancelButtonTintColor: false,
|
||||
onSelection: null,
|
||||
useModal: false,
|
||||
};
|
||||
@@ -46,13 +48,14 @@ export default class ShowActionSheetButton extends React.PureComponent<Props> {
|
||||
withIcons,
|
||||
withSeparators,
|
||||
withCustomStyles,
|
||||
withCancelButtonTintColor,
|
||||
onSelection,
|
||||
showActionSheetWithOptions,
|
||||
useModal,
|
||||
} = this.props;
|
||||
|
||||
// Same interface as https://facebook.github.io/react-native/docs/actionsheetios.html
|
||||
const options = ['Delete', 'Disabled', 'Save', 'Share', 'Cancel'];
|
||||
const options = ['Delete', 'Disabled', 'Save', 'Cancel'];
|
||||
const icons = withIcons
|
||||
? [icon('delete'), icon('save'), icon('share'), icon('cancel')]
|
||||
: undefined;
|
||||
@@ -62,7 +65,7 @@ export default class ShowActionSheetButton extends React.PureComponent<Props> {
|
||||
: undefined;
|
||||
const destructiveButtonIndex = 0;
|
||||
const disabledButtonIndices = [1];
|
||||
const cancelButtonIndex = 4;
|
||||
const cancelButtonIndex = 3;
|
||||
const textStyle: TextStyle | undefined = withCustomStyles
|
||||
? {
|
||||
fontSize: 20,
|
||||
@@ -98,6 +101,7 @@ export default class ShowActionSheetButton extends React.PureComponent<Props> {
|
||||
{
|
||||
options,
|
||||
cancelButtonIndex,
|
||||
cancelButtonTintColor: withCancelButtonTintColor ? '#D93F0B' : undefined,
|
||||
destructiveButtonIndex,
|
||||
disabledButtonIndices,
|
||||
title,
|
||||
@@ -120,7 +124,7 @@ export default class ShowActionSheetButton extends React.PureComponent<Props> {
|
||||
// Android only,
|
||||
useModal,
|
||||
},
|
||||
(buttonIndex: number) => {
|
||||
(buttonIndex?: number) => {
|
||||
// Do something here depending on the button index selected
|
||||
onSelection(buttonIndex);
|
||||
}
|
||||
|
||||
+10
-10
@@ -13,18 +13,18 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@expo/react-native-action-sheet": "../src",
|
||||
"@expo/vector-icons": "^12.0.0",
|
||||
"expo": "^43.0.0-beta.3",
|
||||
"@expo/vector-icons": "^13.0.0",
|
||||
"expo": "^46.0.0",
|
||||
"hoist-non-react-statics": "^3.3.0",
|
||||
"react": "17.0.1",
|
||||
"react-dom": "17.0.1",
|
||||
"react-native": "0.64.2",
|
||||
"react-native-web": "0.17.1"
|
||||
"react": "18.0.0",
|
||||
"react-dom": "18.0.0",
|
||||
"react-native": "0.69.6",
|
||||
"react-native-web": "~0.18.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "~17.0.21",
|
||||
"@types/react-native": "~0.64.12",
|
||||
"babel-preset-expo": "8.5.1",
|
||||
"typescript": "~4.3.5"
|
||||
"@types/react": "~18.0.0",
|
||||
"@types/react-native": "~0.69.1",
|
||||
"babel-preset-expo": "~9.2.0",
|
||||
"typescript": "^4.6.3"
|
||||
}
|
||||
}
|
||||
+2820
-1149
File diff suppressed because it is too large.
Load diff
+3
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@expo/react-native-action-sheet",
|
||||
"version": "3.12.0",
|
||||
"version": "3.14.0",
|
||||
"description": "A cross-platform ActionSheet for React Native",
|
||||
"react-native": "lib/module/index.js",
|
||||
"types": "lib/typescript/index.d.ts",
|
||||
@@ -14,6 +14,7 @@
|
||||
"build": "bob build",
|
||||
"type-check": "tsc --noEmit",
|
||||
"lint": "eslint . --fix",
|
||||
"lint-check": "eslint",
|
||||
"semantic-release": "semantic-release"
|
||||
},
|
||||
"repository": {
|
||||
@@ -44,7 +45,7 @@
|
||||
"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": "^17.4.4",
|
||||
"semantic-release": "^19.0.3",
|
||||
"typescript": "^3.5.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@@ -119,6 +119,8 @@ export default class ActionGroup extends React.Component<Props> {
|
||||
const {
|
||||
options,
|
||||
icons,
|
||||
cancelButtonIndex,
|
||||
cancelButtonTintColor,
|
||||
destructiveButtonIndex,
|
||||
disabledButtonIndices,
|
||||
destructiveColor = DESTRUCTIVE_COLOR,
|
||||
@@ -141,7 +143,12 @@ export default class ActionGroup extends React.Component<Props> {
|
||||
? tintColor
|
||||
: (textStyle || {}).color || BLACK_87PC_TRANSPARENT;
|
||||
const disabled = isIndexDisabled(i, disabledButtonIndices);
|
||||
const color = isIndexDestructive(i, destructiveButtonIndex) ? destructiveColor : defaultColor;
|
||||
const isCancelButton = i === cancelButtonIndex;
|
||||
const color = isIndexDestructive(i, destructiveButtonIndex)
|
||||
? destructiveColor
|
||||
: isCancelButton
|
||||
? cancelButtonTintColor || defaultColor
|
||||
: defaultColor;
|
||||
const iconSource = icons != null ? icons[i] : null;
|
||||
|
||||
optionViews.push(
|
||||
|
||||
@@ -21,13 +21,20 @@ export default class ActionSheet extends React.Component<Props> {
|
||||
|
||||
showActionSheetWithOptions(dataOptions: ActionSheetIOSOptions, onSelect: onSelect) {
|
||||
// ...dataOptions include other keys which use in android and web, thats why `Android-Only options` Crash on IOS
|
||||
const { cancelButtonIndex, destructiveButtonIndex, options, tintColor, disabledButtonIndices } =
|
||||
dataOptions;
|
||||
const {
|
||||
cancelButtonIndex,
|
||||
destructiveButtonIndex,
|
||||
options,
|
||||
tintColor,
|
||||
cancelButtonTintColor,
|
||||
disabledButtonIndices,
|
||||
} = dataOptions;
|
||||
const iosOptions: ActionSheetIOSOptions = {
|
||||
cancelButtonIndex,
|
||||
destructiveButtonIndex,
|
||||
options,
|
||||
tintColor,
|
||||
cancelButtonTintColor,
|
||||
disabledButtonIndices,
|
||||
// A null title or message on iOS causes a crash
|
||||
title: dataOptions.title || undefined,
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
BackHandler,
|
||||
Easing,
|
||||
Modal,
|
||||
Platform,
|
||||
StyleSheet,
|
||||
TouchableWithoutFeedback,
|
||||
View,
|
||||
@@ -31,6 +32,7 @@ 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> {
|
||||
@@ -49,7 +51,26 @@ export default class ActionSheet extends React.Component<Props, State> {
|
||||
sheetOpacity: new Animated.Value(0),
|
||||
};
|
||||
|
||||
_deferNextShow?: () => void = undefined;
|
||||
_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);
|
||||
@@ -120,6 +141,8 @@ export default class ActionSheet extends React.Component<Props, State> {
|
||||
showSeparators,
|
||||
containerStyle,
|
||||
separatorStyle,
|
||||
cancelButtonIndex,
|
||||
cancelButtonTintColor,
|
||||
} = options;
|
||||
return (
|
||||
<TouchableWithoutFeedback importantForAccessibility="yes" onPress={this._selectCancelButton}>
|
||||
@@ -144,6 +167,8 @@ export default class ActionSheet extends React.Component<Props, State> {
|
||||
options={optionsArray}
|
||||
icons={icons}
|
||||
tintIcons={tintIcons === undefined ? true : tintIcons}
|
||||
cancelButtonIndex={cancelButtonIndex}
|
||||
cancelButtonTintColor={cancelButtonTintColor}
|
||||
destructiveButtonIndex={destructiveButtonIndex}
|
||||
destructiveColor={destructiveColor}
|
||||
disabledButtonIndices={disabledButtonIndices}
|
||||
@@ -171,7 +196,7 @@ export default class ActionSheet extends React.Component<Props, State> {
|
||||
const { isVisible, overlayOpacity, sheetOpacity } = this.state;
|
||||
|
||||
if (isVisible) {
|
||||
this._deferNextShow = this.showActionSheetWithOptions.bind(this, options, onSelect);
|
||||
this._deferAfterAnimation = this.showActionSheetWithOptions.bind(this, options, onSelect);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -201,7 +226,7 @@ export default class ActionSheet extends React.Component<Props, State> {
|
||||
this.setState({
|
||||
isAnimating: false,
|
||||
});
|
||||
this._deferNextShow = undefined;
|
||||
this._deferAfterAnimation = undefined;
|
||||
}
|
||||
});
|
||||
// @ts-ignore: Argument of type '"actionSheetHardwareBackPress"' is not assignable to parameter of type '"hardwareBackPress"'
|
||||
@@ -231,7 +256,10 @@ export default class ActionSheet extends React.Component<Props, State> {
|
||||
return false;
|
||||
}
|
||||
|
||||
onSelect && onSelect(index);
|
||||
if (onSelect) {
|
||||
this._deferAfterAnimation = onSelect.bind(this, index);
|
||||
}
|
||||
|
||||
return this._animateOut();
|
||||
};
|
||||
|
||||
@@ -267,8 +295,8 @@ export default class ActionSheet extends React.Component<Props, State> {
|
||||
isAnimating: false,
|
||||
});
|
||||
|
||||
if (this._deferNextShow) {
|
||||
this._deferNextShow();
|
||||
if (this._deferAfterAnimation) {
|
||||
this._deferAfterAnimation();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as React from 'react';
|
||||
|
||||
import ActionSheet from './ActionSheet';
|
||||
import { Provider } from './context';
|
||||
import { ActionSheetOptions } from './types';
|
||||
import { ActionSheetOptions, ActionSheetProps } from './types';
|
||||
|
||||
interface Props {
|
||||
children: React.ReactNode;
|
||||
@@ -11,24 +11,27 @@ interface Props {
|
||||
|
||||
export default class ActionSheetProvider extends React.Component<Props> {
|
||||
_actionSheetRef: React.RefObject<ActionSheet>;
|
||||
_context: ActionSheetProps;
|
||||
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
this._actionSheetRef = React.createRef();
|
||||
}
|
||||
|
||||
getContext = () => {
|
||||
return {
|
||||
this._context = {
|
||||
showActionSheetWithOptions: (options: ActionSheetOptions, callback: (i: number) => void) => {
|
||||
this._actionSheetRef.current !== null &&
|
||||
if (this._actionSheetRef.current != null) {
|
||||
this._actionSheetRef.current.showActionSheetWithOptions(options, callback);
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
getContext(): ActionSheetProps {
|
||||
return this._context;
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Provider value={this.getContext()}>
|
||||
<Provider value={this._context}>
|
||||
<ActionSheet ref={this._actionSheetRef} useNativeDriver={this.props.useNativeDriver}>
|
||||
{React.Children.only(this.props.children)}
|
||||
</ActionSheet>
|
||||
|
||||
@@ -6,7 +6,7 @@ import { ActionSheetProps } from './types';
|
||||
|
||||
export default function connectActionSheet<OwnProps = any>(
|
||||
WrappedComponent: React.ComponentType<OwnProps & ActionSheetProps>
|
||||
) {
|
||||
): React.FunctionComponent<OwnProps & ActionSheetProps> {
|
||||
const ConnectedActionSheet = (props: OwnProps) => {
|
||||
return (
|
||||
<Consumer>
|
||||
|
||||
@@ -15,6 +15,7 @@ export interface ActionSheetIOSOptions {
|
||||
message?: string;
|
||||
tintColor?: string;
|
||||
cancelButtonIndex?: number;
|
||||
cancelButtonTintColor?: string;
|
||||
destructiveButtonIndex?: number | number[];
|
||||
anchor?: number;
|
||||
userInterfaceStyle?: 'light' | 'dark';
|
||||
|
||||
+3
-2
@@ -5,9 +5,10 @@
|
||||
"module": "commonjs",
|
||||
"strict": true,
|
||||
"moduleResolution": "node",
|
||||
"lib": ["es2015", "es2016", "esnext"],
|
||||
"lib": ["dom", "es2015", "es2016", "esnext"],
|
||||
"jsx": "react-native",
|
||||
"esModuleInterop": true
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
Reference in new issue
Block a user