Coder Social home page Coder Social logo

zengo-x / react-native-dropdownalert Goto Github PK

View Code? Open in Web Editor NEW

This project forked from testshallpass/react-native-dropdownalert

1.0 2.0 0.0 29.84 MB

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

License: MIT License

JavaScript 90.21% Python 2.40% Java 1.97% Objective-C 5.42%

react-native-dropdownalert's Introduction

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 (this.dropDownAlertRef.closeAction()).

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/');
      // alertWithType parameters: type, title, message, payload, interval.
      // There are 4 pre-defined types: info, warn, success, error.
      // payload object with source property overrides image source prop. (optional)
      // interval overrides closeInterval prop. (optional)
      this.dropDownAlertRef.alertWithType('success', 'Success', 'Fetch data is complete.');
    } catch (error) {
      this.dropDownAlertRef.alertWithType('error', 'Error', error.message);
    }
  };
  render() {
    // Make sure DropdownAlert is the last component in the document tree.
    return (
      <View>
        <DropdownAlert ref={ref => this.dropDownAlertRef = ref} />
      </View>
    );
  }
}

Caveats

Inspired by: RKDropdownAlert

react-native-dropdownalert's People

Contributors

testshallpass avatar gutteapps avatar lucianomlima avatar xcarpentier avatar kirillpisarev avatar trymbill avatar ivpusic avatar slorber avatar kevinresol avatar aqos156 avatar mehdihz avatar eymaddis avatar boazarad88 avatar gbrlcustodio avatar maxeh avatar piropa avatar sahanatroam avatar gitter-badger avatar ma96o avatar ngandhy avatar

Stargazers

Gábor Mihálcz avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.