mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
fdd133e214
Summary: Changelog: [Internal] # Analysis Measure returns following values for `frame.y` when tapping item in bottom sheet. Fabric 412.33331298828125. Paper 49. In Paper, the frame.y returned is the position of tapped item in bottom sheet relative to the bottom sheet itself, which is correct. This can happen in both BottomSheet and Modal. # Why it happens? In [UIManager.getRelativeLayoutMetrics](https://our.intern.facebook.com/intern/diffusion/FBS/browse/master/xplat/js/react-native-github/ReactCommon/fabric/uimanager/UIManager.cpp?commit=a372cf516ba1245ad9462e68376ee759c118a884&lines=172-181) if `ancestorShadowNode` is nullptr we populate `ancestorShadowNode` with `rootShadowNode` for the surface. Problem is that BottomSheet that is presented, is not a separate surface. This means that we climb up the shadow node hierarchy all the way to root shadow node and keep adding offsets. Even though we should stop when we hit shadow node representing BottomSheet. # How could be this fixed? I think we should add a new shadow node trait that would mark node as root node. As we are traversing the shadow node tree upwards and adding offset of that node, once we hit a node that is "anchor", we would immediately stop the traversal. This solution is inspired by Paper where the node representing BottomSheet has a special flag which marks it as "root" node. accepttoship Reviewed By: JoshuaGross, mdvacca Differential Revision: D19640454 fbshipit-source-id: bde623b1f41a9745a41f0aada7221bf924fad453