0.1.8 • Published 7 years ago

react-native-alerts v0.1.8

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

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

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-alerts and add RNAlerts.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNAlerts.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<

Android

  1. 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 the getPackages() method
  1. 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')
  2. 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)

NameTypeDescription
titlestringTitle of alert
messagestringMessage of alert
buttonstringAlert 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)

NameTypeDescription
titlestringTitle of alert
messagestringMessage of alert
acceptstringAlert button accept text
cancelstringAlert 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

7 years ago

0.1.7

7 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago