react-native-actionsheet-helper
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

React Native ActionSheet Helper

Calling the official React Native ActionSheetIOS or universal ActionSheet @expo/@expo/react-native-action-sheet with simple signature.

Typescript Enabled!

Install

npm i react-native-actionsheet-helper --save

or

yarn add react-native-actionsheet-helper

Usage

Create your options like:

import { createActionSheetOptions } from 'react-native-actionsheet-helper';

const params = createActionSheetOptions({
  title: 'Action Sheet',
  description: 'easy to use',
  buttons: {
    Button1: () => {
      console.log('button 1 clicked');
    },
    Button2: () => {
      console.log('button 2 clicked');
    },
  },
  cancelButton: true,
  destructiveButtonLabel: 'Button2',
});

Use it like:

ActionSheetIOS.showActionSheetWithOptions(...params);

Button1 and Button2 will be rendered as label for that button on ActionSheet.

For handling CancelButton

  • Default cancelButton: cancelButton: true, text with Cancel and close the action sheet
  • Do not want cancelButton: cancelButton: false,
  • Want default cancelButton with different label: cancelButton: 'Close'
  • Want to customize cancelButton: cancelButton: {text: 'Close', callback: ()=>{}}

Readme

Keywords

none

Package Sidebar

Install

npm i react-native-actionsheet-helper

Weekly Downloads

1

Version

0.1.3

License

MIT

Unpacked Size

19.6 kB

Total Files

17

Last publish

Collaborators

  • albertgao