Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some items are cropping using recyclerlistview #287

Open
gonalc opened this issue Dec 26, 2018 · 1 comment
Open

Some items are cropping using recyclerlistview #287

gonalc opened this issue Dec 26, 2018 · 1 comment

Comments

@gonalc
Copy link

gonalc commented Dec 26, 2018

I'm using RecyclerListView Component in my React Native app. The list I'm rendering it's a kind of wall, where are included three different kind of items. One of this kind is sometimes cropped, and I've tried to fixed by a lot of different ways.

All items have an assigned width and height (the height depends on each situation) and that's why we are using forceNonDeterministicRendering prop, looking our component like this:

<RecyclerListView
            style={{flex: 1, backgroundColor: '#EEEEEE'}}
            refreshControl={
                <RefreshControl
                    refreshing={this.state.isRefreshing}
                    onRefresh={this._onRefresh}
                />
            }
            onEndReached={this.handleListEnd}
            renderAheadOffset={6000}
            extraData={this.state}
            forceNonDeterministicRendering
            canChangeSize={true}
            initialOffset={12}
            dataProvider={this.state.dataProvider}
            layoutProvider={this._layoutProvider}
            scrollViewProps={{
                viewabilityConfig: this.viewabilityConfig
            }}
            rowRenderer={this.rowRenderer}
            onEndReachedThreshold={0.5}
            onVisibleIndexesChanged={this._trackerView}
            renderFooter={this.renderFooter}
        />

We've tried a bunch of things but we can't fix this problem, so it would be great if somebody could help us!

Thank you very much!

The rowRenderer looks like this:

rowRenderer = (type, data) => {
        if (data.ads) {
            return (
                <View
                    onLayout={this._onLayout}
                    style={{flex: 1}}>
                    <CardAdvertisement from={'timeline'}/>
                    <CardWall from={'timeline'} data={data}/>
                </View>
            );
        } else if (data.suggestion) {
            return (
                <View
                    onLayout={this._onLayout}
                    style={{flex: 1}}>
                    <SuggestionsSlider/>
                    <CardWall from={'timeline'} data={data}/>
                </View>
            );
        } else {
            return (
                <View
                    onLayout={this._onLayout}
                    style={{flex: 1}}>
                    <CardWall from={'timeline'} data={data}/>
                </View>
            );
        }
    };

This is how it should look like:
captura de pantalla 2018-12-26 a las 15 38 38

This is how it actually looks like (sometimes):
capture

And this is another example of a cropped item:
b6a40097-036a-42f6-91fe-0338b580ed14

@mohity777
Copy link

does it even support viewabilityConfig ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants