software-mansion / react-native-screens

Native navigation primitives for your React Native app.
https://docs.swmansion.com/react-native-screens/
MIT License
3.04k stars 515 forks source link

When Farbic is turned on, if the previous page used react native reanimated useAnimatedStyle, it will cause RNSScreen. m's viewDidLayoutSubviews to be called multiple times #2429

Open renyufei8023 opened 16 hours ago

renyufei8023 commented 16 hours ago

Description

When Farbic is turned on, if the previous page used react native reanimated useAnimatedStyle, it will cause RNSScreen. m's viewDidLayoutSubviews to be called multiple times. If the current page navigation bar is hidden, there will be no problem, or if customheader is used

Steps to reproduce

1.Page A using the AusAnimatedStyle of React Native Reanimated 2.push to page B,this page headerShow is true 3.Page B onLayou tAlways callback

Snack or a link to a repository

https://github.com/renyufei8023/RNTest

Screens version

3.32.0

React Native version

0.74.5

Platforms

iOS

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Fabric (New Architecture)

Build type

Debug mode

Device

Real device

Device model

No response

Acknowledgements

Yes

renyufei8023 commented 13 hours ago

I think it's an issue with useAnimatedStyle. If I delete the code related to useAnimatedStyle, there won't be this problem

kkafar commented 13 hours ago

@renyufei8023 thank you for reporting! Would you consider transferring the issue to react-native-reanimated then?

It would be useful you define what the actual problem here is? viewDidLayoutSubviews is a system method that's get called really often under various circumstances.

If you think this is react-native-screens issue please let me know, otherwise I'll close this issue in few hours.

renyufei8023 commented 12 hours ago

@renyufei8023 thank you for reporting! Would you consider transferring the issue to react-native-reanimated then?

It would be useful you define what the actual problem here is? viewDidLayoutSubviews is a system method that's get called really often under various circumstances.

If you think this is react-native-screens issue please let me know, otherwise I'll close this issue in few hours.

The impact of the current problem is that if a ScrollView or FlatList has a lot of content that exceeds the screen and is dragged to the bottom of the view, the view will automatically bounce back to the top of the page

renyufei8023 commented 12 hours ago

@kkafar I'm not sure if it's a problem with React Native screens or React Native Reanimated at the moment. If I set headerShown to true, there will be no problem at this point

kkafar commented 12 hours ago

If I set headerShown to true, there will be no problem at this point

heaerShown: false you mean, right?

renyufei8023 commented 12 hours ago

If I set headerShown to true, there will be no problem at this point

heaerShown: false you mean, right?

yes