A React Native demo project showcasing how to build a chat UI with @shopify/flash-list.
This experiment focuses on supporting anchor jump (scrolling directly to a target message) and bi-directional pagination.
This repository is not a generic chat template.
It was created as an experimental playground while working on a real chat project where we faced limitations with FlatList:
- FlatList’s
invertedmode made it difficult to maintain scroll position. - FlatList does not support
onStartReached, making top pagination harder. - Jumping to a specific message (
scrollToIndex) was unreliable in long lists.
So I explored FlashList to see how we can solve these issues and improve performance in chat UIs.
👉 This repo is intentionally structured for testing these behaviors, not as a production-ready app.
- Chat UI built with FlashList
- Anchor Jump: jump directly to a given message by ID
- Bi-directional Infinite Scroll (
onStartReached+onEndReached) - Initial render skips auto-triggering
onStartReached/onEndReached - Pagination powered by
useInfiniteQueryfrom @tanstack/react-query
npm install
# or
yarn installnpm start
# or
yarn start# Android
npm run android
# iOS
npm run ios<FlashList
ref={listRef}
data={messages}
renderItem={({item}) => <MessageBubble message={item} />}
keyExtractor={item => item.id}
estimatedItemSize={60}
onStartReached={() => {
if (!userScrolling.current) return;
loadMoreTop();
}}
onEndReached={() => {
if (!userScrolling.current) return;
loadMoreBottom();
}}
onMomentumScrollBegin={() => {
userScrolling.current = true;
}}
maintainVisibleContentPosition={{
autoscrollToTopThreshold: 50,
startRenderingFromBottom: true,
}}
/>