Various improvements for scrollable lists on Android

This commit is contained in:
Alexander Zinchuk 2021-08-21 19:17:27 +03:00
parent ec0e3b2814
commit 86a0201d8a
11 changed files with 54 additions and 17 deletions

View File

@ -62,7 +62,7 @@
}
}
.chat-list, .RecentContacts, .LeftSearch, .search-content {
.RecentContacts, .LeftSearch, .search-content {
height: 100%;
overflow-y: auto;
}

View File

@ -73,8 +73,9 @@
.Menu .bubble {
min-width: 17rem;
max-height: calc(100 * var(--vh) - 3.75rem);
overflow-y: auto;
overflow-y: overlay;
@include overflow-y-overlay();
}
// @optimization

View File

@ -1,3 +1,5 @@
@import '../../../styles/mixins';
#Settings {
height: 100%;
@ -33,8 +35,9 @@
.settings-content {
background: var(--color-background);
height: calc(100% - var(--header-height));
overflow-y: auto;
overflow-y: overlay;
@include overflow-y-overlay();
&.infinite-scroll {
display: flex;

View File

@ -1,11 +1,15 @@
@import '../../styles/mixins';
.MessageList {
flex: 1;
width: 100%;
margin-bottom: .5rem;
overflow-anchor: none;
overflow: scroll;
overflow-x: hidden;
overflow-y: overlay;
margin-bottom: .5rem;
overflow-y: auto;
@include overflow-y-overlay();
.mask-image-enabled & {
mask-image: linear-gradient(to top, transparent 0, #000 0.5rem);

View File

@ -1,3 +1,5 @@
@import '../../../styles/mixins';
.Composer {
align-items: flex-end;
@ -442,9 +444,10 @@
border-radius: var(--border-radius-messages);
padding: 0.5rem 0;
max-height: 15rem;
overflow-x: hidden;
overflow-y: auto;
overflow-y: overlay;
@include overflow-y-overlay();
box-shadow: 0 1px 2px var(--color-default-shadow);

View File

@ -1,8 +1,11 @@
.EmojiTooltip {
display: flex;
padding-left: .25rem;
overflow-x: auto;
@supports (overflow-x: overlay) {
overflow-x: overlay;
}
overflow-y: hidden;
.EmojiButton {

View File

@ -1,9 +1,13 @@
@import '../../styles/mixins';
.Profile {
height: 100%;
display: flex;
flex-direction: column;
overflow-y: scroll;
overflow-x: hidden;
overflow-y: scroll;
@include overflow-y-overlay();
> .profile-info > .ChatInfo {
grid-area: chat_info;

View File

@ -21,6 +21,12 @@
}
}
body.is-ios &, body.is-android & {
&:not(:last-of-type)::after {
transform: scaleY(0.5);
}
}
.ListItem-button {
width: 100%;
background-color: var(--background-color);

View File

@ -1,3 +1,5 @@
@import './mixins';
// Common styles for all media-type components across the app.
.media-inner {
position: relative;
@ -67,9 +69,11 @@
.chat-list {
background: var(--color-background);
height: 100%;
overflow-y: auto;
padding: .5rem .125rem .5rem .4375rem;
overflow-y: auto;
@include overflow-y-overlay();
.scroll-container {
position: relative;
}

View File

@ -4,3 +4,14 @@
@content;
}
}
@mixin overflow-y-overlay() {
@supports (overflow-y: overlay) {
body.is-android & {
overflow-y: overlay;
//Workaround for Android <= 9
overflow-x: hidden;
}
}
}

View File

@ -1,4 +1,4 @@
import { IS_IOS, IS_TOUCH_ENV } from './environment';
import { IS_IOS } from './environment';
export enum SwipeDirection {
Up,
@ -104,7 +104,7 @@ export function captureEvents(element: HTMLElement, options: CaptureOptions) {
captureEvent = undefined;
if (options.selectorToPreventScroll) {
if (IS_IOS && options.selectorToPreventScroll) {
Array.from(document.querySelectorAll<HTMLElement>(options.selectorToPreventScroll)).forEach((scrollable) => {
scrollable.style.overflow = '';
});
@ -155,15 +155,13 @@ export function captureEvents(element: HTMLElement, options: CaptureOptions) {
shouldPreventScroll = hasSwiped;
}
if (IS_TOUCH_ENV && shouldPreventScroll && options.selectorToPreventScroll) {
if (options.selectorToPreventScroll) {
if (IS_IOS && shouldPreventScroll && options.selectorToPreventScroll) {
Array.from(document.querySelectorAll<HTMLElement>(options.selectorToPreventScroll)).forEach((scrollable) => {
scrollable.style.overflow = 'hidden';
});
}
}
}
}
function onSwipe(e: MouseEvent | RealTouchEvent, dragOffsetX: number, dragOffsetY: number) {
// Avoid conflicts with swipe-to-back gestures