Skip to content

Commit b409774

Browse files
committed
Fix flex bugs.
#27
1 parent 295c95c commit b409774

2 files changed

Lines changed: 13 additions & 14 deletions

File tree

components/ModalDropdown.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -278,31 +278,35 @@ export default class ModalDropdown extends Component {
278278
props.key = preservedProps.key;
279279
props.onPress = preservedProps.onPress;
280280
switch (row.type.displayName) {
281-
case 'TouchableHighlight': {
281+
case 'TouchableHighlight':
282+
{
282283
return (
283284
<TouchableHighlight {...props}>
284285
{row.props.children}
285286
</TouchableHighlight>
286287
);
287288
}
288289
break;
289-
case 'TouchableOpacity': {
290+
case 'TouchableOpacity':
291+
{
290292
return (
291293
<TouchableOpacity {...props}>
292294
{row.props.children}
293295
</TouchableOpacity>
294296
);
295297
}
296298
break;
297-
case 'TouchableWithoutFeedback': {
299+
case 'TouchableWithoutFeedback':
300+
{
298301
return (
299302
<TouchableWithoutFeedback {...props}>
300303
{row.props.children}
301304
</TouchableWithoutFeedback>
302305
);
303306
}
304307
break;
305-
case 'TouchableWithNativeFeedback': {
308+
case 'TouchableWithNativeFeedback':
309+
{
306310
return (
307311
<TouchableWithNativeFeedback {...props}>
308312
{row.props.children}
@@ -350,18 +354,17 @@ export default class ModalDropdown extends Component {
350354

351355
const styles = StyleSheet.create({
352356
button: {
353-
flexGrow: 1,
354357
justifyContent: 'center',
355358
},
356359
buttonText: {
357360
fontSize: 12,
358361
},
359362
modal: {
360-
flex: 1,
363+
flexGrow: 1,
361364
},
362365
dropdown: {
363366
position: 'absolute',
364-
height: (32 + StyleSheet.hairlineWidth) * 5,
367+
height: (33 + StyleSheet.hairlineWidth) * 5,
365368
borderWidth: StyleSheet.hairlineWidth,
366369
borderColor: 'lightgray',
367370
borderRadius: 2,
@@ -372,14 +375,12 @@ const styles = StyleSheet.create({
372375
alignSelf: 'center',
373376
},
374377
list: {
375-
flex: 1,
378+
//flexGrow: 1,
376379
},
377380
rowText: {
378-
flex: 1,
379381
paddingHorizontal: 6,
382+
paddingVertical: 10,
380383
fontSize: 11,
381-
height: 32,
382-
lineHeight: 32,
383384
color: 'gray',
384385
backgroundColor: 'white',
385386
textAlignVertical: 'center',

example/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,7 @@ const styles = StyleSheet.create({
242242
backgroundColor: 'cornflowerblue',
243243
},
244244
dropdown_2_text: {
245-
height: 40,
246-
lineHeight: 40,
245+
marginVertical: 10,
247246
marginHorizontal: 6,
248247
fontSize: 18,
249248
color: 'white',
@@ -258,7 +257,6 @@ const styles = StyleSheet.create({
258257
borderRadius: 3,
259258
},
260259
dropdown_2_row: {
261-
flex: 1,
262260
flexDirection: 'row',
263261
height: 40,
264262
alignItems: 'center',

0 commit comments

Comments
 (0)