react-native-devansh-action-sheet
Version:
Action Sheet/Option Picker for react-native
59 lines (47 loc) • 1.48 kB
Markdown
# react-native-action-sheet
Custom action sheet/option picker for react native
<img src="./assets/1.png" alt="main image">
<img src="./assets/2.png" alt="main image" style={{height:200,width:100}}>
<img src="./assets/3.png" alt="main image" style={{height:600,width:400}}>
# Installation
`npm install --save react-native-devansh-action-sheet`
# Importing
`import React,{useState} from 'react';`
`import ActionSheet from 'react-native-devansh-action-sheet';`
# Example with Hooks
```
const [actionSheetVisibility,setActionSheetVisibility]=useState(false);
<Text onPress={() => setActionSheetVisibility(true)}>
Show Action Sheet
</Text>
<ActionSheet
onClose={() => setActionSheetVisibility(!actionSheetVisibility)} // to close the modal
visibility={actionSheetVisibility}
actionLabel={[
{
id:1,
name:"Option 1"
},
{
id:2,
name:"Option 2",
labelTextStyle: {
fontSize: 30,
},
},
{
id:3,
name:"Option 3",
labelBackground: 'red',
colored: true,
},
{
id:4,
name:"cancel",
colored: true
}
]}
onActionLabelSelected={(val, index) => console.log(val, index)}
heading={"My New Heading"}
/>
```