All Projects β†’ heyman333 β†’ react-native-awesome-alert

heyman333 / react-native-awesome-alert

Licence: MIT License
πŸ”” Customizable modal components with βœ”οΈcheck options in React Native

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to react-native-awesome-alert

Wc Messagebox
基于 Vue 2.0 εΌ€ε‘ηš„ Alert, Toast, Confirm 插仢, UIδ»Ώη…§ iOS εŽŸη”Ÿ
Stars: ✭ 203 (+306%)
Mutual labels:  alert, modal
react-st-modal
Simple and flexible modal dialog component for React JS
Stars: ✭ 41 (-18%)
Mutual labels:  alert, modal
Jspanel4
A JavaScript library to create highly configurable floating panels, modals, tooltips, hints/notifiers/alerts or contextmenus for use in backend solutions and other web applications.
Stars: ✭ 217 (+334%)
Mutual labels:  alert, modal
Bdialog
Extend the Bootstrap Modal features, making dialog more functions and easier to use, dialog type including modal, alert, mask and toast types
Stars: ✭ 174 (+248%)
Mutual labels:  alert, modal
JHTAlertController
A custom iOS alert that replaces the stock UIAlertController. Easily style the alert to match your app. Written in Swift for iOS.
Stars: ✭ 58 (+16%)
Mutual labels:  alert, modal
React Popup
React popup component
Stars: ✭ 198 (+296%)
Mutual labels:  alert, modal
Nativepopup
Clone of Apple iOS App's feedback popup, and easily customizable.
Stars: ✭ 247 (+394%)
Mutual labels:  alert, modal
Ng Popups
πŸŽ‰ Alert, confirm and prompt dialogs for Angular. Simple as that.
Stars: ✭ 80 (+60%)
Mutual labels:  alert, modal
react-redux-modal-flex
[DEPRECATED] Make easy a modal/popup with Redux
Stars: ✭ 14 (-72%)
Mutual labels:  alert, modal
eins-modal
Simple to use modal / alert / dialog / popup. Created with pure JS. No javascript knowledge required! Works on every browser and device! IE9
Stars: ✭ 30 (-40%)
Mutual labels:  alert, modal
Alertifyjs
A javascript framework for developing pretty browser dialogs and notifications.
Stars: ✭ 1,922 (+3744%)
Mutual labels:  alert, modal
svelte-accessible-dialog
An accessible dialog component for Svelte apps
Stars: ✭ 24 (-52%)
Mutual labels:  alert, modal
Customalertviewdialogue
Custom AlertView Dialogue is the world's most advanced alert view library. Custom AlertView Dialogue includes simple message popups, confirmation alerts, selector popups, action sheet bottom menus, and input/feedback contact forms.
Stars: ✭ 100 (+100%)
Mutual labels:  alert, modal
Pmalertcontroller
PMAlertController is a great and customizable alert that can substitute UIAlertController
Stars: ✭ 2,397 (+4694%)
Mutual labels:  alert, modal
Jbox
jBox is a jQuery plugin that makes it easy to create customizable tooltips, modal windows, image galleries and more.
Stars: ✭ 1,251 (+2402%)
Mutual labels:  alert, modal
Presentr
iOS let's you modally present any view controller, but if you want the presented view controller to not cover the whole screen or modify anything about its presentation or transition you have to use the Custom View Controller Presentation API's.
Stars: ✭ 2,816 (+5532%)
Mutual labels:  alert, modal
Jalert
jQuery alert/modal/lightbox plugin
Stars: ✭ 73 (+46%)
Mutual labels:  alert, modal
Smalltalk
Promise-based Alert, Confirm and Prompt replacement
Stars: ✭ 76 (+52%)
Mutual labels:  alert, modal
MultiModal
Use multiple .sheet, .alert, etc. modifiers in the same SwiftUI View
Stars: ✭ 49 (-2%)
Mutual labels:  alert, modal
react-native-popup
React Native Animated Popup Modal
Stars: ✭ 19 (-62%)
Mutual labels:  alert, modal

NOTICE

This package was created just when I started react-native. And I thought I had to fix a lot of this package, and I decided to put a new named module in npm and create a new repository.

Please check the repo below

Thank you 🀟

πŸ”œ react-native-hide-modal

react-native-awesome-alert

PRs Welcome License MIT License MIT

This package offers customizable modal components with βœ”οΈcheck options in React Native

INSTALLATION

npm

Run npm install react-native-awesome-alert --save

yarn

Run yarn add react-native-awesome-alert

DEMO

  • Works well on both iOS and Android
  • Fully customizable style (example below)

    Image

API

Props

The props for react-native-awesome-alert share similarities with react-native-check-box (author : crazycodeboy)

Prop Type Default Description
styles object AwesomeAlert.style.js please refer to STYLING section 😁
modalProps object original react-native Modal Props. please refer to offcial Document
leftCheck bool true set where the checkbox will be located. default is left
checkedImage element Default image Custom checked Image
unCheckedImage element Default image Custom unchecked Image
checkBoxColor string black Tint color of the checkbox image

