@@ -4,34 +4,38 @@ import { View, Text, TouchableOpacity, StyleSheet } from 'react-native';
44import PopupDialog , { SlideAnimation , DialogTitle , ScaleAnimation , DialogButton } from 'react-native-popup-dialog' ;
55
66const dialogTitle = props => < DialogTitle { ...props } /> ;
7- class PopupDialogView extends Component {
8- render ( ) {
9- return (
10- < PopupDialog { ...this . props } dialogStyle = { { overflow : 'hidden' } } >
11- { this . props . children }
12- < View style = { { flexDirection : 'row' , position : 'absolute' , bottom : 0 } } >
13- { this . props . cancelBtn && (
14- < TouchableOpacity
15- activeOpacity = { 0.6 }
16- onPress = { this . props . cancelBtn . onPress }
17- style = { [ styles . container , { backgroundColor : this . props . cancelBtn . bgColor } ] } >
18- < Text style = { styles . buttonTitle } > { this . props . cancelBtn . title } </ Text >
19- </ TouchableOpacity >
20- ) }
21- { this . props . confirmBtn && (
22- < TouchableOpacity
23- activeOpacity = { 0.6 }
24- disabled = { this . props . confirmBtn . disabled }
25- onPress = { this . props . confirmBtn . onPress }
26- style = { [ styles . container , { backgroundColor : this . props . confirmBtn . bgColor } ] } >
27- < Text style = { styles . buttonTitle } > { this . props . confirmBtn . title } </ Text >
28- </ TouchableOpacity >
29- ) }
30- </ View >
31- </ PopupDialog >
32- ) ;
33- }
34- }
7+ const Button = props => (
8+ < TouchableOpacity
9+ disabled = { props . disabled || false }
10+ activeOpacity = { 0.6 }
11+ onPress = { props . onPress }
12+ style = { [ styles . container , { backgroundColor : props . bgColor } ] } >
13+ < Text style = { styles . buttonTitle } > { props . title } </ Text >
14+ </ TouchableOpacity >
15+ ) ;
16+ const PopupDialogView = props => (
17+ < PopupDialog { ...props } >
18+ { props . children }
19+ < View style = { { flexDirection : 'row' , position : 'absolute' , bottom : 0 } } >
20+ { props . cancelBtn && (
21+ < Button
22+ onPress = { props . cancelBtn . onPress }
23+ bgColor = { props . cancelBtn . bgColor }
24+ title = { props . cancelBtn . title }
25+ />
26+ ) }
27+ { props . confirmBtn && (
28+ < Button
29+ disabled = { props . confirmBtn . disabled }
30+ onPress = { props . confirmBtn . onPress }
31+ bgColor = { props . confirmBtn . bgColor }
32+ title = { props . confirmBtn . title }
33+ />
34+ ) }
35+ </ View >
36+ </ PopupDialog >
37+ ) ;
38+
3539const scaleAnimation = new ScaleAnimation ( ) ;
3640const actions = [ ] ;
3741PopupDialog . propTypes = {
@@ -46,11 +50,12 @@ PopupDialog.propTypes = {
4650 confirmBtn : PropTypes . object ,
4751 cancelBtn : PropTypes . object ,
4852 overlayOpacity : PropTypes . number ,
49- overlayBackgroundColor : PropTypes . string
53+ overlayBackgroundColor : PropTypes . string ,
54+ dialogStyle : PropTypes . object
5055} ;
5156PopupDialog . defaultProps = {
52- width : 0.9 ,
53- height : 300 ,
57+ width : 100 ,
58+ height : 100 ,
5459 show : false ,
5560 dismissOnTouchOutside : false ,
5661 dialogAnimation : scaleAnimation ,
@@ -59,7 +64,8 @@ PopupDialog.defaultProps = {
5964 confirmBtn : null ,
6065 cancelBtn : null ,
6166 overlayOpacity : 0.7 ,
62- overlayBackgroundColor : '#000'
67+ overlayBackgroundColor : '#000' ,
68+ dialogStyle : { overflow : 'hidden' }
6369} ;
6470const styles = StyleSheet . create ( {
6571 container : {
0 commit comments