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

Setting contentOffset and contentInset in FlatList breaks viewabilityConfigCallbackPairs logic #26282

Closed
viventus opened this issue Aug 31, 2019 · 5 comments
Labels
Bug Component: FlatList Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@viventus
Copy link

viventus commented Aug 31, 2019

React Native version: 0.60.5, Platform: iOS

Describe what you expected to happen:
At intial render should call onViewableItemsChanged in viewabilityConfig

Snack, code example, screenshot, or link to a repository:

public render() {
        const viewabilityConfigCallbackPairs: ViewabilityConfigCallbackPairs = [
            {
                viewabilityConfig: {
                    minimumViewTime: 800,
                    itemVisiblePercentThreshold: 50,
                },
                onViewableItemsChanged: ({changed}) => {
                    console.log(changed);
                },
            },
        ];
        
        const contentInset: Insets = {top: 15};
        const contentOffset: PointPropType = {y: -15, x: 0}

        return (
            <FlatList
                ListEmptyComponent={this.renderEmptyElement()}
                ListFooterComponent={FixedFooterBottomInsetView}
                ListHeaderComponent={this.renderHeaderComponent}
                data={items}
                renderItem={this.handleRenderItem}
                keyExtractor={this.keyExtractor}
                onEndReached={this.handleOnEndReach}
                onEndReachedThreshold={REACH_LIST_END_SCREENS}
                viewabilityConfigCallbackPairs={viewabilityConfigCallbackPairs}
                onRefresh={this.handleListRefresh}
                refreshing={isRefreshing}
                showsVerticalScrollIndicator={false}
                onScroll={this.handleScroll}
                maxToRenderPerBatch={MAX_TO_RENDER_PER_BATCH}
                windowSize={WINDOW_SIZE}
                initialNumToRender={INITIAL_NUM_TO_RENDER}
                updateCellsBatchingPeriod={UPDATE_CELLS_BATCHING_PERIOD}
                contentOffset={contentOffset}
                contentInset={contentInset}
                scrollEventThrottle={1}
                automaticallyAdjustContentInsets={false}
                onScrollToIndexFailed={noop}
            />
        );
    }
@viventus viventus added the Bug label Aug 31, 2019
@viventus
Copy link
Author

In native code i see a lot of useful scrollViewDidScroll calls. This calls send events with zero scrollViewContentSize to JS

@viventus
Copy link
Author

@shergin Could you help me with this please? )

@viventus viventus changed the title Setting contentOffset and contentInset to FlatList breaks viewabilityConfigCallbackPairs logic Setting contentOffset and contentInset in FlatList breaks viewabilityConfigCallbackPairs logic Aug 31, 2019
@viventus
Copy link
Author

viventus commented Sep 1, 2019

I guess we should check contentLength before applying new value to _scrollMetrics

this._scrollMetrics = {

@stale
Copy link

stale bot commented Nov 30, 2019

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Nov 30, 2019
@stale
Copy link

stale bot commented Dec 7, 2019

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Dec 7, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Dec 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Component: FlatList Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

2 participants