Commit 665beff
Fix native component event property checks (#58195)
Summary:
Legacy native component event merging invokes `hasOwnProperty` directly on native/default event maps. An own event named `hasOwnProperty` shadows that method and crashes component initialization. Use a bound intrinsic own-property check for both source and destination maps, and add an exact regression.
Hosted Flow caught two stale-server misses in the first patches: method unbinding/exact-object inference, then the deprecated `mixed` annotation. The final head uses the repository-standard suppression around the captured intrinsic and an explicit `unknown` indexer for the mutable test map.
Fixes #58194.
## Changelog:
[GENERAL] [FIXED] - Handle native component event names that shadow Object prototype properties.
Pull Request resolved: #58195
Test Plan:
- Focused `getNativeComponentAttributes` Jest suite: 2 tests passed on the original regression/fix run.
- Final-head targeted ESLint, Prettier check, and `git diff --check` passed.
- Hosted full Flow/lint passed on the final amended head.
No UI change; screenshots are not applicable.
Reviewed By: cipolleschi
Differential Revision: D120117546
Pulled By: vzaidman
fbshipit-source-id: f4e1cbf6c68bd33ff98ca8df4864b828ac31179b1 parent 86ba0c6 commit 665beff
2 files changed
Lines changed: 25 additions & 3 deletions
File tree
- packages/react-native/Libraries/ReactNative
- __tests__
Lines changed: 16 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
17 | | - | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| |||
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
36 | 42 | | |
37 | 43 | | |
38 | 44 | | |
| |||
46 | 52 | | |
47 | 53 | | |
48 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
49 | 64 | | |
Lines changed: 9 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
141 | 144 | | |
142 | 145 | | |
143 | 146 | | |
| |||
151 | 154 | | |
152 | 155 | | |
153 | 156 | | |
154 | | - | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
155 | 160 | | |
156 | 161 | | |
157 | 162 | | |
158 | 163 | | |
159 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
160 | 167 | | |
161 | 168 | | |
162 | 169 | | |
| |||
0 commit comments