Commit b8ac9ea
authored
[Native] Automatically unflatten detector children (#3963)
## Description
On Android this requires
#3962
to test, as the non-transparent views are never flattened.
Automatically unflattens the child node of the detector component, so
that setting `collapsable={false}` is no longer needed.
## Test plan
Notce the lack of `collapsable={false}` on the detector's child.
```jsx
import React from 'react';
import { StyleSheet, View } from 'react-native';
import {
GestureDetector,
GestureHandlerRootView,
useTapGesture,
} from 'react-native-gesture-handler';
export default function EmptyExample() {
const tap = useTapGesture({
onActivate: () => {
console.log('tap');
},
});
return (
<GestureHandlerRootView style={styles.container}>
<GestureDetector gesture={tap}>
<View style={{ flex: 1, backgroundColor: 'transparent' }} />
</GestureDetector>
</GestureHandlerRootView>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
});
```1 parent 7e597d0 commit b8ac9ea
File tree
2 files changed
+37
-2
lines changed2 files changed
+37
-2
lines changedLines changed: 29 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
| 31 | + | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
36 | 49 | | |
37 | 50 | | |
38 | 51 | | |
| |||
69 | 82 | | |
70 | 83 | | |
71 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
72 | 99 | | |
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
56 | 62 | | |
57 | 63 | | |
58 | 64 | | |
| 65 | + | |
| 66 | + | |
59 | 67 | | |
60 | 68 | | |
61 | 69 | | |
| |||
0 commit comments