Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/smart-components/App/stories/index.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,24 @@ const CustomApp = () => {

export const customer1 = () => fitPageSize(<CustomApp />);

export const customer2 = () => (
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you make it obvious(rename customer2 to something else) so that its easier to understand this is a page with scroll?

<div style={{ height: '2000px', width: '100vw', backgroundColor: 'gray', position: 'relative', display: 'flex', justifyContent: 'center'}}>
<div style={{ height: '100vh', width: '90vw', position: 'relative', top: '200px' }}>
<App
appId={appId}
userId={array[0]}
nickname={array[0]}
profileUrl={addProfile}
showSearchIcon
allowProfileEdit
config={{ logLevel: 'all' }}
queries={{}}
replyType="QUOTE_REPLY"
/>
</div>
</div>
);

export const disableUserProfile = () => fitPageSize(
<App
showSearchIcon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ export default class ConversationScroll extends Component {
onScroll(([messages]) => {
if (messages) {
// https://github.com/scabbiaza/react-scroll-position-on-updating-dom
// Set block to nearest to prevent unexpected scrolling from outer components
try {
first.scrollIntoView();
first.scrollIntoView({ block: 'nearest' });
} catch (error) {
//
}
Expand All @@ -71,7 +72,7 @@ export default class ConversationScroll extends Component {
if (messages) {
// https://github.com/scabbiaza/react-scroll-position-on-updating-dom
try {
last.scrollIntoView();
last.scrollIntoView({ block: 'nearest' });
} catch (error) {
//
}
Expand Down
5 changes: 5 additions & 0 deletions src/ui/ContextMenu/index.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
@import '../../styles/variables';

body.sendbird-emoji-list-pop-up,
body.sendbird-menu-items-pop-up {
overflow: hidden !important;
}

.sendbird__offline {
.sendbird-dropdown__menu .sendbird-dropdown__menu-item {
cursor: not-allowed;
Expand Down
7 changes: 7 additions & 0 deletions src/ui/ContextMenu/items/EmojiListItems.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ import PropTypes from 'prop-types';

import SortByRow from '../../SortByRow';

const EMOJI_LIST_POP_UP = 'sendbird-emoji-list-pop-up';

export default class EmojiListItems extends Component {
constructor(props) {
super(props);
this.reactionRef = React.createRef();
this.rootForPopup = document.body;
this.state = {
reactionStyle: {},
handleClickOutside: () => { },
Expand All @@ -18,11 +21,15 @@ export default class EmojiListItems extends Component {
this.setupEvents();
this.getBarPosition();
this.showParent();
// add className to body
this.rootForPopup.className = `${EMOJI_LIST_POP_UP} ${this.rootForPopup.className}`;
}

componentWillUnmount() {
this.cleanUpEvents();
this.hideParent();
// remove className from body
this.rootForPopup.className = this.rootForPopup.className.split(' ').filter((className) => className !== EMOJI_LIST_POP_UP).join(' ');
}

showParent = () => {
Expand Down
7 changes: 7 additions & 0 deletions src/ui/ContextMenu/items/MenuItems.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ import React, { Component } from 'react';
import { createPortal } from 'react-dom';
import PropTypes from 'prop-types';

const MENU_ITEMS_POP_UP = 'sendbird-menu-items-pop-up';

export default class MenuItems extends Component {
constructor(props) {
super(props);
this.menuRef = React.createRef();
this.rootForPopup = document.body;
this.state = {
menuStyle: {},
handleClickOutside: () => { },
Expand All @@ -16,11 +19,15 @@ export default class MenuItems extends Component {
this.setupEvents();
this.getMenuPosition();
this.showParent();
// add className to body
this.rootForPopup.className = `${MENU_ITEMS_POP_UP} ${this.rootForPopup.className}`;
}

componentWillUnmount() {
this.cleanUpEvents();
this.hideParent();
// remove className from body
this.rootForPopup.className = this.rootForPopup.className.split(' ').filter((className) => className !== MENU_ITEMS_POP_UP).join(' ');
}

showParent = () => {
Expand Down
10 changes: 9 additions & 1 deletion src/ui/Modal/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useContext } from 'react';
import React, { useContext, useEffect } from 'react';
import PropTypes from 'prop-types';
import { createPortal } from 'react-dom';

Expand Down Expand Up @@ -80,6 +80,14 @@ export default function Modal(props) {
hideFooter,
type,
} = props;
const { body } = document;
useEffect(() => {
body.className = `sendbird-modal-pop-up ${body.className}`;
return () => {
body.className = body.className.split(' ').filter((className) => className !== 'sendbird-modal-pop-up').join(' ');
};
}, []);

return createPortal((
<div className="sendbird-modal">
<div className="sendbird-modal__content">
Expand Down
4 changes: 4 additions & 0 deletions src/ui/Modal/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,7 @@
background-color: t(overlay-2);
}
}

body.sendbird-modal-pop-up {
overflow: hidden !important;
}