question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Layout] Text overflow in ListView with flexDirection: 'row'

See original GitHub issue

Hi, I have problem with text overflow in ListView, when ancestor has set style flexDirection: ‘row’:

image

part of code:

  render: function() {
    return (
      <View style={styles.container}>
        <ListView
          dataSource={this.state.dataSource}
          renderRow={this.renderRow}
        />
      </View>
    );
  },

  renderRow: function (message, sectionID: number, rowID: number) {
    return (
      <View style={{flexDirection: 'row'}}>
        <Image
          source={{
            uri: 'http://icons.iconarchive.com/icons/designbolts/free-male-avatars/128/Male-Avatar-icon.png',
          }}
          style={{flexWrap: 'wrap', width: 32, height:32}}
        />
        <View style={{flexWrap: 'wrap'}}>
          <Text>
            {message}
          </Text>
        </View>
      </View>
    );
  },

How to wrap text? Thanks.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:2
  • Comments:29 (7 by maintainers)

github_iconTop GitHub Comments

48reactions
michalraskacommented, Apr 17, 2015

I solved problem by set flex: 1 to wrapper view of text.

      <View style={{flexDirection: 'row'}}>
        <Image
          source={{
            uri: 'http://icons.iconarchive.com/icons/designbolts/free-male-avatars/128/Male-Avatar-icon.png',
          }}
          style={{width: 32, height:32}}
        />
        <View style={{flex: 1}}>
          <Text>
            {message}
          </Text>
        </View>
      </View>
7reactions
mschipperheyncommented, Jan 12, 2017

This issue should not be closed. Basically, if you use flexDirection : ‘row’, text wrapping doesn’t work. There doesn’t seem to be a clear workaround. Using flex : 1 now collapsed your content to nothing/invisible, so that workaround is gone. A very basic layout aspect is now a total time wasting nightmare. Please fix this!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Listview with flexbox showing all items in one row
In my code below, there is a listview with section headers. Each section header has items under it. The problem is, all items...
Read more >
flex.direction - API Reference - Kendo UI ListView
Defines the direction flex items are placed in the flex container. Think of flex items as primarily laying out either in horizontal rows...
Read more >
FlexboxLayout - NativeScript-Vue
<FlexboxLayout> is a layout container that provides a non-exact implementation of the CSS Flexbox layout. This layout lets you arrange child components both ......
Read more >
Layout Props - React Native
flexDirection controls which directions children of a container go. row goes left to right, column goes top to bottom, and you may be...
Read more >
The Xamarin.Forms FlexLayout - Microsoft Learn
Forms StackLayout in that it can arrange its children horizontally and vertically in a stack. However, the FlexLayout is also capable of ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found