Skip to content

Commit 97849a9

Browse files
committed
update react native logos and update readme minor edits and layout
1 parent 793a0d1 commit 97849a9

File tree

3 files changed

+26
-22
lines changed

3 files changed

+26
-22
lines changed

Example/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, {Component} from 'react';
22
import {StyleSheet, SafeAreaView, Text, View} from 'react-native';
3-
import DropdownAlert from './src/DropdownAlert';
3+
import DropdownAlert from 'react-native-dropdownalert';
44
import {PURPLE_COLOR, WHITE_COLOR, ITEMS, ReactNativeLogo} from './constants';
55
import List from './List';
66
const InfoIcon = require('./assets/info.png');

README.md

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
# react-native-dropdownalert
22

3-
[![Platform](https://img.shields.io/badge/platform-react--native-lightgrey.svg)](http://facebook.github.io/react-native/)
3+
[![Platform](https://img.shields.io/badge/platform-react--native-lightgrey.svg)](https://reactnative.dev)
44
[![npm version](http://img.shields.io/npm/v/react-native-dropdownalert.svg)](https://www.npmjs.com/package/react-native-dropdownalert)
55
[![npm version](http://img.shields.io/npm/dm/react-native-dropdownalert.svg)](https://www.npmjs.com/package/react-native-dropdownalert)
66
[![Build Status](https://travis-ci.org/testshallpass/react-native-dropdownalert.svg?branch=master)](https://travis-ci.org/testshallpass/react-native-dropdownalert)
77
[![codecov](https://codecov.io/gh/testshallpass/react-native-dropdownalert/branch/master/graph/badge.svg)](https://codecov.io/gh/testshallpass/react-native-dropdownalert)
88
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.github.com/testshallpass/react-native-dropdownalert/master/LICENSE)
99

10-
![screenshot](https://raw.github.com/testshallpass/react-native-dropdownalert/master/screenshots/info.png) ![screenshot](https://raw.github.com/testshallpass/react-native-dropdownalert/master/screenshots/warning.png) ![screenshot](https://raw.github.com/testshallpass/react-native-dropdownalert/master/screenshots/error.png) ![screenshot](https://raw.github.com/testshallpass/react-native-dropdownalert/master/screenshots/success.png)
10+
| info | warn | error | success |
11+
| :----: | :---: | :----: | :----: |
12+
| ![screenshot](https://raw.github.com/testshallpass/react-native-dropdownalert/master/screenshots/info.png) | ![screenshot](https://raw.github.com/testshallpass/react-native-dropdownalert/master/screenshots/warning.png) | ![screenshot](https://raw.github.com/testshallpass/react-native-dropdownalert/master/screenshots/error.png) | ![screenshot](https://raw.github.com/testshallpass/react-native-dropdownalert/master/screenshots/success.png) |
1113

12-
### Table of contents
14+
## Table of contents
1315

1416
1. [Support](#support)
1517
2. [Installation](#installation)
@@ -18,24 +20,25 @@
1820
5. [Props](docs/PROPS.md)
1921
6. [Caveats](#caveats)
2022

21-
A simple alert to notify users about new chat messages, something went wrong or everything is ok. It can be closed by tap, cancel button, automatically with `closeInterval`, pan responder up gesture or programmatically (```this.dropDownAlertRef.closeAction()```).
23+
An alert to notify users about new chat messages, something went wrong or everything is okay. It can be closed by tap, cancel button, automatically with `closeInterval`, pan responder up gesture or programmatically (```this.dropDownAlertRef.closeAction()```).
2224

23-
### Support
25+
## Support
2426

2527
| react-native version | package version | reason |
2628
| ---- | :---: | ---- |
27-
| 0.50.0 | >=3.2.0 | Added SafeAreaView (iPhone X) |
28-
| 0.44.0 | >=2.12.0 | Added ViewPropTypes |
29+
| 0.50.0 | >=3.2.0 | Included SafeAreaView (iPhone X) |
30+
| 0.44.0 | >=2.12.0 | Adopted ViewPropTypes |
2931

30-
### Installation
32+
## Installation
3133

32-
```npm i react-native-dropdownalert --save```
34+
* ```npm i react-native-dropdownalert --save```
35+
* ```yarn add react-native-dropdownalert```
3336

34-
### Demo
37+
## Demo
3538

3639
![screenshot](https://raw.github.com/testshallpass/react-native-dropdownalert/master/screenshots/demo.gif)
3740

38-
### Usage
41+
## Usage
3942

4043
```javascript
4144
import DropdownAlert from 'react-native-dropdownalert';
@@ -45,18 +48,19 @@ export default class App extends Component {
4548
}
4649
_fetchData = async () => {
4750
try {
48-
await fetch('https://mywebsite.com/endpoint/');
4951
// alertWithType parameters: type, title, message, payload, interval.
50-
// There are 4 pre-defined types: info, warn, success, error.
51-
// payload object with source property overrides image source prop. (optional)
52-
// interval overrides closeInterval prop. (optional)
53-
this.dropDownAlertRef.alertWithType('success', 'Success', 'Fetch data is complete.');
52+
// payload object that includes a source property overrides the image source prop. (optional: object)
53+
// interval takes precedence over the closeInterval prop. (optional: number)
54+
this.dropDownAlertRef.alertWithType('info', 'Info', 'Start fetch data.');
55+
await fetch('https://httpbin.org/get');
56+
this.dropDownAlertRef.alertWithType('success', 'Success', 'Finish fetch data');
5457
} catch (error) {
55-
this.dropDownAlertRef.alertWithType('error', 'Error', error.message);
58+
this.dropDownAlertRef.alertWithType('error', 'Error', error);
5659
}
5760
};
5861
render() {
59-
// Make sure DropdownAlert is the last component in the document tree.
62+
// DropdownAlert must be last component in the document tree.
63+
// This ensures that it overlaps other UI components.
6064
return (
6165
<View>
6266
<DropdownAlert ref={ref => this.dropDownAlertRef = ref} />
@@ -66,9 +70,9 @@ export default class App extends Component {
6670
}
6771
```
6872

69-
### Caveats
73+
## Caveats
7074

71-
* Modals can overlap DropdownAlert if it's not inside the modal's document tree.
75+
* Modals can overlap DropdownAlert if it is not inside the modal's document tree.
7276
* It is important you place the `DropdownAlert` **ABOVE** the `StackNavigator`.
7377
* [DropdownHolder example #1](https://gist.github.com/testshallpass/d76c656874e417bef4e0e6a63fc492af)
7478
* [DropdownHolder example #2](https://gist.github.com/testshallpass/6c6c867269348c485a1e0d6ae3f55e90)

docs/PROPS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171

7272
### Image
7373

74-
image sources are overridden if payload parameter has source property. For example,```{ source: 'https://facebook.github.io/react-native/docs/assets/favicon.png' }```
74+
image sources are overridden if payload parameter has source property. For example,```{ source: 'https://reactnative.dev/docs/assets/favicon.png' }```
7575

7676
| Name | Type | Description | Default |
7777
| ---- | :---: | --- | --- |

0 commit comments

Comments
 (0)