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%; height: 100%;
overflow-y: auto; overflow-y: auto;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,9 +1,13 @@
@import '../../styles/mixins';
.Profile { .Profile {
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow-y: scroll;
overflow-x: hidden; overflow-x: hidden;
overflow-y: scroll;
@include overflow-y-overlay();
> .profile-info > .ChatInfo { > .profile-info > .ChatInfo {
grid-area: chat_info; 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 { .ListItem-button {
width: 100%; width: 100%;
background-color: var(--background-color); background-color: var(--background-color);

View File

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

View File

@ -4,3 +4,14 @@
@content; @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 { export enum SwipeDirection {
Up, Up,
@ -104,7 +104,7 @@ export function captureEvents(element: HTMLElement, options: CaptureOptions) {
captureEvent = undefined; captureEvent = undefined;
if (options.selectorToPreventScroll) { if (IS_IOS && options.selectorToPreventScroll) {
Array.from(document.querySelectorAll<HTMLElement>(options.selectorToPreventScroll)).forEach((scrollable) => { Array.from(document.querySelectorAll<HTMLElement>(options.selectorToPreventScroll)).forEach((scrollable) => {
scrollable.style.overflow = ''; scrollable.style.overflow = '';
}); });
@ -155,12 +155,10 @@ export function captureEvents(element: HTMLElement, options: CaptureOptions) {
shouldPreventScroll = hasSwiped; shouldPreventScroll = hasSwiped;
} }
if (IS_TOUCH_ENV && shouldPreventScroll && options.selectorToPreventScroll) { if (IS_IOS && shouldPreventScroll && options.selectorToPreventScroll) {
if (options.selectorToPreventScroll) { Array.from(document.querySelectorAll<HTMLElement>(options.selectorToPreventScroll)).forEach((scrollable) => {
Array.from(document.querySelectorAll<HTMLElement>(options.selectorToPreventScroll)).forEach((scrollable) => { scrollable.style.overflow = 'hidden';
scrollable.style.overflow = 'hidden'; });
});
}
} }
} }
} }