software-mansion / react-native-gesture-handler

Declarative API exposing platform native touch and gesture system to React Native.
https://docs.swmansion.com/react-native-gesture-handler/
MIT License
6.13k stars 982 forks source link

Fix button padding not being applied correctly on the new arch #3106

Closed j-piasecki closed 2 months ago

j-piasecki commented 2 months ago

Description

Fixes https://github.com/software-mansion/react-native-gesture-handler/issues/3100

Updates the logic for applying the layout metrics, which needs to be customized due to nested structure of the button on the new architecture - instead of being just a button view, it's a button view inside a custom ViewComponentView.

Previously all metrics were applied to the wrapper view (including padding and border insets) which caused the button to be offset in the wrapper and it's content was offset again (due to children being mounted under the button instead of the wrapper and their layout metrics containing frame position).

This PR changes that so that insets are not applied to the wrapper view at all and the button always fills the container. This way the layout of the children remains correct.

Test plan

Tested on the FabricExample app and on the reproducer from the issue.