react-native-dialogbox
This is a custom component for React Native, a simple popup, compatible with ios and android.
This is a forked distro of react-native-popup that adds support for the current versions of react-native, and adds additional features (style overrides, promise support). The originating distro can be found here
Demo
Props
- isOverlay bool -
default true
- isOverlayClickClose bool -
default true
- onDismiss function() -
optional callback called when overlay dismisses dialogbox
- style object -
optional override for system styles
Methods
- alert(
message
: string|number, [...]) : Promise
eg thisdialogbox; thisdialogbox; thisdialogbox;
- tip({
title
: string,content
: string|number|array<string|number>isRequired
,btn
: {title
: stringdefault 'OK'
,style
: object,callback
: function}, }) : Promise
eg thisdialogbox; thisdialogbox; thisdialogbox; thisdialogbox; thisdialogbox;
- confirm({
title
: string,content
: string|number|array<string|number>isRequired
,buttonFlow
: 'auto' | 'row' | 'column'default 'auto'
,ok
: {title
: stringdefault 'OK'
,style
: object,callback
: function},cancel
: {title
: stringdefault 'Cancel'
,style
: object,callback
: function}, }) : Promise
eg thisdialogbox; thisdialogbox; thisdialogbox; thisdialogbox;
- pop({
title
: string,content
: string|number|array<string|number>isRequired
,buttonFlow
: 'auto' | 'row' | 'column'default 'auto'
,btns
: [{title
: stringdefault 'OK'
,style
: object,callback
: function}] }) : Promise
eg thisdialogbox; thisdialogbox; thisdialogbox;
Usage
Step 1 - install
npm install react-native-dialogbox --save
Step 2 - import and use in project
;;; { // alert thisdialogbox; } { return <View style=stylescontainer> <Text style=stylesbtn onPress=thishandleOnPress>click me !</Text> /** dialogbox component */ <DialogBox ref= { thisdialogbox = dialogbox }/> </View> ; } ;