Not able to get any of the keyDown events triggered on virtual machine. #10822
Answered
by
chrisglein
gabimoncha
asked this question in
Q&A
-
Hi, I've been trying to console the keyboard props but with no success. Mouse events seem to work though. I've also tried the docs, which are using class syntax with no prevail import React from 'react';
import { StyleSheet, Text } from 'react-native';
import { HandledEventPhase, ViewWindows } from 'react-native-windows';
const App = () => {
const handledNativeKeyboardEvents = [
{
code: 'a',
handledEventPhase: HandledEventPhase.Capturing
},
{
code: 'A',
handledEventPhase: HandledEventPhase.Bubbling
}
];
const onMouseEnter = () => {
console.log('enter')
}
const onMouseLeave = () => {
console.log('Leave')
}
return (
<ViewWindows
onKeyDown={(e) => {
console.log({ e });
}}
onKeyDownCapture={(e) => {
console.log({ e });
}}
style={styles.container}
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
keyDownEvents={handledNativeKeyboardEvents}
keyUpEvents={handledNativeKeyboardEvents}
focusable
>
<Text style={styles.title}>Key test</Text>
</ViewWindows>
);
};
const styles = StyleSheet.create({
backgroundStyle: {
backgroundColor: 'black',
},
container: {
width: '100%',
height: '100%',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#ffffDD'
},
title: {
fontWeight: 'bold',
fontSize: 22,
color: 'black'
},
});
export default App; |
Beta Was this translation helpful? Give feedback.
Answered by
chrisglein
Nov 7, 2022
Replies: 1 comment 2 replies
-
By that I take it you were copying portions out of the docs? Which parts? If this isn't working however, that may be a bug. Going to convert this discussion to an issue. |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
chrisglein
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
By that I take it you were copying portions out of the docs? Which parts?
If this isn't working however, that may be a bug. Going to convert this discussion to an issue.