1.0.4 • Published 3 years ago

react-native-alert-dialogues v1.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

react-native-alert-dialogues

A simple and fully customisable React Native component that shows success,error,warning and confirmation alerts.

npm.io

Features

  • Easy to use
  • Consistent look and feel on iOS and Android
  • Can show success alert dialogues
  • Can show error alert dialogues
  • Can show warning alert dialogues
  • Can show confirmation alert dialogues
  • Customisable UI

Installation

npm install --save react-native-alert-dialogues
OR
yarn add npm i react-native-alert-dialogues

Usage

Just put the Alert tag before the last closing tag of the component
import React, { Component } from 'react';
import {View} from 'react-native';
import {Alert} from 'react-native-alert-dialogues';

class Example extends Component {
  render() {
    return (
      <View>
      <Alert
          visible={this.state.showAlert}
          type= "success"
          okPressed={() =>
            this.setState({
              showAlert: false,
            })
          }
          message= "Message to show."
        />
        </View>
    );
  }
}

Common properties

namedescriptiontypeValues
typeType of alert to showString'error','success','confirm,'warning'
visibleVisible state of the alertBooleantrue or false
titleTitle of alertStringAny String Value
messageMessage of alertStringAny String Value
opacityBackground opacity of dialogueNumberbetween 0.0 - 1.0
buttonTitleTitle of button in alertStringAny String Value
okTitleTitle of +ve buttonStringAny String Value
cancelTitleTitle of cancel buttonStringAny String Value
iconImageCustome image source for iconImage SoucrceAny String Value
hideIconHide the icon in alertBooleantrue or false
buttonColorButton Color of the dialogueStringAny Color Value

Callbacks

namedescriptiontypeValues
okPressedCallback function on ok pressfunctionfunction
confirmedCallback function on confirm press (confirmation alert)functionfunction
cancelledCallback function on cancel press (confirmation alert)functionfunction

Example

git clone https://github.com/Ali-Haider-Ch/react-native-alert-dialogues
cd react-native-alert-dialogues/examples
npm install
npm run ios # or npm run android

Copyright and License

MIT License

Copyright 2020-2022 Ali Hayder. All rights reserved.