Recyclerlistview: RecyclerListView needs to have a bounded size

Created on 2 Apr 2018  路  20Comments  路  Source: Flipkart/recyclerlistview

Hi, I've been trying to use this component following the example in the README but it gives me the following error:

RecyclerListView needs to have a bounded size. Currently height or, width is 0

If I comment these lines it works perfectly:
https://github.com/Flipkart/recyclerlistview/blob/77d479126595879c3c3c78cd402ba89bb253964c/src/core/RecyclerListView.tsx#L326-L328

I've logged the values of layout and this._layout and they are {height: 0, width: 0} and {width: 414, x: 0, height: 0, y: 0}` respectively.

The only particularity of my usage is the RecyclerListView is on a TabNavigator. Any idea why this might be happening?

The code of my app is here in case you might want to take a look (it's ReasonML, though :( ) https://github.com/erizocosmico/myfosdem/blob/feature/recyclerlistview/re/components/eventList.re#L90-L140

Most helpful comment

@naqvitalha Just wonder if I can add style={{ minHeight: 1, minWidth: 1 }} to hot fix this error?

All 20 comments

Same as #89 and #74 check if those answers clear it up for you.

I m facing the same issue. But if i give RecyclerListView's parent container fixed height and width it shows starting two three images, even if i gave its parent container height to be equal to deviceHeight. It also Distort my css when using with card

@AnandKuhar Can you give me a sample on codesandbox.io? The problem is body is not auto stretched on web. And RLV containers by default enable flex on child. If you give me the sample I will help you out.

wrap the <RecyclerListView /> inside <View style={{flex:1}}> </View> like below:

<View style={{flex:1}}>
<RecyclerListView />
 </View>

@naqvitalha Just wonder if I can add style={{ minHeight: 1, minWidth: 1 }} to hot fix this error?

@peteroid In that case estimated no of items to mount will be computed incorrectly. In future we plan to add layoutParam prop where you can provide layout for RLV to use rather than waiting for mount. That will fix it.

@naqvitalha Is there any way we can catch this error gracefully? By throwing out the error, our app would crash directly. Can we have a prop like onLayoutError and then render nothing to the view after setting a prop like notThrowError={true}?

I was able to fix this error by adding in {minHeight: 1, minWidth: 1} and removing the following 2 properties from my container:

justifyContent: 'center',
alignItems: 'center',

I tried all of these but still am unable to fix this

layoutProvider={this._layoutProvider}
dataProvider={this.state.dataProvider}
rowRenderer={this._rowRenderer}

                                // style={{height:650,width:300}}
                            />

This is my code when i run this the browser hangs and continues to load indefinitely

i managed it with this:
{ this.state.data.length > 0 && <RecyclerListView />}
consider that type of data is array

I add

<View style={{ minHeight: 1, minWidth: 1 }}> 
     <RecyclerListView ... />
</View>

Closing due to inactivity.

I think there should be a clear example for cases where we need an infinite list within a view that is rendering some other elements as well, is not a common case is mobile but is a lot common in web.
There are bunch of items being rendered say on left, and there is a list on right, if page scrolls to bottom, the list on right must fetch new data detecting scroll and everything.

I am currently struggling to achieve this.

After adding

<View style={{minWidth:1,minHeight:1}}> <RecyclerListView rowRenderer={this._rendetItem.bind(this)} dataProvider={datprovider} layoutProvider={layoutProvider}/> </View>
It show me this error
TypeError: undefined is not an object (evaluating 'itemRect.y')

I still have the same problem. And when I put <View style={{minWidth:1,minHeight:1}}> My item list is not centered. When I try to center it, it doesn't work anymore. How can I center my items without getting this error?

In my case i have the prop canChangeSize enable, if you disable, fixed error

Hi All,

I was also facing this issue, settled through the following way

Basically, I was using

import { SafeAreaView } from 'react-native-safe-area-context';

so I think safe area view bounds calculation takes some time and meanwhile RLV throw the error, by changing Safeareaview with "useSafeAreaInsets" hook it works fine.

Thanks!

style={{ width: responsiveWidth(100), height: responsiveHeight(100) }}
/>
It worked for me

@naqvitalha Just wonder if I can add style={{ minHeight: 1, minWidth: 1 }} to hot fix this error?

Oh thanks man you saved me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ardyfeb picture ardyfeb  路  6Comments

andrea7887 picture andrea7887  路  6Comments

sksin28 picture sksin28  路  8Comments

H-Shafiei picture H-Shafiei  路  8Comments

witalobenicio picture witalobenicio  路  8Comments