Skip to content

onEndReachednot triggered with conditionalListFooterComponent #264

@kirkas

Description

@kirkas

Description

When using LegendList with a conditional ListFooterComponent:

<LegendList
  ...
  onEndReached={onEndReached}
  ListFooterComponent={isLoadingNext ? <LoadingNextFallback /> : null}
/>

The onEndReached callback fails to fire when isLoadingNext is false and ListFooterComponent is null. This pattern is commonly used to show a loading skeleton only while fetching the next page of results.

Expected Behavior

onEndReached should trigger based on scroll position regardless of whether ListFooterComponent is null.

Actual Behavior

onEndReached is never called unless ListFooterComponent is a non-null element, which breaks infinite scroll behavior when using the typical conditional rendering pattern.

Steps to Reproduce

  1. Pass an onEndReached handler.
  2. Use a conditional footer:
   ListFooterComponent={isLoadingNext ? <LoadingNextFallback /> : null}
  1. Scroll to the end — note that onEndReached does not fire.

Suggested Fix

Ensure onEndReached triggers properly based on scroll position regardless of the presence or absence of ListFooterComponent.

Temporary Workaround

Replace null with an empty View to preserve layout continuity:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions