# @zzzkk2009/react-native-popup

> popup for react-native

Latest version **0.1.1** (published 2017-04-10) · ISC license · 0 weekly downloads

## Install

```sh
npm install @zzzkk2009/react-native-popup
pnpm add @zzzkk2009/react-native-popup
yarn add @zzzkk2009/react-native-popup
bun add @zzzkk2009/react-native-popup
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2017-04-10 |
| First published | 2017-03-04 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | zachary |
| Maintainers | zzzkk2009 |
| Keywords | react-native, popup |

## Links

- npm: https://www.npmjs.com/package/@zzzkk2009/react-native-popup
- Repository: https://github.com/zzzkk2009/react-native-popup
- Homepage: https://github.com/zachary/react-native-popup#readme
- Issues: https://github.com/zachary/react-native-popup/issues
- npm.io page: https://npm.io/package/@zzzkk2009/react-native-popup

## Alternatives

- [react-native-root-siblings](https://npm.io/package/react-native-root-siblings.md) — 102.9K weekly downloads
- [@praxisui/dialog](https://npm.io/package/@praxisui/dialog.md) — 2.0K weekly downloads
- [easy-toggle-state](https://npm.io/package/easy-toggle-state.md) — 350 weekly downloads
- [ngx-lightbox-evp](https://npm.io/package/ngx-lightbox-evp.md) — 19 weekly downloads
- [react-native-modal-translucent-axton](https://npm.io/package/react-native-modal-translucent-axton.md) — 4 weekly downloads

## Recent versions

- 0.1.1 (latest) — 2017-04-10
- 0.1.0 — 2017-03-06
- 0.0.1 — 2017-03-04

## README

# react-native-popup  
[![npm version](https://img.shields.io/npm/v/@zzzkk2009/react-native-popup.svg?style=flat-square)](https://www.npmjs.com/package/@zzzkk2009/react-native-popup)  

This is a custom component for React Native, a simple popup, compatible with ios and android.

###Demo
![ui](./doc/ui.gif)

### Methods
- <b>alert</b>(<b>`message`</b>: *string*|*number*, [...]) 
```javascript
	e.g.

		Popup.alert(1);

		Popup.alert(1, 'two', '10 messages at most');
```
- <b>tip</b>({ <b>`title`</b>: *string*, <b>`content`</b>: *string*|*number*|*array*<*string*|*number*> *`isRequired`*, <b>`btn`</b>: {<b>`title`</b>: *string* <b>*`default 'OK'`*</b>, <b>`callback`</b>: *function*}, }) 
```javascript
	e.g.

		Popup.tip({
			content: 'come on!',
		});

		Popup.tip({
			title: 'TipTip',
			content: 'come on!',
		});

		Popup.tip({
			content: ['come on!', 'go!'],
			btn: {
				text: 'OKOK',
				style: {
					color: 'red'
				},
				callback: () => {
					this.popup.alert('over!');
				},
			},
		});
```
- <b>confirm</b>({ <b>`title`</b>: *string*, <b>`content`</b>: *string*|*number*|*array*<*string*|*number*> *`isRequired`*, <b>`ok`</b>: {<b>`title`</b>: *string* *`default 'OK'`*, <b>`callback`</b>: *function*}, <b>`cancel`</b>: {<b>`title`</b>: *string* *`default 'Cancel'`*, <b>`callback`</b>: *function*}, }) 
```javascript
	e.g.

		Popup.confirm({
			content: 'Are you ready?',
		});

		Popup.confirm({
			content: 'Are you ready?',
			ok: {
				callback: () => {
					this.popup.alert('Very good!');
				},
			},
		});

		Popup.confirm({
			title: 'title',
			content: ['come on!', 'go!'],
			ok: {
				text: 'Y',
				style: {
					color: 'red'
				},
				callback: () => {
					this.popup.alert('Good!');
				},
			},
			cancel: {
				text: 'N',
				style: {
					color: 'blue'
				},
				callback: () => {
					this.popup.alert('Hurry up！');
				},
			},
		});
```

###Usage
####Step 1 - install

```
	npm install @zzzkk2009/react-native-popup --save
```

####Step 2 - import and use in project

```javascript
import Popup from '@zzzkk2009/react-native-popup';

class App extends React.Component{

	onPressHandle() {
		// alert
		Popup.alert(1);
	},

	render() {
		return (
			<View style={styles.container}>

				<Text style={styles.btn} onPress={this.onPressHandle.bind(this)}>click me !</Text>

			</View>
		);
	},
	
};
```

---
_Source: https://npm.io/package/@zzzkk2009/react-native-popup · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
