forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 157
Open
Labels
Description
Environment
react-native -v:
18.0.0
npm ls react-native-macos:
RnMacOSBarebones@0.0.1 /Users/roshanbx/Projects/POC/RnMacOSBarebones
└── react-native-macos@0.79.1
node -v:
v22.17.1
npm -v:
10.9.2
yarn --version:
zsh: command not found: yarn
xcodebuild -version:
Xcode 26.0.1
Build version 17A400Steps to reproduce the bug
- Run
npx @react-native-community/cli init <projectName> --version 0.79.6 - cd into project and run
npx react-native-macos-init - Replace App.tsx with following code
import { useEffect, useRef, useState } from 'react';
import { View, Text, TextInput } from 'react-native';
function App() {
const boxRef = useRef<View | null>(null);
const [text, setText] = useState("Yes");
useEffect(() => {
boxRef.current?.focus();
}, [])
return (
<View>
<View ref={boxRef} focusable={true} style={{ width: 100, height: 100, backgroundColor: 'red' }} onMouseEnter={() => setText("hello")} onMouseLeave={() => setText("Yes")} onKeyDown={() => setText("keyDown")} />
<Text>{text}</Text>
<TextInput keyDownEvents={[{ key: 'u' }]} onKeyDown={() => setText("keyDowns")} />
</View>
);
}
export default App;
- Run
npx react-native run-macos
Expected Behavior
The text state should change when I hover my mouse into and out of the red 100x100 box view, and when i start typing in the textInput and during keyDown when the box is focused
Screen.Recording.2025-12-19.at.12.50.22.mov
Actual Behavior
The text state does not change, from which I infer that the mouse and keyboard events are not working.
The exact same code does provide the expected results on windows however (react-native@0.79.4 and react-native-windows@0.79.4)
Screen.Recording.2025-12-19.at.12.51.50.mov
Reproducible Demo
Additional context
No response