Skip to content

Conversation

@bennyBakshi
Copy link

@bennyBakshi bennyBakshi commented Nov 26, 2025

Fixes #2750

Problem

The Agenda's ReservationList has a scrolling bug where only the first ~10-20 items render and users can't scroll further. This happens intermittently and is hard to reproduce consistently.

Root Cause

React Native's FlatList has a known issue where it gets "stuck" if initially rendered with empty data (facebook/react-native#39421).

In ReservationList, the state is initialized with reservations: [] in the constructor, and the FlatList renders before componentDidMount populates the data. By then, the FlatList is already broken.

Solution

Show the loading indicator until this.state.reservations has actual data. This ensures the FlatList is never mounted with an empty array.

if (!this.state.reservations || this.state.reservations.length === 0) {
  return <ActivityIndicator style={this.style.indicator} color={theme?.indicatorColor}/>;
}

Testing

Tested on a production app with hundreds of agenda items. Before the fix, scrolling would stop after ~20 items. After the fix, all items render and scroll correctly.

FlatList has a known bug where it gets stuck and won't render items
if it's initially mounted with empty data. This happens because the
reservations state starts empty and gets populated in componentDidMount.

By the time componentDidMount runs, the FlatList has already been
created with data=[], causing it to become unresponsive to new data.

This fix shows the loading indicator until reservations are actually
populated, avoiding the empty-data initialization issue.

Fixes scrolling issues in Agenda where only ~10-20 items would render
and users couldn't scroll further.

Related: facebook/react-native#39421
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

Successfully merging this pull request may close these issues.

Agenda scroll is disabled showing only first 10 items

2 participants