Action Message: Fix scroll calculation (#5729)
This commit is contained in:
parent
2e39a15660
commit
370aa67112
@ -6,6 +6,7 @@ import { getActions, withGlobal } from '../../../global';
|
|||||||
import type { ApiMessageAction } from '../../../api/types/messageActions';
|
import type { ApiMessageAction } from '../../../api/types/messageActions';
|
||||||
import type {
|
import type {
|
||||||
FocusDirection,
|
FocusDirection,
|
||||||
|
ScrollTargetPosition,
|
||||||
ThreadId,
|
ThreadId,
|
||||||
} from '../../../types';
|
} from '../../../types';
|
||||||
import type { Signal } from '../../../util/signals';
|
import type { Signal } from '../../../util/signals';
|
||||||
@ -82,6 +83,8 @@ type StateProps = {
|
|||||||
isCurrentUserPremium?: boolean;
|
isCurrentUserPremium?: boolean;
|
||||||
isInSelectMode?: boolean;
|
isInSelectMode?: boolean;
|
||||||
hasUnreadReaction?: boolean;
|
hasUnreadReaction?: boolean;
|
||||||
|
isResizingContainer?: boolean;
|
||||||
|
scrollTargetPosition?: ScrollTargetPosition;
|
||||||
};
|
};
|
||||||
|
|
||||||
const SINGLE_LINE_ACTIONS: Set<ApiMessageAction['type']> = new Set([
|
const SINGLE_LINE_ACTIONS: Set<ApiMessageAction['type']> = new Set([
|
||||||
@ -111,6 +114,8 @@ const ActionMessage = ({
|
|||||||
isCurrentUserPremium,
|
isCurrentUserPremium,
|
||||||
isInSelectMode,
|
isInSelectMode,
|
||||||
hasUnreadReaction,
|
hasUnreadReaction,
|
||||||
|
isResizingContainer,
|
||||||
|
scrollTargetPosition,
|
||||||
onIntersectPinnedMessage,
|
onIntersectPinnedMessage,
|
||||||
observeIntersectionForBottom,
|
observeIntersectionForBottom,
|
||||||
observeIntersectionForLoading,
|
observeIntersectionForLoading,
|
||||||
@ -162,11 +167,13 @@ const ActionMessage = ({
|
|||||||
);
|
);
|
||||||
useFocusMessage({
|
useFocusMessage({
|
||||||
elementRef: ref,
|
elementRef: ref,
|
||||||
chatId: message.chatId,
|
chatId,
|
||||||
isFocused,
|
isFocused,
|
||||||
focusDirection,
|
focusDirection,
|
||||||
noFocusHighlight,
|
noFocusHighlight,
|
||||||
|
isResizingContainer,
|
||||||
isJustAdded,
|
isJustAdded,
|
||||||
|
scrollTargetPosition,
|
||||||
});
|
});
|
||||||
|
|
||||||
useUnmountCleanup(() => {
|
useUnmountCleanup(() => {
|
||||||
@ -389,6 +396,7 @@ const ActionMessage = ({
|
|||||||
id={getMessageHtmlId(id)}
|
id={getMessageHtmlId(id)}
|
||||||
className={buildClassName(
|
className={buildClassName(
|
||||||
'ActionMessage',
|
'ActionMessage',
|
||||||
|
'message-list-item',
|
||||||
styles.root,
|
styles.root,
|
||||||
isSingleLine && styles.singleLine,
|
isSingleLine && styles.singleLine,
|
||||||
isFluidMultiline && styles.fluidMultiline,
|
isFluidMultiline && styles.fluidMultiline,
|
||||||
@ -463,6 +471,7 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
const {
|
const {
|
||||||
direction: focusDirection,
|
direction: focusDirection,
|
||||||
noHighlight: noFocusHighlight,
|
noHighlight: noFocusHighlight,
|
||||||
|
isResizingContainer, scrollTargetPosition,
|
||||||
} = (isFocused && tabState.focusedMessage) || {};
|
} = (isFocused && tabState.focusedMessage) || {};
|
||||||
|
|
||||||
const isCurrentUserPremium = selectIsCurrentUserPremium(global);
|
const isCurrentUserPremium = selectIsCurrentUserPremium(global);
|
||||||
@ -481,6 +490,8 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
isInSelectMode: selectIsInSelectMode(global),
|
isInSelectMode: selectIsInSelectMode(global),
|
||||||
patternColor: themes[selectTheme(global)]?.patternColor,
|
patternColor: themes[selectTheme(global)]?.patternColor,
|
||||||
hasUnreadReaction,
|
hasUnreadReaction,
|
||||||
|
isResizingContainer,
|
||||||
|
scrollTargetPosition,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
)(ActionMessage));
|
)(ActionMessage));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user