From cd9bba4b69d1b5eeebae15544bb2aaa55f42873f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82da?= Date: Fri, 12 Jul 2024 04:42:41 +0200 Subject: [PATCH] Fix: emoji picker closes when hitting spacebar (#4422) (#4441) Co-authored-by: Hailey --- .../text-input/web/EmojiPicker.web.tsx | 44 ++++++++++--------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/src/view/com/composer/text-input/web/EmojiPicker.web.tsx b/src/view/com/composer/text-input/web/EmojiPicker.web.tsx index 14936211..1f4178f7 100644 --- a/src/view/com/composer/text-input/web/EmojiPicker.web.tsx +++ b/src/view/com/composer/text-input/web/EmojiPicker.web.tsx @@ -1,11 +1,13 @@ import React from 'react' -import Picker from '@emoji-mart/react' import { - StyleSheet, + GestureResponderEvent, TouchableWithoutFeedback, useWindowDimensions, View, } from 'react-native' +import Picker from '@emoji-mart/react' + +import {atoms as a} from '#/alf' import {textInputWebEmitter} from '../TextInput.web' const HEIGHT_OFFSET = 40 @@ -96,12 +98,29 @@ export function EmojiPicker({state, close}: IProps) { if (!state.isOpen) return null + const onPressBackdrop = (e: GestureResponderEvent) => { + // @ts-ignore web only + if (e.nativeEvent?.pointerId === -1) return + close() + } + return ( - + {/* eslint-disable-next-line react-native-a11y/has-valid-accessibility-descriptors */} e.stopPropagation()}> @@ -118,20 +137,3 @@ export function EmojiPicker({state, close}: IProps) { ) } - -const styles = StyleSheet.create({ - mask: { - // @ts-ignore web ony - position: 'fixed', - top: 0, - left: 0, - right: 0, - width: '100%', - height: '100%', - alignItems: 'center', - }, - picker: { - marginHorizontal: 'auto', - paddingRight: 50, - }, -})