React-native: [ListView] Extra space at the top.

Created on 7 Apr 2015  路  19Comments  路  Source: facebook/react-native

I don't know if this is a styling issue, but there is some extra space (they're not rows because they're not selectable) at the top of the ListView. Is there any workaround this? And was this issue fixed within the last week?

screen shot 2015-04-07 at 12 09 52 pm

Locked

Most helpful comment

I guess automaticallyAdjustContentInsets strikes again. Try

<ListView automaticallyAdjustContentInsets={false} ... />

All 19 comments

I guess automaticallyAdjustContentInsets strikes again. Try

<ListView automaticallyAdjustContentInsets={false} ... />

That worked, thanks a bunch!

I have the same problem, mark this.

Is this a bug or not?

Is automaticallyAdjustContentInsets documented anywhere? Why it's necessary etc...

Seems like automaticallyAdjustContentInsets compensates for statusBarIOS and tabBarIOS (so that things can scroll properly and not be blocked by those fixed items) but it gets complicated if the scrollview isn't the first or last component.

I was able to replicate this whenever I have a ScrollView (or ListView) with TabBarIOS at the bottom. If I put automaticallyAdjustContentInsets={false} the extra space at the top disappears but the scrollview doesn't scroll up all the way hiding the bottom contents of the ScrollView below the TabBarIOS

@jedt, give the scroll view a contentInset of {bottom:49} or however tall your tab bar is, and the scrolling behavior should be fixed.

Thanks @ide! it works perfectly :)

here is the code:

<ListView
  contentInset={{bottom:49}}
  automaticallyAdjustContentInsets={false}
>

Has the team considered making automaticallyAdjustContentInsets={false} the default behavior of this component?

@frantic - curious what you think about @joeyyang's suggestion above

@jedt @ide Also, if you _still_ can't see everything after doing that, make sure the container has flex: 1 - I forgot to do that I couldn't scroll more than (64 + 49)px!

FWIW - you lose the translucency when scrolling content under the navigation bar - which makes sense when you think of how automaticallyAdjustContentInsets works.

This should definitely be explained in the ListView docs at least. I.e. If using a tab bar with a list view etc...

:+1: for the answer in this issue. :-1: for this being magic to users.

Related: #1779 #2151

@brentvatne @ide

I have a horizontal scroll view and getting extra bottom space.
I changed height in style and contentContainerStyle but not work
Anybody experienced same thing?

The feature is good enough and somewhat necessary in most of the cases that ListView just placed under the Navigator, but the problem is the lack of documentation here .

Thanks so much i was messing with this for way too long

Was this page helpful?
0 / 5 - 0 ratings

Related issues

despairblue picture despairblue  路  3Comments

aniss picture aniss  路  3Comments

madwed picture madwed  路  3Comments

anchetaWern picture anchetaWern  路  3Comments

grabbou picture grabbou  路  3Comments