New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-native-simpledialog-android

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-simpledialog-android

React Native Android module to use Android's AlertDialog - same idea of AlertIOS

  • 1.0.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-28.57%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-simpledialog-android

React Native Android module to use Android's AlertDialog - same idea of AlertIOS

npm version npm downloads npm licence

Installation

npm install react-native-simpledialog-android --save

Add it to your android project

  • In android/settings.gradle
...
include ':RNSimpleAlertDialogModule', ':app'
project(':RNSimpleAlertDialogModule').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-simpledialog-android/android')
  • In android/app/build.gradle
...
dependencies {
    ...
    compile project(':RNSimpleAlertDialogModule')
}
  • Register Module >= 0.17 && <= 0.29(in MainActivity.java)
  • NOTE: >= RN 29 split MainActivity.java into MainActivity.java and MainApplication.java. So make modifications below to MainApplication.java
import com.burnweb.rnsimplealertdialog.RNSimpleAlertDialogPackage;  // <--- import

public class MainApplication extends Application implements ReactApplication {
  ......

  @Override
  protected List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
            new MainReactPackage(),
            new RNSimpleAlertDialogPackage()); // <------ add this line to your MainApplication class
  }

  ......

}

Usage

This module are very similar to AlertIOS native module, and only works with alert method (prompt method aren't implemented yet).

The main difference are in the way that you declare buttons. In Android you can declare up to 3 buttons and in this module you have to declare what type the button is. A button can be SimpleAlert.POSITIVE_BUTTON, SimpleAlert.NEGATIVE_BUTTON or SimpleAlert.NEUTRAL_BUTTON.

Example

var SimpleAlert = require('react-native-simpledialog-android');

function _onPress(event) {
    console.log(event);
};

SimpleAlert.alert(
    'Please read me!',
    'Want a warning alert?', [
      { type: SimpleAlert.POSITIVE_BUTTON, text: 'Yes', onPress: _onPress },
      { type: SimpleAlert.NEGATIVE_BUTTON, text: 'No', onPress: _onPress },
      { type: SimpleAlert.NEUTRAL_BUTTON, text: 'Neutral', onPress: _onPress },
    ]
);

License

MIT

Keywords

FAQs

Package last updated on 09 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc