@@ -78,18 +78,10 @@ export default class App extends Component<{}> {
7878 { this . invocationEvent ( ) }
7979 < Text style = { styles . textColor } > Set primary color </ Text >
8080 < View style = { styles . rowView } >
81- < TouchableOpacity style = { styles . buttonColor } onPress = { ( ) => this . setPrimaryColor ( '#FF0000' ) } >
82- < Text style = { styles . text } > RED </ Text >
83- </ TouchableOpacity >
84- < TouchableOpacity style = { styles . buttonColor } onPress = { ( ) => this . setPrimaryColor ( '#00FF00' ) } >
85- < Text style = { styles . text } > GREEN </ Text >
86- </ TouchableOpacity >
87- < TouchableOpacity style = { styles . buttonColor } onPress = { ( ) => this . setPrimaryColor ( '#0000FF' ) } >
88- < Text style = { styles . text } > BLUE </ Text >
89- </ TouchableOpacity >
90- < TouchableOpacity style = { styles . buttonColor } onPress = { ( ) => this . setPrimaryColor ( '#FFFF00' ) } >
91- < Text style = { styles . text } > YELLOW </ Text >
92- </ TouchableOpacity >
81+ < TouchableOpacity style = { buttonColor ( '#FF0000' ) } onPress = { ( ) => this . setPrimaryColor ( '#FF0000' ) } />
82+ < TouchableOpacity style = { buttonColor ( '#00FF00' ) } onPress = { ( ) => this . setPrimaryColor ( '#00FF00' ) } />
83+ < TouchableOpacity style = { buttonColor ( '#0000FF' ) } onPress = { ( ) => this . setPrimaryColor ( '#0000FF' ) } />
84+ < TouchableOpacity style = { buttonColor ( '#FFFF00' ) } onPress = { ( ) => this . setPrimaryColor ( '#FFFF00' ) } />
9385 </ View >
9486 < View style = { styles . switchView } >
9587 < Text style = { styles . textSwitchStyle } > Color Theme: { this . state . colorTheme } </ Text >
@@ -203,12 +195,22 @@ export default class App extends Component<{}> {
203195 } ) ;
204196 }
205197}
206-
198+ buttonColor = function ( myColor ) {
199+ return {
200+ marginTop : 10 ,
201+ padding : 20 ,
202+ paddingRight : 40 ,
203+ alignItems : 'center' ,
204+ borderRadius : 5 ,
205+ marginRight : 5 ,
206+ backgroundColor : myColor ,
207+ }
208+ }
207209const styles = StyleSheet . create ( {
208210 container : {
209211 flex : 1 ,
210212 alignItems : 'center' ,
211- backgroundColor : '#F5FCFF' ,
213+ backgroundColor : '#F5FCFF'
212214 } ,
213215 details : {
214216 textAlign : 'center' ,
@@ -230,7 +232,10 @@ const styles = StyleSheet.create({
230232 } ,
231233 rowView : {
232234 flexDirection : 'row' ,
233- marginTop : 10
235+ marginTop : 10 ,
236+ maxWidth : '100%' ,
237+ flexGrow : 1 ,
238+ flexWrap : 'wrap'
234239 } ,
235240 textColor : {
236241 fontSize : 14 ,
0 commit comments