@qiqi715/react-native-alert

Alert with styles that can be used on both android and iOS.

Usage no npm install needed!

<script type="module">
  import qiqi715ReactNativeAlert from 'https://cdn.skypack.dev/@qiqi715/react-native-alert';
</script>

README

React Native Alert

Demo

alt text alt text

Getting Started

Installation

$ npm i @qiqi715/react-native-alert --save

Basic Usage

RNAlert.alert(
  'Alert Title',
  'My Alert Msg',
  [
    {
      text: 'Ask me later',
      onPress: () => console.log('Ask me later pressed'),
    },

    {
      text: 'Cancel',
      onPress: () => console.log('Cancel Pressed'),
    },
    {
      text: 'OK',
      onPress: () => console.log('OK Pressed'),
    },
  ],
);

Methods

alert()

static alert(title: string, [message]: string, buttonsArray)
Prop Type Description Default
title string Title text to display -
message string Message text to display -
buttonsArray array an array of buttons, each button should include a text key, as well as optional onPress and style keys []

buttonsArray's each button

Prop Type Description Default
text string text of button -
onPress func Action to perform when button is pressed -
style object button style -

MIT Licensed

Released under the Mit License