Skip to content

Commit 981b29d

Browse files
authored
fix: use IsPrimary() for touch pointer isPrimary instead of hardcoded id (#16099)
* Create react-native-windows-4ad3ddaf-1358-4ff0-9971-38a7db68266c.json * fix: use IsPrimary() for touch pointer isPrimary instead of hardcoded ID check (#4) activeTouch.isPrimary was set via `pointerId == 1`, which only works for mouse (MOUSE_POINTER_ID == 1). Windows touch pointer IDs are OS-allocated and essentially never 1, so isPrimary was always false for touch input. This meant touch pointers never triggered onClick (gated behind isPrimary && button == 0) and reported incorrect isPrimary in PointerEvents sent to JS. Replace with pointerPoint.Properties().IsPrimary(), which reads the OS POINTER_FLAG_PRIMARY flag directly. This API is already used elsewhere in the codebase (SwitchComponentView, WindowsTextInputComponentView, Composition.Input). (The diagnostics are pre-existing clang noise from missing PCH/Windows headers — not related to this change.)
1 parent 3681722 commit 981b29d

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "fix: use IsPrimary() for touch pointer isPrimary instead of hardcoded pointer ID check",
4+
"packageName": "react-native-windows",
5+
"email": "gordomacmaster@gmail.com",
6+
"dependentChangeType": "patch"
7+
}

vnext/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1385,7 +1385,7 @@ void CompositionEventHandler::onPointerPressed(
13851385

13861386
UpdateActiveTouch(activeTouch, ptScaled, ptLocal);
13871387

1388-
activeTouch.isPrimary = pointerId == 1;
1388+
activeTouch.isPrimary = pointerPoint.Properties().IsPrimary();
13891389
// Map the Windows pointer ID to a small identifier (0–19) safe for use as a JS array index.
13901390
// Windows touch IDs can be arbitrarily large (e.g. 2233), which causes React Native to warn
13911391
// and corrupts touch state, leaving Pressables stuck after a scroll.

0 commit comments

Comments
 (0)