[FIX] Emoji picker not opening in some cases (#4735)
This commit is contained in:
parent
a2722f07b0
commit
0290d8e0a9
|
@ -14,12 +14,12 @@ import { IEmoji, TAnyMessageModel } from '../../definitions';
|
||||||
import Touch from '../Touch';
|
import Touch from '../Touch';
|
||||||
|
|
||||||
export interface IHeader {
|
export interface IHeader {
|
||||||
handleReaction: (emoji: IEmoji, message: TAnyMessageModel) => void;
|
handleReaction: (emoji: IEmoji | null, message: TAnyMessageModel) => void;
|
||||||
message: TAnyMessageModel;
|
message: TAnyMessageModel;
|
||||||
isMasterDetail: boolean;
|
isMasterDetail: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
type TOnReaction = ({ emoji }: { emoji: IEmoji }) => void;
|
type TOnReaction = ({ emoji }: { emoji?: IEmoji }) => void;
|
||||||
|
|
||||||
interface THeaderItem {
|
interface THeaderItem {
|
||||||
item: IEmoji;
|
item: IEmoji;
|
||||||
|
@ -94,8 +94,10 @@ const Header = React.memo(({ handleReaction, message, isMasterDetail }: IHeader)
|
||||||
const quantity = Math.trunc(size / (ITEM_SIZE + ITEM_MARGIN * 2) - 1);
|
const quantity = Math.trunc(size / (ITEM_SIZE + ITEM_MARGIN * 2) - 1);
|
||||||
|
|
||||||
const onReaction: TOnReaction = ({ emoji }) => {
|
const onReaction: TOnReaction = ({ emoji }) => {
|
||||||
handleReaction(emoji, message);
|
handleReaction(emoji || null, message);
|
||||||
|
if (emoji) {
|
||||||
addFrequentlyUsed(emoji);
|
addFrequentlyUsed(emoji);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderItem = ({ item }: { item: IEmoji }) => <HeaderItem item={item} onReaction={onReaction} theme={theme} />;
|
const renderItem = ({ item }: { item: IEmoji }) => <HeaderItem item={item} onReaction={onReaction} theme={theme} />;
|
||||||
|
|
|
@ -285,10 +285,10 @@ const MessageActions = React.memo(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleReaction: IHeader['handleReaction'] = (shortname, message) => {
|
const handleReaction: IHeader['handleReaction'] = (emoji, message) => {
|
||||||
logEvent(events.ROOM_MSG_ACTION_REACTION);
|
logEvent(events.ROOM_MSG_ACTION_REACTION);
|
||||||
if (shortname) {
|
if (emoji) {
|
||||||
onReactionPress(shortname, message.id);
|
onReactionPress(emoji, message.id);
|
||||||
} else {
|
} else {
|
||||||
setTimeout(() => reactionInit(message), ACTION_SHEET_ANIMATION_DURATION);
|
setTimeout(() => reactionInit(message), ACTION_SHEET_ANIMATION_DURATION);
|
||||||
}
|
}
|
||||||
|
|
|
@ -833,6 +833,7 @@ class RoomView extends React.Component<IRoomViewProps, IRoomViewState> {
|
||||||
showReactionPicker = () => {
|
showReactionPicker = () => {
|
||||||
const { showActionSheet } = this.props;
|
const { showActionSheet } = this.props;
|
||||||
const { selectedMessage } = this.state;
|
const { selectedMessage } = this.state;
|
||||||
|
setTimeout(() => {
|
||||||
showActionSheet({
|
showActionSheet({
|
||||||
children: (
|
children: (
|
||||||
<ReactionPicker message={selectedMessage} onEmojiSelected={this.onReactionPress} reactionClose={this.onReactionClose} />
|
<ReactionPicker message={selectedMessage} onEmojiSelected={this.onReactionPress} reactionClose={this.onReactionClose} />
|
||||||
|
@ -840,6 +841,7 @@ class RoomView extends React.Component<IRoomViewProps, IRoomViewState> {
|
||||||
snaps: [400],
|
snaps: [400],
|
||||||
enableContentPanningGesture: false
|
enableContentPanningGesture: false
|
||||||
});
|
});
|
||||||
|
}, 100);
|
||||||
};
|
};
|
||||||
|
|
||||||
onReactionInit = (message: TAnyMessageModel) => {
|
onReactionInit = (message: TAnyMessageModel) => {
|
||||||
|
|
Loading…
Reference in New Issue