about summary refs log tree commit diff
path: root/src/view/com/util/EventStopper.tsx
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2024-03-08 14:45:59 -0600
committerGitHub <noreply@github.com>2024-03-08 14:45:59 -0600
commit8f623c3bdf8dbbdc4c4f10f19b0b2c134b4160cb (patch)
tree40aee1909e199d18b95d44eb72eb91fc1648912a /src/view/com/util/EventStopper.tsx
parentdd86d0964d391e9748843aa1a6400d73c3a6d9f9 (diff)
downloadvoidsky-8f623c3bdf8dbbdc4c4f10f19b0b2c134b4160cb.tar.zst
Refactor `PostDropdownBtn` to use new `Menu` (#3112)
* Refactor PostDropdownBtn

(cherry picked from commit 0adf6cb75e3d4b7c1630cf6153c0d7e289e1b859)

* Update icons

(cherry picked from commit ac89ef9b28721c00736b1388455f3f5f092de0ad)

* Port over fixes

* fix scrollbar disappearing

* Try CSS solution

* Disable arrow for now

---------

Co-authored-by: Hailey <me@haileyok.com>
Diffstat (limited to 'src/view/com/util/EventStopper.tsx')
-rw-r--r--src/view/com/util/EventStopper.tsx11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/view/com/util/EventStopper.tsx b/src/view/com/util/EventStopper.tsx
index e743e89bb..8f5f5cf54 100644
--- a/src/view/com/util/EventStopper.tsx
+++ b/src/view/com/util/EventStopper.tsx
@@ -8,7 +8,14 @@ import {View, ViewStyle} from 'react-native'
 export function EventStopper({
   children,
   style,
-}: React.PropsWithChildren<{style?: ViewStyle | ViewStyle[]}>) {
+  onKeyDown = true,
+}: React.PropsWithChildren<{
+  style?: ViewStyle | ViewStyle[]
+  /**
+   * Default `true`. Set to `false` to allow onKeyDown to propagate
+   */
+  onKeyDown?: boolean
+}>) {
   const stop = (e: any) => {
     e.stopPropagation()
   }
@@ -18,7 +25,7 @@ export function EventStopper({
       onTouchEnd={stop}
       // @ts-ignore web only -prf
       onClick={stop}
-      onKeyDown={stop}
+      onKeyDown={onKeyDown ? stop : undefined}
       style={style}>
       {children}
     </View>