refactor: better shortcut hook
This commit is contained in:
30
packages/ui/lib/shortcuts/Debug.tsx
Normal file
30
packages/ui/lib/shortcuts/Debug.tsx
Normal file
@@ -0,0 +1,30 @@
|
||||
import { useSyncExternalStore } from "react";
|
||||
import { View, Text } from "react-native";
|
||||
import { keysStore } from "./store";
|
||||
|
||||
export function ShortcutDebug() {
|
||||
const entries = useSyncExternalStore(
|
||||
keysStore.subscribe,
|
||||
keysStore.getSnapshot,
|
||||
);
|
||||
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
position: "absolute",
|
||||
zIndex: 100,
|
||||
bottom: 0,
|
||||
right: 0,
|
||||
backgroundColor: "black",
|
||||
}}
|
||||
>
|
||||
<Text style={{ color: "red", fontFamily: "mono" }}>
|
||||
{entries
|
||||
.values()
|
||||
.map(([key, _]) => key)
|
||||
.toArray()
|
||||
.join(",")}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user