Repository navigation
Commit 29bdd9b
committed
fix: re-declare GestureHandlerRootView, and guard the handlers a byte diff drops
`GestureHandlerRootView` sat in the exclusion register's `notAComponent` bucket,
which the generated invariants subtract, so nothing rendered it. It renders two
ways. The default is `<View style={style ?? styles.container} {...rest} />`, and
the rewrite substitutes a styled twin for that `View`, so the class resolves.
The Android one renders `specs/RNGestureHandlerRootViewNativeComponent` with no
`react-native` specifier in the file, so the rewrite matches nothing:
ANDROID/REWRITE {"type":"RNGestureHandlerRootView",
"props":{"style":{"flex":1},"className":"w-80"}}
That is the `PureNativeButton` shape on the export every app mounts at its root,
on the platform where mounting it is mandatory. It type-checks today through
`ViewProps`, so nothing stops a user writing it.
A bare `className: "style"` mapping fixes Android and regresses the default:
Gesture Handler reaches its `{ flex: 1 }` through `style ?? styles.container`
over a module-private StyleSheet, and resolving a class is exactly a thing that
makes `style` present. Measured, the class-only render went `[{width:95},{flex:1}]`
to `[{width:95}]`. The wrapper carries the default itself and applies it on the
same condition the `??` does — an inline style displaces it, a class does not.
Jest's `defaultPlatform` is `ios`, so a suite cannot reach the Android variant by
resolution. Substituting its module for the one the index requires puts the
shipped wrapper over the shipped Android component; the new suite renders both
variants and pins the byte-identical no-className path on each. Rendering the
root view calls `maybeInitializeFabric`, which reaches an `install()` the JS
module carries only inside a native binary, so the suites clear the global
`isFabric()` reads.
The no-className guard compares `JSON.stringify` of two trees, and that drops
exactly the props whose value is a function — these nodes carry up to four. A
wrapper written `const { onPress, ...rest } = props` reddened nothing: 3 failed,
1170 passed, byte-for-byte the control. `Object.keys().sort()` does not close it
either, because Pressable renders `testOnly_onPress={props.onPress}` whether or
not one was given, so only the value goes `undefined`. Neither does firing a
press: `findEventHandler` walks `element.parent` until something carries a prop
matching the event, and the JSX element the test itself wrote is on that path,
so a component that drops `onPress` on the floor still answers with the caller's
own callback. Comparing the function-valued prop names against the unwrapped twin
is what sees it, and it is the exact complement of what the byte comparison sees.
A test pins that a press is not a forwarding probe, so the closer that looks
obvious is not written again.
`DrawerLayoutAndroid` renders no handler at all under react-native's jest mock,
which makes its generated case an equality between two empty sets. It is named
rather than left to read as a measurement, and pinned beside the block.
The Reanimated exclusion keeps its outcome and loses its reason. "Out of reach
entirely" reads as an external constraint, and the constraint is this PR's own
`moduleName ===` branch — a `startsWith` away, in a function that already carries
a non-exact branch for react-native's Libraries. What actually blocks them is an
API question: neither exposes a plain `style`, only `contentContainerStyle` /
`drawerContainerStyle` and `containerStyle` / `childrenContainerStyle`, so
covering them means minting four `*ClassName` props. Those are the same four
`DrawerLayout` and `Swipeable` expose, which is what makes it worth revisiting:
the deprecated bucket is excluded because Gesture Handler sends users to
Pressable and to the Reanimated twins, and the twins are the uncovered set.
The derivation's domain is `Object.keys` over the index module, so those two are
outside it permanently — that is the limit on a census that otherwise enrols a
new member on its own commit.1 parent dac729a commit 29bdd9b
6 files changed
Lines changed: 372 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
14 | 26 | | |
15 | 27 | | |
16 | 28 | | |
| |||
26 | 38 | | |
27 | 39 | | |
28 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
29 | 61 | | |
30 | 62 | | |
31 | 63 | | |
| |||
48 | 80 | | |
49 | 81 | | |
50 | 82 | | |
51 | | - | |
| 83 | + | |
52 | 84 | | |
53 | 85 | | |
54 | 86 | | |
| |||
69 | 101 | | |
70 | 102 | | |
71 | 103 | | |
72 | | - | |
73 | 104 | | |
74 | 105 | | |
75 | 106 | | |
| |||
128 | 159 | | |
129 | 160 | | |
130 | 161 | | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
131 | 167 | | |
132 | 168 | | |
133 | 169 | | |
| |||
140 | 176 | | |
141 | 177 | | |
142 | 178 | | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
143 | 190 | | |
144 | 191 | | |
145 | 192 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| 17 | + | |
| 18 | + | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
| |||
70 | 73 | | |
71 | 74 | | |
72 | 75 | | |
73 | | - | |
74 | | - | |
| 76 | + | |
| 77 | + | |
75 | 78 | | |
76 | 79 | | |
77 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| 15 | + | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
0 commit comments