Skip to content

Commit

Permalink
On thread open close the emoji picker
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajat-Dabade committed Aug 28, 2024
1 parent 6b4dc17 commit 117643b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
20 changes: 11 additions & 9 deletions app/components/post_draft/custom_emoji_picker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,17 @@ const CustomEmojiPicker: React.FC<Props> = ({

useEffect(() => {
const closeEmojiPicker = DeviceEventEmitter.addListener(Events.CLOSE_EMOJI_PICKER, () => {
height.value = withTiming(0, {
duration: 100,
easing: Easing.inOut(Easing.ease),
// eslint-disable-next-line max-nested-callbacks
}, (finished) => {
if (finished) {
runOnJS(setIsEmojiPickerOpen)(false);
}
});
if (!isEmojiSearchFocused) {
height.value = withTiming(0, {
duration: 300,
easing: Easing.inOut(Easing.ease),
// eslint-disable-next-line max-nested-callbacks
}, (finished) => {
if (finished) {
runOnJS(setIsEmojiPickerOpen)(false);
}
});
}
});

return () => {
Expand Down
4 changes: 3 additions & 1 deletion app/components/post_list/post/post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@

import React, {type ReactNode, useEffect, useMemo, useRef, useState} from 'react';
import {useIntl} from 'react-intl';
import {Keyboard, Platform, type StyleProp, View, type ViewStyle, TouchableHighlight} from 'react-native';
import {Keyboard, Platform, type StyleProp, View, type ViewStyle, TouchableHighlight, DeviceEventEmitter} from 'react-native';

import {removePost} from '@actions/local/post';
import {showPermalink} from '@actions/remote/permalink';
import {fetchAndSwitchToThread} from '@actions/remote/thread';
import {Events} from '@app/constants';
import CallsCustomMessage from '@calls/components/calls_custom_message';
import {isCallsCustomMessage} from '@calls/utils';
import SystemAvatar from '@components/system_avatar';
Expand Down Expand Up @@ -202,6 +203,7 @@ const Post = ({

if (post) {
Keyboard.dismiss();
DeviceEventEmitter.emit(Events.CLOSE_EMOJI_PICKER);

setTimeout(handlePostPress, 300);
}
Expand Down

0 comments on commit 117643b

Please sign in to comment.