Fix Emoji picker focus (#7217)
* Only portal the emoji picker where needed * Add optional portal prop to emoji picker * Use FocusScope to our advantage * Pare back, add guards, fix focus trap * Don't return focus to emoji button * Set DM input position on emoji insert * Let the caller determine next focus node --------- Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
This commit is contained in:
@@ -530,7 +530,14 @@ export const ComposePost = ({
|
||||
}
|
||||
|
||||
const onEmojiButtonPress = useCallback(() => {
|
||||
openEmojiPicker?.(textInput.current?.getCursorPosition())
|
||||
const rect = textInput.current?.getCursorPosition()
|
||||
if (rect) {
|
||||
openEmojiPicker?.({
|
||||
...rect,
|
||||
nextFocusRef:
|
||||
textInput as unknown as React.MutableRefObject<HTMLElement>,
|
||||
})
|
||||
}
|
||||
}, [openEmojiPicker])
|
||||
|
||||
const scrollViewRef = useAnimatedRef<Animated.ScrollView>()
|
||||
|
||||
Reference in New Issue
Block a user