A simple and fully customizable React Native component that implements a popup UI.
A simple and fully customizable React Native component that implements a popup UI.
| Example One | Example Two | Example Three |
| :-----------------------------------------------------------: | :-----------------------------------------------------------: | :-----------------------------------------------------------: |
| examples/App.js |
examples/App.js |
examples/App.js |
| Example One | Example Two | Example Three |
| :-----------------------------------------------------------: | :-----------------------------------------------------------: | :-----------------------------------------------------------: |
| examples/App.js |
examples/App.js |
examples/App.js |
If using yarn:
yarn add popup-ui
If using npm:
npm i popup-ui
import { View, TouchableOpacity, Text } from 'react-native' import { Root, Popup } from 'popup-ui'
Simply declare the method in your event
Popup.show({...})in its component.
Popup.show({ type: 'Success', title: 'Upload complete', button: false, textBody: 'Congrats! Your upload successfully done', buttonText: 'Ok', callback: () => Popup.hide() }) } > Open Popup
You can also use the
Toastcomponent.
// Is necessary make the import to Toast (import { Root, Toast } from 'popup-ui') Toast.show({ title: 'User created', text: 'Your user was successfully created, use the app now.', color: '#2ecc71' }) } > Call Toast
Popup contains a type-customization scheme
Typeprops.
Example success usage:
Popup.show({ type: 'Success' })
Example warning usage:
Popup.show({ type: 'Warning' })
Example error usage:
Popup.show({ type: 'Danger' })
Popup contains a customization in
Backgroundprops.
Example usage:
Popup.show({ background: 'red' })
Popup contains a callback function in button popup
Callbackprops.
Example usage:
Popup.show({ callback: Popup.hide() })
| Name | Description | Default | Type | | ---------- | ----------------------------------------------- | ------------------ | ----------- | | title | Sets the main popup title | Upload complete | String | | type | Defines the type (Success, Warning or Error) | Success | String | | textBody | Defines the text body of popup | | String | | button | Whether or not to display the | true | Bool | | buttonText | Defines the text button of popup | Ok | String | | callback | Defines the function of button | Alert() | Func | | background | Sets the backgroundColor | rgba(0, 0, 0, 0.5) | String | | timing | Sets the time for the popup to close by itself | 5000 | Number | | autoclose | sets whether the popup will close automatically | false | Bool | | icon | use costum icon | false | Component |
| Name | Description | Default | Type | | ---------- | ----------------------------------------------- | ------------------ | --------- | | title | Sets the main toast title | | String | | text | Defines the text to toast | | String | | color | Defines the color to title, border and iconC | #e1e1e1 | String | | timing | Define your timing to close toast | 6s | Int | | icon | Choose your the best icon to toast | | Component |
Pull requests are always welcome! Feel free to open a new GitHub issue for any changes that can be made.
Rafael Augusto | https://linkedin.com/in/rafaelaugustos/