Giter VIP home page Giter VIP logo

inverted-section-list's Issues

Empty areas appear when rendering big list

When to scroll about 100+ items, empty areas appear in the list. Also empty areas sometimes appear when I'm open a keyboard. If use a react native section list, there is no empty areas. But I need an inverted section list with sticky headers, what is not available out of the box in react native for current version.

Version of react native: 0.70.4

example of rendering 150 items

Screen-Recording-2023-03-21-at-1.mp4

scrollToLocation doesn't work as expected

I'm using inverted section list for a chat app. I need to implement scroll to the new received messages. I can calculate the index of section and index of specific item, but scrollToLocation method throw 'undefined is not a function'. If apply same code for built in SectionList, scroll works without errors.

RN version: 0.70.5

useEffect(() => {
if (messages.length && !newMessageScrolled) {
const sectionIndex = batchedMessages.findIndex((section) =>
section?.data?.find((a) => a.messageIndex === newMessagesCount.index)
);
if (sectionIndex !== -1 && newMessagesCount.index > 0 && listRef.current) {
listRef.current.scrollToLocation({ sectionIndex: sectionIndex, itemIndex: newMessagesCount.index });
setNewMessageScrolled(true);
}
}
}, [newMessageScrolled, newMessagesCount]);

<InvertedSectionList
ref={listRef}
contentContainerStyle={getListContainerStyle()}
onScrollToIndexFailed={handleScrollError}
bounces={false}
keyExtractor={listKeyExtractor}
sections={batchedMessages}
scrollEventThrottle={16}
onScroll={handleListScroll}
initialNumToRender={isTablet ? 10 : 16}
renderItem={renderMessage}
renderSectionFooter={renderSectionHeader}
stickyHeaderHiddenOnScroll={true}
stickySectionHeadersEnabled={true}
ListEmptyComponent={renderEmpty}
ListFooterComponent={renderFooter}
/>

Screenshot 2023-03-20 at 15 40 32

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.