andymatuschak / orbit

Experimental spaced repetition platform for exploring ideas in memory augmentation and programmable attention
https://withorbit.com
Other
1.71k stars 54 forks source link

Add support to useKeyDown for React Native targets #223

Closed andymatuschak closed 2 years ago

andymatuschak commented 3 years ago

In #218, @growthepie added some initial support for keyboard shortcuts in review sessions. We'll want that same support in the React Native apps, particularly the desktop app.

React Native does implement the onkeydown event on View, but our implementation of useKeyDown creates a global handler by adding the event handler to document. That won't work on React Native, so we'll need to either create some coordination at the root level (maybe with a Context or something), or else use something like react-native-keyevent which offers more control.