@@ -66,7 +66,7 @@ var Button = React.createClass({
66
66
var ModalExample = React . createClass ( {
67
67
getInitialState ( ) {
68
68
return {
69
- animated : true ,
69
+ animationType : 'none' ,
70
70
modalVisible : false ,
71
71
transparent : false ,
72
72
} ;
@@ -76,8 +76,8 @@ var ModalExample = React.createClass({
76
76
this . setState ( { modalVisible : visible } ) ;
77
77
} ,
78
78
79
- _toggleAnimated ( ) {
80
- this . setState ( { animated : ! this . state . animated } ) ;
79
+ _setAnimationType ( type ) {
80
+ this . setState ( { animationType : type } ) ;
81
81
} ,
82
82
83
83
_toggleTransparent ( ) {
@@ -91,18 +91,21 @@ var ModalExample = React.createClass({
91
91
var innerContainerTransparentStyle = this . state . transparent
92
92
? { backgroundColor : '#fff' , padding : 20 }
93
93
: null ;
94
+ var activeButtonStyle = {
95
+ backgroundColor : '#ddd'
96
+ } ;
94
97
95
98
return (
96
99
< View >
97
100
< Modal
98
- animated = { this . state . animated }
101
+ animationType = { this . state . animationType }
99
102
transparent = { this . state . transparent }
100
103
visible = { this . state . modalVisible }
101
104
onRequestClose = { ( ) => { this . _setModalVisible ( false ) } }
102
105
>
103
106
< View style = { [ styles . container , modalBackgroundStyle ] } >
104
107
< View style = { [ styles . innerContainer , innerContainerTransparentStyle ] } >
105
- < Text > This modal was presented { this . state . animated ? 'with ' : 'without ' } animation.</ Text >
108
+ < Text > This modal was presented { this . state . animationType === 'none' ? 'without ' : 'with ' } animation.</ Text >
106
109
< Button
107
110
onPress = { this . _setModalVisible . bind ( this , false ) }
108
111
style = { styles . modalButton } >
@@ -111,10 +114,17 @@ var ModalExample = React.createClass({
111
114
</ View >
112
115
</ View >
113
116
</ Modal >
114
-
115
117
< View style = { styles . row } >
116
- < Text style = { styles . rowTitle } > Animated</ Text >
117
- < Switch value = { this . state . animated } onValueChange = { this . _toggleAnimated } />
118
+ < Text style = { styles . rowTitle } > Animation Type</ Text >
119
+ < Button onPress = { this . _setAnimationType . bind ( this , 'none' ) } style = { this . state . animationType === 'none' ? activeButtonStyle : { } } >
120
+ none
121
+ </ Button >
122
+ < Button onPress = { this . _setAnimationType . bind ( this , 'slide' ) } style = { this . state . animationType === 'slide' ? activeButtonStyle : { } } >
123
+ slide
124
+ </ Button >
125
+ < Button onPress = { this . _setAnimationType . bind ( this , 'fade' ) } style = { this . state . animationType === 'fade' ? activeButtonStyle : { } } >
126
+ fade
127
+ </ Button >
118
128
</ View >
119
129
120
130
< View style = { styles . row } >
0 commit comments