React-native: [0.29] With flexWrap: 'wrap', unexpected margin appears between wrapped rows

Created on 11 Jul 2016  路  2Comments  路  Source: facebook/react-native

This issue appears after upgrading to 0.29.

This code:

import React, { Component } from 'react';
import { View, Text, StyleSheet } from 'react-native';

export default class Test extends Component {
  render = () => {
    return (
      <View style={styles.container}>
        <Text style={styles.item}>Text</Text>
        <Text style={styles.item}>Text</Text>
        <Text style={styles.item}>Text</Text>
        <Text style={styles.item}>Text</Text>
        <Text style={styles.item}>Text</Text>
        <Text style={styles.item}>Text</Text>
        <Text style={styles.item}>Text</Text>
        <Text style={styles.item}>Text</Text>
        <Text style={styles.item}>Text</Text>
        <Text style={styles.item}>Text</Text>
        <Text style={styles.item}>Text</Text>
        <Text style={styles.item}>Text</Text>
        <Text style={styles.item}>Text</Text>
        <Text style={styles.item}>Text</Text>
        <Text style={styles.item}>Text</Text>
        <Text style={styles.item}>Text</Text>
        <Text style={styles.item}>Text</Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    marginTop: 20,
    flexDirection: 'row',
    flexWrap: 'wrap'
  },
  item: {
    width: 80
  }
});

Resulting this screenshot:

simulator screen shot jul 11 2016 20 29 24

You can see that there is huge margin between rows, and with more rows, the margin will be bigger.

Is this a bug or some flexbox behavior has been changed that I am not aware of?

Thanks.

Locked

Most helpful comment

Adding alignItems: 'flex-start' works

All 2 comments

Adding alignItems: 'flex-start' works

Was this page helpful?
0 / 5 - 0 ratings