Open AlenToma opened 1 year ago
Ok was able to fix this by creating new LayoutProvider
each time the size change.
as calProductWidth
somehow return the old value instead of the updated one.
this is a bug in my opinion as each time i create new LayoutProvider
the scroll gets misset upp a little which I could live with
useEffect(() => {
layoutProvider.current = new LayoutProvider(
(index) => {
return 0;
},
(type, dim, index) => {
dim.width = calProductWidth()
dim.height = itemHeight ?? 30;
},
);
}, [productWidth, containerWidth])
I had a similar problem and I fixed it by adding a variable height style to the RowRenderer. I update the height with a global variable, which isn't very nice, but I have only 1 copy of the list in my app.
Dimensions.addEventListener('change', () => {
this.setState({dataProvider: this.state.dataProvider.cloneWithRows(this.props.data)});
g_width = Dimensions.get('screen').width;
}
Hi I am having trouble to change item
width
when the screen change.I can see that
width
change but somehow it is not applied to the item or maybe the item gets cached somehow.This is the custom component I created
and here is how I call it