Skip to content

Commit

Permalink
Fix emoji picker position (#7146)
Browse files Browse the repository at this point in the history
  • Loading branch information
estrattonbailey authored Dec 18, 2024
1 parent 65d4416 commit a07949e
Showing 1 changed file with 37 additions and 34 deletions.
71 changes: 37 additions & 34 deletions src/view/com/composer/text-input/web/EmojiPicker.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {DismissableLayer} from '@radix-ui/react-dismissable-layer'

import {textInputWebEmitter} from '#/view/com/composer/text-input/textInputWebEmitter'
import {atoms as a} from '#/alf'
import {Portal} from '#/components/Portal'

const HEIGHT_OFFSET = 40
const WIDTH_OFFSET = 100
Expand Down Expand Up @@ -125,39 +126,41 @@ export function EmojiPicker({state, close, pinToTop}: IProps) {
}

return (
<TouchableWithoutFeedback
accessibilityRole="button"
onPress={onPressBackdrop}
accessibilityViewIsModal>
<View
style={[
a.fixed,
a.w_full,
a.h_full,
a.align_center,
{
top: 0,
left: 0,
right: 0,
},
]}>
{/* eslint-disable-next-line react-native-a11y/has-valid-accessibility-descriptors */}
<TouchableWithoutFeedback onPress={e => e.stopPropagation()}>
<View style={[{position: 'absolute'}, position]}>
<DismissableLayer
onFocusOutside={evt => evt.preventDefault()}
onDismiss={close}>
<Picker
data={async () => {
return (await import('./EmojiPickerData.json')).default
}}
onEmojiSelect={onInsert}
autoFocus={true}
/>
</DismissableLayer>
</View>
</TouchableWithoutFeedback>
</View>
</TouchableWithoutFeedback>
<Portal>
<TouchableWithoutFeedback
accessibilityRole="button"
onPress={onPressBackdrop}
accessibilityViewIsModal>
<View
style={[
a.fixed,
a.w_full,
a.h_full,
a.align_center,
{
top: 0,
left: 0,
right: 0,
},
]}>
{/* eslint-disable-next-line react-native-a11y/has-valid-accessibility-descriptors */}
<TouchableWithoutFeedback onPress={e => e.stopPropagation()}>
<View style={[{position: 'absolute'}, position]}>
<DismissableLayer
onFocusOutside={evt => evt.preventDefault()}
onDismiss={close}>
<Picker
data={async () => {
return (await import('./EmojiPickerData.json')).default
}}
onEmojiSelect={onInsert}
autoFocus={true}
/>
</DismissableLayer>
</View>
</TouchableWithoutFeedback>
</View>
</TouchableWithoutFeedback>
</Portal>
)
}

0 comments on commit a07949e

Please sign in to comment.