ChangJoo Park
ChangJoo Park

Reputation: 979

ListView won't scroll to bottom

I create some listview application, I add listview in my view. I can't scroll to bottom.

enter image description here

I found same question. I think it is similar problem but I didn't find solution.

this is gist.

Upvotes: 0

Views: 1119

Answers (2)

stinodes
stinodes

Reputation: 1269

The reason it doesn't scroll, is because it has no height defined. You can check this using the inspector via the dev-menu.

You can fix it by setting a height using the height style, or just by using flex: 1 somewhere in your ListView's style.

Using flex: 1 makes a component fill out all remaining space. So it'd make your ListView calculate its height accordingly.

If it still doesn't work, check whether or not all of its parents have a defined height (once again either with the height or flex property)

Upvotes: 1

Julius Breckel
Julius Breckel

Reputation: 434

Try setting the height of the ListView.

To set it to the height of your screen, just do the following :

var {..., Dimensions, ...} = React;

var screenHeight = Dimensions.get('window').height

Then set height: screenHeight in your ScrollView style

Upvotes: 2

Related Questions