npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@zwdvidal/react-native-dropdownalert

v3.11.0

Published

A simple alert to notify users about new chat messages, something went wrong or everything is ok.

Downloads

290

Readme

react-native-dropdownalert

Platform npm version npm version Build Status codecov License

screenshot screenshot screenshot screenshot

Table of contents

  1. Support
  2. Installation
  3. Demo
  4. Usage
  5. Props
  6. Caveats

A simple alert to notify users about new chat messages, something went wrong or everything is ok. It can be closed by tap, cancel button, automatically with closeInterval, pan responder up gesture or programmatically.

Support

| react-native version | package version | reason | | ---- | :---: | ---- | | 0.50.0 | >=3.2.0 | Added SafeAreaView (iPhone X) | | 0.44.0 | >=2.12.0 | Added ViewPropTypes |

Installation

npm i react-native-dropdownalert --save

Demo

screenshot

Usage

// ...
import DropdownAlert from 'react-native-dropdownalert';
export default class App extends Component {
  componentDidMount() {
    this.fetchData();
  }
  fetchData = async () => {
    try {
      await fetch('https://mywebsite.com/endpoint/');
    } catch (error) {
      this.dropdown.alertWithType('error', 'Error', error.message);
    }
  };
  render() {
    return (
      <View>
         // !!! Make sure it is the last component in your document tree.
        <DropdownAlert ref={ref => this.dropdown = ref} />
      </View>
    );
  }
}

Caveats

Props

| Name | Type | Description | Default | | ---- | :---: | --- | --- | | closeInterval | Number | dismiss alert at a certain time in milliseconds | 4000 | imageSrc | String or Number | local or network source for custom alert type | null | infoImageSrc | String or Number | local or network source for info alert type | require('./assets/info.png') | warnImageSrc | String or Number | local or network source for warn alert type | require('./assets/warn.png') | errorImageSrc | String or Number | local or network source for error alert type | require('./assets/error.png') | successImageSrc | String or Number | local or network source for success alert type | require('./assets/success.png') | startDelta | Number | where the container starts (changes based on container height onLayout) | -100 | endDelta | Number | where the container ends | 0 | onClose | Function | Invoked when alert is closed Returns: data = {type, title, message, action} | null | cancelBtnImageSrc | String or Number | local or network source | require('./assets/cancel.png') | | titleNumOfLines | Number | number of lines | 1 | messageNumOfLines | Number | number of lines | 3 | onCancel | Function | Cancel button action. Returns: data = {type, title, message, action} | null | showCancel | Bool | whether or not to show cancel button | false | tapToCloseEnabled | Bool | enable/disable close with tap | true | panResponderEnabled | Bool | enable/disable close with pan responder | true | replaceEnabled | Bool | enables the alert to either state change without dismissal or go to next alert with dismissal | true | translucent | Bool | StatusBar prop | false | useNativeDriver | Bool | enable/disable native driver for animations. For android platform, in some older React Native versions, enable useNativeDriver can cause some problems. See #65 | true (iOS) / false (Android) | updateStatusBar | Bool | whether or not to update status bar styles | true | activeStatusBarStyle | String | StatusBar barStyle when alert is open | light-content | activeStatusBarBackgroundColor | String | StatusBar backgroundColor when alert is open | It takes on the backgroundColor of alert if predefined else default or provided prop | inactiveStatusBarStyle | String | StatusBar barStyle when alert dismisses | StatusBar._defaultProps.barStyle.value | inactiveStatusBarBackgroundColor | String | StatusBar backgroundColor when alert dismisses | StatusBar._defaultProps.backgroundColor.value | wrapperStyle | Object | styles for the view that wraps the container. For React Native Web support you might want to set this to { position: 'fixed' } | null | containerStyle | Object | styles for container for custom type only | { padding: 16, flexDirection: 'row' } | zIndex | Number | zIndex attribute on outermost container | null | titleStyle | Object | styles for title for all types | { fontSize: 16, textAlign: 'left', fontWeight: 'bold', color: 'white', backgroundColor: 'transparent' } | messageStyle | Object | styles for message for all types | { fontSize: 14, textAlign: 'left', fontWeight: 'bold', color: 'white', backgroundColor: 'transparent' } | imageStyle | Object | styles for image for all types | { padding: 8, width: 36, height: 36, alignSelf: 'center' } | cancelBtnImageStyle | Object | styles for image for all types | { padding: 8, width: 36, height: 36, alignSelf: 'center' } | successColor | String | Default background color of success message | #32A54A | infoColor | String | Default background color of info message | #2B73B6 | warnColor | String | Default background color of warn message | #cd853f | errorColor | String | Default background color of error message | #cc3232 | elevation | Number | Animated.View elevation | 1 | sensitivity | Number | Sensitivity for the pan responder up gesture | 20 | defaultContainer | Object | Style for inner view container (override paddingTop with this) | { padding: 8, paddingTop: IS_ANDROID ? 0 : 20, flexDirection: 'row' } | defaultTextContainer | Object | Style for inner text container (holds title and message) | { flex: 1, padding: 8 } | renderImage | Function | Use to override the left image component | undefined | renderCancel | Function | Use to override the cancel button component | undefined | renderTitle | Function | Use to override the title component | undefined | renderMessage | Function | Use to override the message component | undefined | testID | String | Top level TouchableOpacity's testID | undefined | accessibilityLabel | String | Top level TouchableOpacity's accessibilityLabel | undefined | accessible | Boolean | Top level TouchableOpacity's accessible | false | titleTextProps | Object | title text props. does not override numOfLines (use titleNumOfLines) | undefined | messageTextProps | Object | message text props. does not override numOfLines (use messageNumOfLines) | undefined

Inspired by: RKDropdownAlert