Skip to content

Commit

Permalink
feat(react): remove the smooth behavior in scrollIntoView function an…
Browse files Browse the repository at this point in the history
…d add it as a CSS property in the ScrollableMessageList component
  • Loading branch information
asastre committed Dec 20, 2024
1 parent d69ed11 commit 57ea791
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 10 deletions.
4 changes: 2 additions & 2 deletions packages/botonic-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@botonic/react",
"version": "0.30.7",
"version": "0.30.8-alpha.1",
"license": "MIT",
"description": "Build Chatbots using React",
"main": "./lib/cjs",
Expand All @@ -20,7 +20,7 @@
"lint_core": "../../node_modules/.bin/eslint_d --cache --quiet '.*.js' '*.js' 'src/**/*.js*' --fix"
},
"dependencies": {
"@botonic/core": "^0.30.0",
"@botonic/core": "^0.30.2",
"axios": "^1.7.2",
"emoji-picker-react": "^4.4.9",
"lodash.merge": "^4.6.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ import {
getWebchatElement,
} from '../../util/dom'

export const useScrollToBottom = ({
host,
behavior = 'smooth',
timeout = 200,
}) => {
export const useScrollToBottom = ({ host, timeout = 200 }) => {
const scrollToBottom = () => {
const webchatElement = getWebchatElement(host)
if (!webchatElement) return
Expand All @@ -17,7 +13,6 @@ export const useScrollToBottom = ({
setTimeout(() => {
scrollableMessagesListElement.scrollTo({
top: scrollableMessagesListElement.scrollHeight,
behavior: behavior as ScrollBehavior,
})
}, timeout)
}
Expand Down
2 changes: 0 additions & 2 deletions packages/botonic-react/src/webchat/message-list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ import { useNotifications } from './use-notifications'

const SCROLL_TIMEOUT = 200
const scrollOptionsEnd: ScrollIntoViewOptions = {
behavior: 'smooth',
block: 'end',
}
const scrollOptionsCenter: ScrollIntoViewOptions = {
behavior: 'smooth',
block: 'center',
}

Expand Down
1 change: 1 addition & 0 deletions packages/botonic-react/src/webchat/message-list/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@ export const ScrollableMessageList = styled.div`
overflow-y: auto;
overflow-x: hidden;
overscroll-behavior: contain; // https://css-tricks.com/almanac/properties/o/overscroll-behavior/
scroll-behavior: smooth;
-webkit-overflow-scrolling: touch;
`

0 comments on commit 57ea791

Please sign in to comment.