Nativebase: Content does not stretch to full height

Created on 31 Oct 2017  路  7Comments  路  Source: GeekyAnts/NativeBase

react-native, react and native-base version

"react-native": "0.48.4"
"react": "16.0.0-alpha.12"
"native-base": "2.3.3"

Expected behaviour

Flatlist (horizonatl) present inside the content must stretch to full height.

Actual behaviour

Flatlist wraps the height, without content it used to fill the whole height.

Steps to reproduce (code snippet or screenshot)

<Container style={{ marginTop: 22 }}>
        <Header searchBar rounded>
          <Item>
            <Icon active name='search' />
            <Input placeholder='Search' />
          </Item>
          <Button transparent>
            <Text>Search</Text>
          </Button>
        </Header>
        <Content style={{ flex: 1 }}>
          <FlatList
            data={this.state.items}
            renderItem={this.renderRow.bind(this)}
            keyExtractor={(item) => item.row._id}
            horizontal
            removeClippedSubviews={false}
            style={{ flex: 1 }}
          />
        </Content>
</Container>

Screenshot of emulator/device

simulator screen shot - iphone 6 - 2017-10-31 at 16 23 37

Is the bug present in both ios and android or in any one of them?

Issue seen in Both

Any other additional info which would help us debug the issue quicker.

I tried,

  • wrapping up Flatlist with nativebase View
  • Giving style={{ flex: 1 }} contentContainerStyle={{ flex: 1 }} to Content.
  • Tried giving flex to the items which are being displayed.
    None of them is working.

Most helpful comment

fixed it by adding,
contentContainerStyle={{ flexGrow: 1 }}

All 7 comments

fixed it by adding,
contentContainerStyle={{ flexGrow: 1 }}

Thank you @gokulkulkarni1987. This was driving me nuts.

contentContainerStyle is not a documented property of <Content /> on the official docs.

And even the <Fab /> component documentation uses a plain <View /> instead of <Content /> which made it confusing.

@SupriyaKalghatgi Any reason contentContainerStyle isn't documented under the Anatomy section where Content is described?

@EvHaus About contentContainerStyle, yes we will add this
Sorry! missed this

@SupriyaKalghatgi please do so馃憤

@SupriyaKalghatgi
The property "contentContainerStyle" is not present on the documentation. Is there a plan to deprecate this?

Same Issue here. The solution proposed not working here...

setting contentContainerStyle to {flexGrow:1} no longer works ?

(Edit: Solution all the parent component should have a style of flex 1)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mcpracht picture mcpracht  路  3Comments

bsiddiqui picture bsiddiqui  路  3Comments

omerdn1 picture omerdn1  路  3Comments

muthuraman007 picture muthuraman007  路  3Comments

aloifolia picture aloifolia  路  3Comments