Skip to content

navigation.preload() with enableFreeze breaks app, stopping rendering #2557

@hirbod

Description

@hirbod

Description

React Navigation v7 introduces navigation.preload().

If you preload a screen without navigating to it, the entire app stops rendering because react-freeze is triggered, halting the rendering process. To resolve this, you must navigate to the preloaded screen and then pop it to unfreeze the app.

I discovered this issue by calling preload() in an effect and during onPressIn, then aborting the press (by moving my finger away). In both cases, the app stopped rendering updates.

However, once I navigated to the preloaded screen and returned, the app resumed working as expected.

React Native Screens should avoid applying any freezing logic when a screen is pre-rendered using preload().

React Navigation already passes activityState, so react-freeze should read it:
https://github.com/react-navigation/react-navigation/blob/8209a855b312db1104270774810f6d9a7e0395b6/packages/native-stack/src/views/NativeStackView.native.tsx#L283

Steps to reproduce

Everything said already, the Snack is fake, sorry! The description is clear enough.

Snack or a link to a repository

https://snack.expo.dev/@hirbod/fake

Screens version

4.3.0

React Native version

0.76.3

Platforms

Android, iOS

JavaScript runtime

None

Workflow

None

Architecture

None

Build type

None

Device

None

Device model

No response

Acknowledgements

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Platform: AndroidThis issue is specific to AndroidPlatform: iOSThis issue is specific to iOSRepro providedA reproduction with a snack or repo is provided

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions