Fabric: core Switch renders but never fires onValueChange on mouse click (new architecture)
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 58/100
Línea de trabajo
Comienza en vnext/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.cpp, centrándote en OnPointerPressed, OnPointerReleased y las comprobaciones de IsPrimary(). Comprueba si la liberación del ratón llega a la vista y si la condición la acepta; después, añade la prueba de interacción descrita en el issue. Se considera terminado cuando un clic de ratón sintetizado emite SwitchEventEmitter::onChange y actualiza el Switch controlado.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Environment
- react-native-windows 0.83.2 (component source unchanged on
mainas of 2026-07-17), new architecture (Fabric, composition), Win32/HWND host - Windows 11, physical mouse input
- Reproduced in a production app; repro is trivial (any core
Switch)
Steps to reproduce
import {Switch} from 'react-native';
function Repro() {
const [on, setOn] = React.useState(false);
return <Switch value={on} onValueChange={v => { console.log('onValueChange', v); setOn(v); }} />;
}
- Run on react-native-windows with the new architecture enabled.
- Click the Switch with the mouse.
Expected
onValueChange fires with the toggled value; the Switch (a controlled component) re-renders in the new state. This is the behavior on Android/iOS.
Actual
The Switch renders correctly (including hover visuals), but onValueChange never fires on mouse click. No JS callback, no state change — the control is effectively inert for mouse users.
Root cause pointer
vnext/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.cpp (current main):
OnPointerReleased(~line 285) is the only mouse path totoggle()(~line 328), which emitsfacebook::react::SwitchEventEmitter::onChange— the native event behindonValueChange.- Both
OnPointerPressed(~line 262) andOnPointerReleasedearly-return unlessargs.GetCurrentPoint(-1).Properties().IsPrimary()is true.
On our device the emitter never fires for mouse clicks, so either the IsPrimary() gate rejects mouse pointer input on this code path, or OnPointerReleased is never routed to the Switch component view at all (pointer capture/hit-test). We have not stepped through native to disambiguate the two; what is proven on-device is that no onChange event reaches JS for any mouse click, on multiple screens and multiple Switch instances. The keyboard path (OnKeyUp, Space, ~line 318) is separate and was not part of this investigation.
Suggested fix
Ensure the pointer-released path reaches toggle() for mouse input: verify PointerRoutedEventArgs::GetCurrentPoint(-1).Properties().IsPrimary() returns true for mouse-generated pointer events in the composition input pipeline (or drop the IsPrimary() gate for mouse pointer devices), and add an interaction test that asserts SwitchEventEmitter::onChange fires on a synthesized mouse click.
Workaround (what we ship today)
Wrap the Switch in a Pressable that owns the interaction, and make the Switch itself inert:
<Pressable onPress={() => setOn(v => !v)}>
<Switch value={on} pointerEvents="none" />
</Pressable>
The Pressable receives the click and toggles state; the Switch is display-only. This restores mouse operation but bypasses the control's own accessibility/interaction semantics.
- Lenguaje dominante
- C++
- Estrellas
- 17.4k
- Forks
- 1.2k
- Merge medio
- 2 d 17 h
- PR fusionados (30 d)
- 13
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/react-native-windows
-
Fabric text is drawn with ClearType onto transparent composition surfaces, fringing thin glyphsAbiertoNeeds: Triage :mag:
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
microsoft/react-native-windows#16340 ·
Los mantenedores suelen responder en 2 días
-
bug Needs: Triage :mag:
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
microsoft/react-native-windows#16321 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Needs: Triage :mag:
Dificultad 5/5 Más de una semana Aptitud para principiantes 30/100
microsoft/react-native-windows#16442 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Fabric: activating the window doesn't announce the window or the focused control to a screen readerAbiertoNeeds: Triage :mag:
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
microsoft/react-native-windows#16435 ·
Los mantenedores suelen responder en 2 días
-
bug Needs: Triage :mag:
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
microsoft/react-native-windows#16410 ·
Los mantenedores suelen responder en 2 días
Todos los issues de microsoft/react-native-windows
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
hipRTC lit tests compile against /opt/rocm's LLVM instead of the ROCm under test (ci/ hardcodes LLVM_PATH)Posiblemente ocupada @bernardogv la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
brndnmtthws/conky#2486 ·
Los mantenedores suelen responder en 1 día
-
請增加教學:數字後的句號Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100