Commit 06aab22
authored
[Native] Fix ButtonWrapper Shadow Node custom layout logic (#3974)
## Description
After
#3634
the Pressable did not work on iOS.
The reason lied in the shadow node of the button wrapper introduced in
aforementioned PR which took the layout of the button and instead of
changing its own layout to the button's it changed the child view's
layout. As a result, the detector got bounds (0,0,0,0) thus all the
non-native were considered out of bounds. This broke pressable as it
relies on longPress to register touches.
## Test plan
Tested on the following code
<details>
```tsx
import React from 'react';
import { Text, StyleSheet, View } from 'react-native';
import { Pressable, GestureHandlerRootView } from 'react-native-gesture-handler'
const PressableExample = () => {
const [count, setCount] = React.useState(0);
return (
<GestureHandlerRootView style={styles.container}>
<Pressable onPress={() => setCount((c) => c + 1)}>
<View style={styles.pressable}>
<Text>{count}</Text>
</View>
</Pressable>
</GestureHandlerRootView >
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
pressable: {
alignItems: 'center', justifyContent: 'center', backgroundColor: 'green', width: 100, height: 100
},
wrapperCustom: {
borderRadius: 8,
padding: 16,
minWidth: 150,
alignItems: 'center',
},
text: {
fontSize: 18,
color: 'white',
fontWeight: '600',
},
});
export default PressableExample;
```
</details>1 parent 8fc4f04 commit 06aab22
File tree
1 file changed
+6
-2
lines changed1 file changed
+6
-2
lines changedLines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
84 | 86 | | |
85 | 87 | | |
86 | 88 | | |
87 | 89 | | |
88 | 90 | | |
89 | 91 | | |
90 | 92 | | |
91 | | - | |
| 93 | + | |
92 | 94 | | |
93 | 95 | | |
94 | 96 | | |
| 97 | + | |
| 98 | + | |
95 | 99 | | |
96 | 100 | | |
97 | 101 | | |
| |||
0 commit comments