11import React from 'react' ;
2- import Button from 'react-native-button' ;
32import Modal from 'react-native-modalbox' ;
43import Slider from 'react-native-slider' ;
54
65import {
76 Text ,
7+ Button ,
88 StyleSheet ,
99 ScrollView ,
1010 View ,
@@ -49,18 +49,22 @@ export default class App extends React.Component {
4949 }
5050
5151 render ( ) {
52- var BContent = < Button onPress = { ( ) => this . setState ( { isOpen : false } ) } style = { [ styles . btn , styles . btnModal ] } > X</ Button > ;
52+ var BContent = (
53+ < View style = { [ styles . btn , styles . btnModal ] } >
54+ < Button title = "X" color = "white" onPress = { ( ) => this . setState ( { isOpen : false } ) } />
55+ </ View >
56+ ) ;
5357
5458 return (
5559 < View style = { styles . wrapper } >
56- < Button onPress = { ( ) => this . refs . modal1 . open ( ) } style = { styles . btn } > Basic modal </ Button >
57- < Button onPress = { ( ) => this . refs . modal2 . open ( ) } style = { styles . btn } > Position top </ Button >
58- < Button onPress = { ( ) => this . refs . modal3 . open ( ) } style = { styles . btn } > Position centered + backdrop + disable </ Button >
59- < Button onPress = { ( ) => this . refs . modal4 . open ( ) } style = { styles . btn } > Position bottom + backdrop + slider </ Button >
60- < Button onPress = { ( ) => this . setState ( { isOpen : true } ) } style = { styles . btn } > Backdrop + backdropContent </ Button >
61- < Button onPress = { ( ) => this . refs . modal6 . open ( ) } style = { styles . btn } > Position bottom + ScrollView </ Button >
62- < Button onPress = { ( ) => this . refs . modal7 . open ( ) } style = { styles . btn } > Modal with keyboard support </ Button >
63- < Button onPress = { ( ) => this . refs . modal8 . open ( ) } style = { styles . btn } > Entry from top </ Button >
60+ < Button title = "Basic modal" onPress = { ( ) => this . refs . modal1 . open ( ) } style = { styles . btn } / >
61+ < Button title = "Position top" onPress = { ( ) => this . refs . modal2 . open ( ) } style = { styles . btn } / >
62+ < Button title = "Position centered + backdrop + disable" onPress = { ( ) => this . refs . modal3 . open ( ) } style = { styles . btn } / >
63+ < Button title = "Position bottom + backdrop + slider" onPress = { ( ) => this . refs . modal4 . open ( ) } style = { styles . btn } / >
64+ < Button title = "Backdrop + backdropContent" onPress = { ( ) => this . setState ( { isOpen : true } ) } style = { styles . btn } / >
65+ < Button title = "Position bottom + ScrollView" onPress = { ( ) => this . refs . modal6 . open ( ) } style = { styles . btn } / >
66+ < Button title = "Modal with keyboard support" onPress = { ( ) => this . refs . modal7 . open ( ) } style = { styles . btn } / >
67+ < Button title = "Entry from top" onPress = { ( ) => this . refs . modal8 . open ( ) } style = { styles . btn } / >
6468
6569 < Modal
6670 style = { [ styles . modal , styles . modal1 ] }
@@ -70,7 +74,7 @@ export default class App extends React.Component {
7074 onOpened = { this . onOpen }
7175 onClosingState = { this . onClosingState } >
7276 < Text style = { styles . text } > Basic modal</ Text >
73- < Button onPress = { ( ) => this . setState ( { swipeToClose : ! this . state . swipeToClose } ) } style = { styles . btn } > Disable swipeToClose( { this . state . swipeToClose ? "true" : "false" } ) </ Button >
77+ < Button title = { `Disable swipeToClose( ${ this . state . swipeToClose ? "true" : "false" } )` } onPress = { ( ) => this . setState ( { swipeToClose : ! this . state . swipeToClose } ) } style = { styles . btn } / >
7478 </ Modal >
7579
7680 < Modal style = { [ styles . modal , styles . modal2 ] } backdrop = { false } position = { "top" } ref = { "modal2" } >
@@ -79,15 +83,15 @@ export default class App extends React.Component {
7983
8084 < Modal style = { [ styles . modal , styles . modal3 ] } position = { "center" } ref = { "modal3" } isDisabled = { this . state . isDisabled } >
8185 < Text style = { styles . text } > Modal centered</ Text >
82- < Button onPress = { ( ) => this . setState ( { isDisabled : ! this . state . isDisabled } ) } style = { styles . btn } > Disable ( { this . state . isDisabled ? "true" : "false" } ) </ Button >
86+ < Button title = { `Disable ( ${ this . state . isDisabled ? "true" : "false" } )` } onPress = { ( ) => this . setState ( { isDisabled : ! this . state . isDisabled } ) } style = { styles . btn } / >
8387 </ Modal >
8488
8589 < Modal style = { [ styles . modal , styles . modal4 ] } position = { "bottom" } ref = { "modal4" } >
8690 < Text style = { styles . text } > Modal on bottom with backdrop</ Text >
8791 < Slider style = { { width : 200 } } value = { this . state . sliderValue } onValueChange = { ( value ) => this . setState ( { sliderValue : value } ) } />
8892 </ Modal >
8993
90- < Modal isOpen = { this . state . isOpen } onClosed = { ( ) => this . setState ( { isOpen : false } ) } style = { [ styles . modal , styles . modal4 ] } position = { "center" } backdropContent = { BContent } >
94+ < Modal isOpen = { this . state . isOpen } onClosed = { ( ) => this . setState ( { isOpen : false } ) } style = { [ styles . modal , styles . modal4 ] } position = { "center" } backdropPressToClose = { false } backdropContent = { BContent } >
9195 < Text style = { styles . text } > Modal with backdrop content</ Text >
9296 </ Modal >
9397
0 commit comments