MCPcopy Create free account
hub / github.com/PatoSala/react-native-blocks / handleKeyPress

Function handleKeyPress

packages/core/src/hooks/useDetectKeyPress.ts:14–22  ·  view source on GitHub ↗
({ nativeEvent })

Source from the content-addressed store, hash-verified

12 const [isPressed, setIsPressed] = useState(false);
13
14 const handleKeyPress = ({ nativeEvent }) => {
15 if (nativeEvent.key === key) {
16 setIsPressed(true);
17 // Perform actions when Delete or Backspace is pressed
18 console.log('Delete or Backspace key pressed!');
19 } else {
20 setIsPressed(false);
21 }
22 };
23
24 return {
25 isPressed,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected