react-navigation / react-navigation

Routing and navigation for your React Native apps
https://reactnavigation.org
23.3k stars 4.97k forks source link

Unexpected layout size when screen is out of focus #11951

Open oliviercperrier opened 4 weeks ago

oliviercperrier commented 4 weeks ago

Current behavior

Im using a expo-linear-gradient lib and i noticed that when i change screen, the linearGradient is changing orientation. So when i come back the screen with the linearGradient, i see a quick flicker during the time the linearGradient is coming back to normal.

When i load the screen, i get this:

Screenshot 2024-04-19 at 10 13 11 AM

When i change screen:

Screenshot 2024-04-19 at 10 13 44 AM

Issue suspected to come from somewhere here: https://github.com/react-navigation/react-navigation/blob/d0abdee67f5db8cf39112af535846ffededfb21d/packages/react-native-tab-view/src/SceneView.tsx#L74-L91

Expected behavior

Screen layout width and height should stay the same when out of focus to avoid causing weird flicker on resizing when getting back the focus.

Here is an exemple with the linear gradient: https://github.com/expo/expo/assets/28421005/707dc5ea-715c-4a40-a091-0e058f9936b0

Reproduction

https://github.com/oliviercperrier/repro-Expo-linear-gradient-issue

Platform

Environment

package version
expo ^50.0.14
react-native ^0.73.6
@react-navigation/native ~6.1.6
node v18.19.0
npm 10.2.3

related: https://github.com/expo/expo/issues/28298

github-actions[bot] commented 4 weeks ago

Couldn't find version numbers for the following packages in the issue:

Can you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3.

github-actions[bot] commented 4 weeks ago

The versions mentioned in the issue for the following packages differ from the latest versions on npm:

Can you verify that the issue still exists after upgrading to the latest versions of these packages?