Header in ListView disappears
When I create a ListView with more than initialListSize items, the ListView header disappears, if it's styled with stylename="flexible". It will be quickly drawn after the first 10 items (initialListSize default) are drawn and then disappears when more items are rendered.
Here's a simple example. If you set numItems to 10, the header will stay put. With more items it disappears
class Example extends Component {
render() {
numItems = 11
const data = []
for (let i = 1; i <= numItems; ++i) {
data[i] = 'Row ' + i
}
return (
<ListView
styleName="flexible"
initialListSize={100}
data={data}
renderHeader={() => <View styleName="flexible"><Text>Header...</Text></View>}
renderRow={(rowData) => <View styleName="flexible"><Text>{rowData}</Text></View>}
autoHideHeader={false}
/>
)
}
}
With a straight RNListView things work out better. Any suggestions?
@stefnnn Thank you for submitting the issue and sorry for a late response. We're currently working on fixing the majority of the issues in the current version. We will release a new version of @shoutem/ui hopefully next week with the fix included.
Hi @stefnnn
I have opened the https://github.com/shoutem/ui/pull/225 that should let you fix the problem.
The problem you currently have is caused by header container that doesn't have flex style. The header you actually render doesn't scale well with flex:1style in that case.
You'll have to style the header container to get what flexible header.
Or alternatively, what you can do right now, is to set a static height to the header you render.
We have just released the new UI toolkit https://github.com/shoutem/ui/releases/tag/v0.13.0.
With new UI toolkit you can define headerContainer style in the ListView style.
<ListView
style={{ headerContainer: { flex: 1 } }}
/>
Closing.