Skip to content

usePagerView recreates initial page arrays and Animated.Values on each render #1107

Description

@OskarEichler

At master 7926b28, useState(new Array(...)) and useRef(new Animated.Value(...)) eagerly evaluate their arguments every render. A real React 19 renderer with 10 updates constructs 33 Animated.Values although only the original three are used. Every scroll progress update also rebuilds the initial page list. Proposed fix: lazy state initialization for these mount-only resources, preserving stable handlers and the existing pagesAmount initialization-only behavior. The example navigation hook repeats the allocation pattern and has an independently stale selection callback. Diagnostics are external, not added test files. This source audit is AI-assisted.

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