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

react-native-modal-bottom-alert

v1.1.3

Published

Modal Bottom Alert for React Native Android, and IOS

Downloads

11

Readme

react-native-modal-bottom-alert

alt text

Getting Started

Installation

$ yarn add react-native-modal-bottom-alert lottie-react-native

Or

$ npm install react-native-modal-bottom-alert lottie-react-native --save

Basic Usage

import { BottomAlert } from 'react-native-modal-bottom-alert';

onOpenAlert() {
    this.modalBottom.onOpenAlert('info', 'This Title', 'This Message Example Info')
}

onOpenAlertButtonPressed() {
    // onOpenAlert parameters: type, title, message, function
    // parameter type: 'success', 'info', 'error'
    // parameter title: 'string'
    // parameter message: 'string'
    // parameter action: function, default null'
    this.modalBottom.onOpenAlert('error', 'This Title', 'This Message Example Error', () => console.log('This Button Try Again Pressed'))
}

return (
    <>
        <Button
          title={'Open Alert'}
          onPress={() => this.onOpenAlert()}
        />
        <Button
          title={'Open Alert Button Preesed With Action'}
          onPress={() => this.onOpenAlertButtonPressed()}
        />
        <BottomAlert
            ref={(ref) => this.modalBottom = ref}
        />
    </>
)

Set Global Alert

1. Add Modal Bottom Alert on Root App

// Root.js
import store from './reduxStore';
import React from 'react';
import { Provider } from 'react-redux';
import { useRefBottomAlert, BottomAlert } from 'react-native-modal-bottom-alert'; // Add This For Set Alert

let App = () => (
  <Navigator>
    <MainScreen />
    <OtherScreen />
  </Navigator>
);

const Root = () => (
  <Provider store={store}>
    <App />
    {/* Add This on root app */}
    <BottomAlert ref={(ref) => useRefBottomAlert(ref) }/> 
  </Provider>
);

2. Add on your screen or other function

// Screen.js
import React, { Component } from 'react';
import { StyleSheet, Text, View, Button } from 'react-native';
import { showBottomAlert } from 'react-native-modal-bottom-alert'; // Add This On Your Screen For Call Alert

export default class App extends Component {

  onOpenAlert() {
    showBottomAlert('info', 'This Title', 'This Message Example Info', () => this.onDonePress())
  }

  onDonePress = () => {
    console.log('Pressed')
  }


  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>Modal Bottom Alert example</Text>
        <Button
          title={'Info'}
          onPress={() => this.onOpenAlert()}
        />
        <Button
          title={'Error'}
          onPress={() => showBottomAlert('error', 'This Title', 'This Message Example Error')}
        />
        <Button
          title={'Success'}
          onPress={() => showBottomAlert('success', 'This Title', 'This Message Example Success')}
        />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'space-around',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  }
});

Props

Basic

| Prop | Type | Description | Default | | :----------------------- | :-------: | :--------------------------------------------: | :------ | | statusBarTranslucent | boolean | Status Bar Translucent | false | | loopAnimation | boolean | Animation Loop For Lottie Icon | false |

Styling

| Prop | Type | Description | Default | | :--------------------- | :------: | :--------------------------: | :------ | | styleTextTitle | object | Text Title Style | - | | styleTextMessage | object | Text Message Style | - | | styleTextButton | object | Text Button Style | - | | styleButton | object | Button Style | - | | styleContainerAlert | object | Container Style Alert | - |