Commit 2c6cb27
Add null guard for changedTouches in ResponderTouchHistoryStore.recordTouchTrack (#56819)
Summary:
Pull Request resolved: #56819
The native iOS touch system can occasionally dispatch touch events to JavaScript where `nativeEvent.changedTouches` is undefined due to inconsistencies between local and UIKit touch registries. This causes a TypeError crash in `ResponderTouchHistoryStore.recordTouchTrack` when it unconditionally calls `.forEach()` on `changedTouches`.
The fix adds a defensive null check: if `changedTouches` is null/undefined, we log a DEV warning and bail out early from `recordTouchTrack`. Additionally, `nativeEvent.touches` accesses use optional chaining to prevent secondary crashes.
Changelog: [iOS][Fixed] - Fix TypeError crash in ResponderTouchHistoryStore when changedTouches is undefined
Reviewed By: fkgozali
Differential Revision: D105023000
fbshipit-source-id: d3ade24e93f45614b094932e436f7190c8c0a9851 parent fafcfcd commit 2c6cb27
1 file changed
Lines changed: 11 additions & 2 deletions
Lines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
224 | 233 | | |
225 | 234 | | |
226 | 235 | | |
227 | 236 | | |
228 | | - | |
| 237 | + | |
229 | 238 | | |
230 | 239 | | |
231 | 240 | | |
232 | 241 | | |
233 | 242 | | |
234 | 243 | | |
235 | 244 | | |
236 | | - | |
| 245 | + | |
237 | 246 | | |
238 | 247 | | |
239 | 248 | | |
| |||
0 commit comments