New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@grovertb/react-native-actionsheet

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@grovertb/react-native-actionsheet

Cross platform ActionSheet. This component implements a custom ActionSheet and provides the same way to drawing it on the defferent platforms(iOS and Android). Actually, In order to keep the best effect, it still uses the ActionSheetIOS on iOS.

  • 2.4.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11
decreased by-54.17%
Maintainers
1
Weekly downloads
 
Created
Source

@grovertb/react-native-actionsheet

  • [ FIX ] react-native-actionsheet

Cross platform ActionSheet. This component implements a custom ActionSheet and provides the same way to drawing it on the defferent platforms(iOS and Android). Actually, In order to keep the best effect, it still uses the ActionSheetIOS on iOS.

Install

npm install @grovertb/react-native-actionsheet --save

Usage

import ActionSheet from '@grovertb/react-native-actionsheet'

const Demo = () => {
  const actionSheetRef = React.useRef();
  
  const _handleShowActionSheet = () => {
    actionSheetRef.current.show()
  }

  return (
    <View>
      <Text onPress={_handleShowActionSheet}>Open ActionSheet</Text>
      <ActionSheet
        ref={actionSheetRef}
        title={'Which one do you like ?'}
        options={['Apple', 'Banana', 'cancel']}
        cancelButtonIndex={2}
        destructiveButtonIndex={1}
        onPress={(index) => { /* do something */ }}
      />
    </View>
  )
}

Use ActionSheetCustom directly

so you can customize option and title

import { ActionSheetCustom as ActionSheet } from '@grovertb/react-native-actionsheet'

const options = [
  'Cancel', 
  'Apple', 
  <Text style={{color: 'yellow'}}>Banana</Text>,
  'Watermelon', 
  <Text style={{color: 'red'}}>Durian</Text>
]

const Demo = () => {
  const actionSheetRef = React.useRef();
  
  const _handleShowActionSheet = () => {
    actionSheetRef.current.show()
  }

  return (
    <View>
      <Text onPress={_handleShowActionSheet}>Open ActionSheet</Text>
      <ActionSheet
        ref={actionSheetRef}
        title={<Text style={{color: '#000', fontSize: 18}}>Which one do you like?</Text>}
        options={options}
        cancelButtonIndex={0}
        destructiveButtonIndex={4}
        onPress={(index) => { /* do something */ }}
      />
    </View>
  )
}

How to redesign style ?

The style of ActionSheet is defined in lib/styles.js. We can pass the styles prop to cover default style. See Example .

// example

const styles = {
  titleBox: {
    background: 'pink'
  },
  titleText: {
    fontSize: 16,
    color: '#000'
  }
}

<ActionSheet
  ...
  styles={styles}
/>

Props

Prop nameDescriptionTypeDefault
titlePropTypes.string or PropTypes.element
messagePropTypes.string or PropTypes.element
optionsPropTypes.arrayOf([PropTypes.string, PropTypes.element])
tintColorPropTypes.string
cancelButtonIndexPropTypes.number
destructiveButtonIndexPropTypes.number
onPressPropTypes.func(index) => {}
stylesonly for ActionSheetCustom{}

Keywords

FAQs

Package last updated on 12 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc