Skip to content

Commit

Permalink
fix the scroll top issue on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
vj-abishek committed Apr 20, 2021
1 parent 5daf063 commit 8728c34
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 445 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"react-dom": "^16.12.0",
"react-error-boundary": "^3.0.2",
"react-helmet": "^6.0.0",
"react-infinite-scroll-component": "vj-abishek/react-infinite-scroll-component#mobile",
"react-infinite-scroll-component": "vj-abishek/react-infinite-scroll-component#mobile2",
"react-redux": "^7.2.0",
"react-router-dom": "^5.1.2",
"react-scripts": "^3.4.1",
Expand Down
9 changes: 6 additions & 3 deletions src/Components/Channel/Chat/Conversation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
InitSignal,
RecieveFile,
} from '../../../Store/Actions/Peer';
import { isMobile } from '../../Utils/helper';
import { isMobile, getChromeVersion } from '../../Utils/helper';

const Loader = () => (
<div className="flex flex-row justify-center items-center p-2 ">
Expand Down Expand Up @@ -114,7 +114,7 @@ function Conversation({
const { target } = e;

if (
isMobile &&
isMobile && (getChromeVersion() <= 80) &&
!(target.scrollTop + 50 >= target.scrollHeight - target.clientHeight)
) {
setAutoScroll((a) => {
Expand All @@ -132,7 +132,10 @@ function Conversation({
};

const handleClick = () => {
if (isMobile) {

const isOldMobileBrowser = isMobile && (getChromeVersion() <= 80);
console.log(getChromeVersion() <= 80)
if (isOldMobileBrowser) {
console.log('Inside', ChatBox.current.scrollHeight);
ChatBox.current.scrollTo(0, ChatBox.current.scrollHeight);
return;
Expand Down
Loading

1 comment on commit 8728c34

@vercel
Copy link

@vercel vercel bot commented on 8728c34 Apr 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.