Update README.md

This commit is contained in:
Vojtech Novak 2017-09-17 19:43:28 +02:00 committed by GitHub
parent 42d681f017
commit ccc45b9381
1 changed files with 13 additions and 4 deletions

View File

@ -12,7 +12,15 @@ Installation
------------ ------------
### Installation using RNPM ### Installation using RNPM
```rnpm install react-native-dialogs``` 1 . `yarn add react-native-dialogs`
or
`npm i react-native-dialogs --save`
2 . `react-native link react-native-dialogs`
In `android/app/build.gradle`, add a dependency to `':react-native-dialogs'` and URL of the Jitpack maven repository (to download the library https://github.com/afollestad/material-dialogs) : In `android/app/build.gradle`, add a dependency to `':react-native-dialogs'` and URL of the Jitpack maven repository (to download the library https://github.com/afollestad/material-dialogs) :
``` ```
@ -71,21 +79,22 @@ Now you're finally ready to start using module in your React Native application.
Usage Usage
----- -----
```javascript ```javascript
var DialogAndroid = require('react-native-dialogs'); import DialogAndroid from 'react-native-dialogs';
var options = { let options = {
title: 'Hello, World!', title: 'Hello, World!',
content: 'I\'m just simple Dialog', content: 'I\'m just simple Dialog',
positiveText: 'OK', positiveText: 'OK',
negativeText: 'Cancel' negativeText: 'Cancel'
}; };
var showDialog = function () { let showDialog = function () {
var dialog = new DialogAndroid(); var dialog = new DialogAndroid();
dialog.set(options); dialog.set(options);
dialog.show(); dialog.show();
} }
``` ```
Creation of a dialog works in 3 steps : Creation of a dialog works in 3 steps :
1. Create a new dialog using `new DialogAndroid()`. 1. Create a new dialog using `new DialogAndroid()`.
2. Set some options using `dialog.set(options)`. `set` can be called multiple times, and options from multiple calls will be merged. 2. Set some options using `dialog.set(options)`. `set` can be called multiple times, and options from multiple calls will be merged.