0.1.8 • Published 9 years ago
react-native-alerts v0.1.8
react-native-alerts
Comming soon (This is in development)
Getting started
$ npm install react-native-alerts --save
Mostly automatic installation
$ react-native link react-native-alerts
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries➜Add Files to [your project's name] - Go to
node_modules➜react-native-alertsand addRNAlerts.xcodeproj - In XCode, in the project navigator, select your project. Add
libRNAlerts.ato your project'sBuild Phases➜Link Binary With Libraries - Run your project (
Cmd+R)<
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNAlertsPackage;to the imports at the top of the file - Add
new RNAlertsPackage()to the list returned by thegetPackages()method
- Append the following lines to
android/settings.gradle:include ':react-native-alerts' project(':react-native-alerts').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-alerts/android') - Insert the following lines inside the dependencies block in
android/app/build.gradle:compile project(':react-native-alerts')
Usage
After install the library, you can import it to use.
import Alerts from 'react-native-alerts';Methods
Alert
Open single alert. (All parameters are optionals)
| Name | Type | Description |
|---|---|---|
| title | string | Title of alert |
| message | string | Message of alert |
| button | string | Alert button text |
Alerts.alert({
title: 'Title',
message: 'This is a message',
button: 'Sure!'
}, () => {
//Event fired when user click on button
});
Alerts;Confirm
Open single confirm alert. (All parameters are optionals)
| Name | Type | Description |
|---|---|---|
| title | string | Title of alert |
| message | string | Message of alert |
| accept | string | Alert button accept text |
| cancel | string | Alert button cancel text |
Alerts.confirm({
title: 'Title',
message: 'Are you sure?',
accept: 'YES',
cancel: 'NO'
}, (res) => {
// res: return true if accept button is preset, else return false
});0.1.8
9 years ago
0.1.7
9 years ago
0.1.6
9 years ago
0.1.5
9 years ago
0.1.4
9 years ago
0.1.3
9 years ago
0.1.2
9 years ago
0.1.1
9 years ago
0.1.0
9 years ago
0.0.9
9 years ago
0.0.8
9 years ago
0.0.7
9 years ago
0.0.6
9 years ago
0.0.5
9 years ago
0.0.4
9 years ago
0.0.3
9 years ago
0.0.2
9 years ago
0.0.1
9 years ago
1.0.3
9 years ago
1.0.2
9 years ago
1.0.1
9 years ago
1.0.0
9 years ago