How can I put a ListView inside a ScrollView using React Native iOS?

I am creating an iOS React Native app. I have test content and then a list of items below. If I put the text content and the list in the scroll, listview does not work properly (it displays only some elements), but if I do not put the listview inside the scroll, the listview scrolls, but the text content remains locked at the top of the screen. How to get text content to scroll through a list?

Here is an example of my problem:
https://rnplay.org/apps/GWoFWg

+6
source share
1 answer

You should display the top content using ListView.renderHeader prop:

 class SampleApp extends React.Component { _renderHeader() { // your header rendering code here } _renderRow() { // your row rendering code here } render() { return ( <ListView renderRow={this._renderRow} renderHeader={this._renderHeader} /> ); } } 

ListView uses ScrollView internally to provide scroll behavior, so you don't need to wrap it in another ScrollView .

+22
source

All Articles