1
1
import React , { Component } from 'react' ;
2
- import { TouchableOpacity , ScrollView } from 'react-native' ;
2
+ import { TouchableOpacity , ScrollView , StyleSheet } from 'react-native' ;
3
3
import { Assets , Colors , View , Text , RadioButton , RadioGroup } from 'react-native-ui-lib' ; //eslint-disable-line
4
4
const starIcon = require ( '../../assets/icons/star.png' ) ;
5
5
@@ -11,10 +11,10 @@ const COLORS = {
11
11
12
12
export default class RadioButtonScreen extends Component {
13
13
static colors = COLORS ;
14
-
14
+
15
15
constructor ( props ) {
16
16
super ( props ) ;
17
-
17
+
18
18
this . state = {
19
19
color : undefined ,
20
20
messageType : undefined ,
@@ -89,10 +89,10 @@ export default class RadioButtonScreen extends Component {
89
89
< Text marginB-20 text60 $textDefault >
90
90
Alignments
91
91
</ Text >
92
- { this . renderRadioButtonWithImageAndText ( 'right -icon' , 'Text on right' ) }
93
- { this . renderRadioButtonWithImageAndText ( 'left -icon' , 'Text on left' , true ) }
94
- { this . renderRadioButton ( 'left -content' , 'Content on left ' , true ) }
95
- { this . renderRadioButton ( 'right -content' , 'Content on right ' , { contentOnRight : true } ) }
92
+ { this . renderRadioButtonWithImageAndText ( 'left -icon' , 'Text on right' ) }
93
+ { this . renderRadioButtonWithImageAndText ( 'right -icon' , 'Text on left' , true ) }
94
+ { this . renderRadioButton ( 'right -content' , 'Content on right ' , true ) }
95
+ { this . renderRadioButton ( 'left -content' , 'Content on left ' , { contentOnLeft : true } ) }
96
96
< Text marginT-10 > You chose: { this . state . textSide } </ Text >
97
97
</ RadioGroup >
98
98
@@ -116,6 +116,8 @@ export default class RadioButtonScreen extends Component {
116
116
onPress = { ( ) => this . setState ( { individualValue2 : ! this . state . individualValue2 } ) }
117
117
label = "Individual Radio Button (with style)"
118
118
labelStyle = { { fontSize : 16 , fontWeight : 'bold' } }
119
+ contentOnLeft
120
+ containerStyle = { styles . contentOnLeft }
119
121
/>
120
122
</ View >
121
123
< TouchableOpacity
@@ -124,7 +126,12 @@ export default class RadioButtonScreen extends Component {
124
126
accessible = { false }
125
127
>
126
128
< View row centerV >
127
- < RadioButton selected = { this . state . individualValue } label = "Individual Radio Button (wrapped)" />
129
+ < RadioButton
130
+ contentOnLeft
131
+ containerStyle = { styles . contentOnLeft }
132
+ selected = { this . state . individualValue }
133
+ label = "Individual Radio Button (wrapped)"
134
+ />
128
135
</ View >
129
136
</ TouchableOpacity >
130
137
< View row centerV marginT-10 >
@@ -133,6 +140,8 @@ export default class RadioButtonScreen extends Component {
133
140
selected = { this . state . disabledValue }
134
141
onPress = { ( ) => this . setState ( { disabledValue : ! this . state . disabledValue } ) }
135
142
label = "Disabled Radio Button"
143
+ contentOnLeft
144
+ containerStyle = { styles . contentOnLeft }
136
145
/>
137
146
</ View >
138
147
< View row centerV marginT-10 >
@@ -141,10 +150,19 @@ export default class RadioButtonScreen extends Component {
141
150
selected = { this . state . disabledSelectedValue }
142
151
onPress = { ( ) => this . setState ( { disabledSelectedValue : ! this . state . disabledSelectedValue } ) }
143
152
label = "Disabled Selected Radio Button"
153
+ contentOnLeft
154
+ containerStyle = { styles . contentOnLeft }
144
155
/>
145
156
</ View >
146
157
</ ScrollView >
147
158
</ View >
148
159
) ;
149
160
}
150
161
}
162
+
163
+ const styles = StyleSheet . create ( {
164
+ contentOnLeft : {
165
+ flex : 1 ,
166
+ justifyContent : 'space-between'
167
+ }
168
+ } ) ;
0 commit comments