CommonDialog
This is a combination of the pop-up box confirmation react-native components for Android and Ios,you can customize the style and parameters for the component
react-native-dialogs-master
- A react-native picker/selector component for both Android & iOS.
Features
- Pure JS.
- Pop up box and confirm the box together .
- Custom pop-up box
- Compatible with both iOS and Android.
- Highly customizable.(You can change the style you want)
- Controllable with API by code. (show/hide/valueChange)
- Flexible change of content
Installation
- npm i react-native-dialogs-master --save
Usage
Import this module:
;
code
;;; ; { superprops; } { var options= thide:true innersWidth:300 innersHeight:150 buttons: txt:'知道了' thisrefsdAlert } { var options= thide:true /*不显示头部标题*/ messText:'投资前需开通第三方存管账户' buttons: txt:'取消' txt:'确定' thisrefsdConfirm } { var options= title:'购买' /*不显示头部标题*/ headStyle:backgroundColor:'#ff6600'color:'#ffffff'fontSize:24 messText:'投资前需开通第三方存管账户' buttons: txt:'暂不投资' btnStyle:backgroundColor:'transparent' txtStyle:color:'#ff6600' onpress:thiscancels txt:'立即投资' btnStyle:backgroundColor:'#ff6600' txtStyle:color:'#ffffff' onpress:thiscok thisrefsdcustomConfirm } { } { thisrefsdokAlert } { var options= animationType:'none' title:'自定义组件' clickScreen:false thisrefsdAutofade } { thisrefsdAutofade; } { return <View style=stylescontainer> <TouchableHighlight style=stylescomBtnBtnViewwidth:100 underlayColor='transparent' onPress=thisfunAlert> <Text style=stylescomBtnText>alert</Text> </TouchableHighlight> <TouchableHighlight style=stylescomBtnBtnViewwidth:100 underlayColor='transparent' onPress=thisfunConfirm> <Text style=stylescomBtnText>confirm</Text> </TouchableHighlight> <TouchableHighlight style=stylescomBtnBtnViewwidth:100 underlayColor='transparent' onPress=thisfuncustomConfirm> <Text style=stylescomBtnText>customconfirm</Text> </TouchableHighlight> <TouchableHighlight style=stylescomBtnBtnViewwidth:100 underlayColor='transparent' onPress=thisfunAutofade> <Text style=stylescomBtnText>Autofade</Text> </TouchableHighlight> <CommonDialog types='alert' components=<DefineCon/> ref="dAlert" /> <CommonDialog types='confirm' ref="dConfirm" /> <CommonDialog ref="dokAlert" /> <CommonDialog ref="dcustomConfirm" /> <CommonDialog ref="dAutofade" components=<DefineCon2 onclick=thishides/> /> </View> ; } mixins = TimerMixin; { superprops; thistimer=""; thisstate= times:3 } { thistimer=; } { ; } { return <View style=stylesconMid> <View style=flex:1flexDirection:'column'padding:15alignItems:'center'justifyContent:'center'> <Text style=flex:1color:'#000000'textAlignVertical:'center'>支付成功订单已提交审核!</Text> <Text style=flex:1fontSize:12textAlignVertical:'center'> 即将关闭此窗口(<Text style=color:'#ff0000'>thisstatetimes秒</Text>) </Text> </View> </View> } { superprops; } { return <View style=stylesconMid> <Image source= style=width:32height:32 /> <Text style=stylestmidwidth:120paddingLeft:15>我是自定义内容</Text> </View> }
Demo

Customization options
- 'animateType': Change pop up block display animation ('fade','normal','slide') - The animationType prop controls how the modal animates. - slide: slides in from the bottom -fade: fades into view -none: appears without an animation
- 'thide':(true|false) show or hide header
- 'title': Custom header text
- 'headStyle': Change the style of the dialogs header
- 'innersWidth': Change the width of the dialogs
- 'innersHeight':Change the height of the dialogs
- 'clickScreen': (true|false) Transparent area can click
- 'messText': Prompt text
- 'buttons':Button group object
buttons: txt:'button text' ---string btnStyle:backgroundColor:'transparent' button style---object txtStyle:color:'#ff6600' button text style ---object onpress:thiscancels button click event ---
Props
- 'components': Custom middle context component
Methods
Method | Description |
---|---|
show(options) |
Show dialogs ( use the react-native Modal component to always be at the top) |
hide() |
Hide dialogs |