Socket
Socket
Sign inDemoInstall

react-native-dropdownalert

Package Overview
Dependencies
0
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-dropdownalert

A dropdown alert that allows you to display bits of information to your user.


Version published
Weekly downloads
7.5K
decreased by-19.29%
Maintainers
1
Install size
27.7 kB
Created
Weekly downloads
 

Readme

Source

react-native-dropdownalert

Platform npm version npm version Build Status License

A way to display bits of information to users. You can try 1 of 3 pre-defined types or roll your own. The user can tap the alert to close it or pan gesture up or close automatically after 4 seconds, see closeInterval prop.

Installation

npm i react-native-dropdownalert --save

Demo

screenshot

Usage


import DropdownAlert from 'react-native-dropdownalert'
// ...
render() {
  return (
    <View>
      // !!! Make sure it's the last component in your document tree.
      <DropdownAlert ref={(ref) => this.dropdown = ref} onClose={(data) => this.onClose(data)} />
    </View>
  )
}
// ...
handleServerResponse(err, response) {
  if (err != null) {
    this.dropdown.alertWithType('error', 'Error', err)
  }
}
// ...
onClose(data) {
  // data = {type, title, message}
}
// ...

Types

| info | warn | error | custom | ------------ | ------------- | ------------ |------------ |------------ | |screenshot |screenshot |screenshot|screenshot

Props

NameTypeDescriptionDefault
closeIntervalNumberdismiss alert at a certain time in milliseconds4000
imageSrcString or Numberlocal or network sourcenull
startDeltaNumberwhere the container starts (changes based on container height onLayout)-100
endDeltaNumberwhere the container ends0
onCloseFunctionFires when alert closes either by user or closeInterval Returns: data = {type, title, message}null
containerStyleView.propTypes.stylestyles for container for custom type only{ padding: 16, flexDirection: 'row' }
titleStyleText.propTypes.stylestyles for title for all types{ fontSize: 16, textAlign: 'left', fontWeight: 'bold', color: 'white', backgroundColor: 'transparent' }
messageStyleText.propTypes.stylestyles for message for all types{ fontSize: 14, textAlign: 'left', fontWeight: 'bold', color: 'white', backgroundColor: 'transparent' }
imageStyleImage.propTypes.stylestyles for image for all types{ padding: 8, width: 36, height: 36, alignSelf: 'center' }
cancelBtnImageStyleImage.propTypes.stylestyles for image for all types{ padding: 8, width: 36, height: 36, alignSelf: 'center' }
cancelBtnImageSrcString or Numberlocal or network sourcerequire('./assets/cancel.png')
titleNumOfLinesNumbernumber of lines1
messageNumOfLinesNumbernumber of lines3
onCancelFunctionCancel button action. Returns: data = {type, title, message}null
showCancelBoolwhether or not to show cancel buttonfalse

Inspired by: RKDropdownAlert

Keywords

FAQs

Last updated on 25 Sep 2016

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc