Skip to content

Commit 94ea10c

Browse files
jonthysellfacebook-github-bot
authored andcommittedFeb 20, 2025
Fix implicit cast from double to PointerIndentifier in NativeDOM.cpp (#48578)
Summary: When building `react-native-windows` our code analysis tools complained about an implicit `double` to `PointerIdentifier` in NativeDOM.cpp. This PR adds an explicit cast. Temporary downstream patch: microsoft/react-native-windows@5957d0a ## Changelog: [GENERAL] [FIXED] - Add explicit casts for pointerIds for PointerEvents in NativeDOM Pull Request resolved: #48578 Test Plan: React Native Windows builds with this change and no more warnings. Reviewed By: rubennorte Differential Revision: D69920656 Pulled By: cipolleschi fbshipit-source-id: 1d81f1fbfd91fadfb676d3e65c3c9cb729c1d3dd
1 parent 3d1c1b5 commit 94ea10c

File tree

1 file changed

+6
-3
lines changed
  • packages/react-native/ReactCommon/react/nativemodule/dom

1 file changed

+6
-3
lines changed
 

‎packages/react-native/ReactCommon/react/nativemodule/dom/NativeDOM.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,8 @@ bool NativeDOM::hasPointerCapture(
313313
jsi::Value nativeElementReference,
314314
double pointerId) {
315315
bool isCapturing = getPointerEventsProcessorFromRuntime(rt).hasPointerCapture(
316-
pointerId, shadowNodeFromValue(rt, nativeElementReference).get());
316+
static_cast<PointerIdentifier>(pointerId),
317+
shadowNodeFromValue(rt, nativeElementReference).get());
317318
return isCapturing;
318319
}
319320

@@ -322,15 +323,17 @@ void NativeDOM::releasePointerCapture(
322323
jsi::Value nativeElementReference,
323324
double pointerId) {
324325
getPointerEventsProcessorFromRuntime(rt).releasePointerCapture(
325-
pointerId, shadowNodeFromValue(rt, nativeElementReference).get());
326+
static_cast<PointerIdentifier>(pointerId),
327+
shadowNodeFromValue(rt, nativeElementReference).get());
326328
}
327329

328330
void NativeDOM::setPointerCapture(
329331
jsi::Runtime& rt,
330332
jsi::Value nativeElementReference,
331333
double pointerId) {
332334
getPointerEventsProcessorFromRuntime(rt).setPointerCapture(
333-
pointerId, shadowNodeFromValue(rt, nativeElementReference));
335+
static_cast<PointerIdentifier>(pointerId),
336+
shadowNodeFromValue(rt, nativeElementReference));
334337
}
335338

336339
#pragma mark - Methods from the `HTMLElement` interface (for `ReactNativeElement`).

0 commit comments

Comments
 (0)
Please sign in to comment.