Methods

  • alert(title, messageView, buttons)
Arguments type default optional
title string none false
messageView element none false
buttons array none false
  • neverAskAlert(title, messagesView, buttons, checkText = " ")
Arguments type default optional
title string none false
messageView element none false
buttons array none false
checkText string " " true
  • randomAskAlert(title, messagesView, buttons, checkText = " ", invisibleTime)
Arguments type default optional
title string none false
messageView element none false
buttons array none false
checkText string " " true
invisibleTime number(minute) none false

HOW TO USE

import CheckAlert from "react-native-awesome-alert"

const NeverAskView = (
  <View style={styles.sampleView}>
    <Text style={styles.sampleViewText}>This is "Do not ask again" checkable alert</Text>
  </View>
)

...

export default class App extends Component {

  onPressSimpleAlert = () => {
    this.checkAlert.alert("Hello!!", SimpleView, [
      { text: "OK", onPress: () => console.log("OK touch") },
      { text: "Cancel", onPress: () => console.log("Cancel touch") }
    ])
  }

  onPresshNeverAskAlert = () => {
    this.checkAlert.neverAskAlert(
      "Hello CheckAlert",
      NeverAskView,
      [
        { text: "OK", onPress: () => console.log("OK touch"), id: "helloAlert" },
        { text: "Cancel", onPress: () => console.log("Cancel touch") }
      ],
      "Do not ask again"
    )
  }

  onPresshNot24HAlert = () => {
    this.checkAlert.randomAskAlert(
      "Hello CheckAlert",
      RandomAskView,
      [
        { text: "OK", onPress: () => console.log("OK touch"), id: "helloAlert2" },
        { text: "Cancel", onPress: () => console.log("Cancel touch") }
      ],
      "Do not ask for 3 minutes",
      3
    )
  }

  render() {
    return (
      <View style={styles.container}>
        <CheckAlert
          styles={{
            modalContainer: { backgroundColor: "rgba(49,49,49,0.8)" },
            checkBox: { padding: 10 },
            modalView: { marginBottom: 10, borderRadius: 0 }
          }}
          ref={ref => (this.checkAlert = ref)}
          // available Modal's props options: https://facebook.github.io/react-native/docs/modal.html
          modalProps={{
            transparent: true,
            animationType: "slide",
            onShow: () => alert("onShow!")
          }}
          checkBoxColor="red"
        />
        <TouchableOpacity style={styles.touchButton} onPress={this.onPressSimpleAlert}>
          <Text style={styles.toucaButtonTxt}>simple Alert</Text>
        </TouchableOpacity>
        <TouchableOpacity
          style={styles.touchButton}
          onPress={this.onPresshNeverAskAlert}
        >
          <Text style={styles.toucaButtonTxt}>neverAsk Alert</Text>
        </TouchableOpacity>
        <TouchableOpacity style={styles.touchButton} onPress={this.onPresshNot24HAlert}>
          <Text style={styles.toucaButtonTxt}>randomAsk Alert</Text>
        </TouchableOpacity>
      </View>
    )
  }
}

The method is similar to React Native's Alert, however be careful when passing the button's id. The id is used like a primary Key in a local DB, and will cause a warning if the id is not passed properly.

STYLING

export default {
  modalContainer: {
    flex: 1,
    backgroundColor: 'rgba(49,49,49, 0.7)',
    justifyContent: 'center',
    alignItems: 'center',
  },
  modalView: {
    backgroundColor: '#rgb(235,233,227)',
    borderRadius: 15,
    width: 275,
    borderColor: 'black',
    borderWidth: StyleSheet.hairlineWidth,
  },
  checkBox: {
    marginBottom: 10,
  },
  checkBoxText: {
    marginLeft: 4,
    alignSelf: 'center',
    fontSize: 15,
    justifyContent: 'center',
  },
  titleText: {
    fontSize: 17,
    fontWeight: '600',
    padding: 15,
    alignSelf: 'center',
  },
  buttonContainer: {
    flexDirection: 'row',
    justifyContent: 'flex-end',
    borderColor: 'gray',
    borderTopWidth: StyleSheet.hairlineWidth,
  },
  buttonText: {
    fontSize: 17,
  },
  button: {
    justifyContent: 'center',
    alignItems: 'center',
    padding: 15,
    borderColor: 'gray',
  },
}

The above keys are used for styling the entire view. You just pass the object value like this

<AwesomeAlert
  styles={{
    modalContainer: { backgroundColor: 'rgba(49,49,49,0.8)' },
    checkBox: { padding: 10 },
    modalView: { marginBottom: 10, borderRadius: 0 },
  }}
/>

WHAT YOU NEED TO KNOW

  • If the alert is set to not be visible again, the action of the button with the ID is executed.
  • The checkbox is activated only when the button with the ID is pressed.

CONTRIBUTING

The PR of talented developers is always welcome and appreciated

including .md file😁

AUTHOR

ROADMAP

  • define index.d.ts file for typescript
  • optimize logic
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].