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

MasonryFlashList: The right column often doesn't come out when I slide down #946

Closed
BennyTian opened this issue Nov 9, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@BennyTian
Copy link

BennyTian commented Nov 9, 2023

Platform:

iOS + Android

Environment

@shopify/flash-list: "1.4.3"

Code

<MasonryFlashList
        data={data}
        keyExtractor={keyExtractor}
        initialNumToRender={10}
        numColumns={2}
        columnWrapperStyle={styles.columnWrapper}
        renderItem={({ item, index }) => (
          <StoryItem {...item} onItemClick={() => onItemClick(item, index)} />
        )}
        refreshControl={
          <RefreshControl refreshing={isRefreshing} onRefresh={handleRefresh} />
        }
        onEndReached={handleLoadMore}
        ListFooterComponent={renderFooter}
        onEndReachedThreshold={0.1}
      />
472_1699516744.mp4

Tasks

No tasks being tracked yet.
@BennyTian BennyTian added the bug Something isn't working label Nov 9, 2023
@yaoz0816
Copy link

friend, how solved it ?

@BennyTian
Copy link
Author

friend, how solved it ?

We haven't found a solution yet

@zyestin
Copy link

zyestin commented Mar 1, 2024

See official documentation masonry#optimizeitemarrangement

If enabled, MasonryFlashList will try to reduce difference in column height by modifying item order. If true, specifying overrideItemLayout is required. Default value is false.

Use as below

<MasonryFlashList
  ... 
  optimizeItemArrangement={true} 
  overrideItemLayout={ (layoutObject, sourceData, ...) => { layoutObject.size = calculateItemHeight(sourceData) } }
/>

@naqvitalha
Copy link
Collaborator

@zyestin's suggestion is the right one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants