about summary refs log tree commit diff
path: root/src/components/hooks/useOnKeyboard.ts
diff options
context:
space:
mode:
authorHailey <me@haileyok.com>2024-03-20 17:26:38 -0700
committerGitHub <noreply@github.com>2024-03-20 17:26:38 -0700
commitad3dd9f6dccaa4b73da0000f41f23ac2fea5d1b2 (patch)
tree15ead3dd8c57511472b70d7528a5fda1e76ad756 /src/components/hooks/useOnKeyboard.ts
parentc649ee1afa80f71f108187df5671ae85eeaeed99 (diff)
downloadvoidsky-ad3dd9f6dccaa4b73da0000f41f23ac2fea5d1b2.tar.zst
Fix problems with `BottomSheet` and the report dialog (#3297)
* use @discord/bottom-sheet

* add @types/invariant

* some progress on keyboard dialog

* rework

rework

add a comment

use discord bottom sheet

* remove `@gorhom/bottom-sheet`

* remove android specific code

* organize imports
Diffstat (limited to 'src/components/hooks/useOnKeyboard.ts')
-rw-r--r--src/components/hooks/useOnKeyboard.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/components/hooks/useOnKeyboard.ts b/src/components/hooks/useOnKeyboard.ts
new file mode 100644
index 000000000..5de681a42
--- /dev/null
+++ b/src/components/hooks/useOnKeyboard.ts
@@ -0,0 +1,12 @@
+import React from 'react'
+import {Keyboard} from 'react-native'
+
+export function useOnKeyboardDidShow(cb: () => unknown) {
+  React.useEffect(() => {
+    const subscription = Keyboard.addListener('keyboardDidShow', cb)
+
+    return () => {
+      subscription.remove()
+    }
+  }, [cb])
+}