Added scroll to bottom arrows for mobile
Этот коммит содержится в:
@@ -23,6 +23,7 @@ export default class PostsView extends React.Component {
|
|||||||
this.createPosts = this.createPosts.bind(this);
|
this.createPosts = this.createPosts.bind(this);
|
||||||
this.updateScrolling = this.updateScrolling.bind(this);
|
this.updateScrolling = this.updateScrolling.bind(this);
|
||||||
this.handleResize = this.handleResize.bind(this);
|
this.handleResize = this.handleResize.bind(this);
|
||||||
|
this.scrollToBottom = this.scrollToBottom.bind(this);
|
||||||
|
|
||||||
this.jumpToPostNode = null;
|
this.jumpToPostNode = null;
|
||||||
this.wasAtBottom = true;
|
this.wasAtBottom = true;
|
||||||
@@ -283,9 +284,7 @@ export default class PostsView extends React.Component {
|
|||||||
}
|
}
|
||||||
updateScrolling() {
|
updateScrolling() {
|
||||||
if (this.props.scrollType === PostsView.SCROLL_TYPE_BOTTOM) {
|
if (this.props.scrollType === PostsView.SCROLL_TYPE_BOTTOM) {
|
||||||
window.requestAnimationFrame(() => {
|
this.scrollToBottom();
|
||||||
this.refs.postlist.scrollTop = this.refs.postlist.scrollHeight;
|
|
||||||
});
|
|
||||||
} else if (this.props.scrollType === PostsView.SCROLL_TYPE_NEW_MESSAGE) {
|
} else if (this.props.scrollType === PostsView.SCROLL_TYPE_NEW_MESSAGE) {
|
||||||
window.requestAnimationFrame(() => {
|
window.requestAnimationFrame(() => {
|
||||||
// If separator exists scroll to it. Otherwise scroll to bottom.
|
// If separator exists scroll to it. Otherwise scroll to bottom.
|
||||||
@@ -335,6 +334,11 @@ export default class PostsView extends React.Component {
|
|||||||
handleResize() {
|
handleResize() {
|
||||||
this.updateScrolling();
|
this.updateScrolling();
|
||||||
}
|
}
|
||||||
|
scrollToBottom() {
|
||||||
|
window.requestAnimationFrame(() => {
|
||||||
|
this.refs.postlist.scrollTop = this.refs.postlist.scrollHeight;
|
||||||
|
});
|
||||||
|
}
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
if (this.props.postList != null) {
|
if (this.props.postList != null) {
|
||||||
this.updateScrolling();
|
this.updateScrolling();
|
||||||
@@ -460,9 +464,26 @@ export default class PostsView extends React.Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let scrollToBottomArrows = null;
|
||||||
|
if ($(window).width() <= 768) {
|
||||||
|
let scrollToBottomArrowsClass = 'post-list__arrows';
|
||||||
|
if (this.state.isScrolling && !this.wasAtBottom) {
|
||||||
|
scrollToBottomArrowsClass += ' scrolling';
|
||||||
|
}
|
||||||
|
|
||||||
|
scrollToBottomArrows = (
|
||||||
|
<div
|
||||||
|
ref='postArrows'
|
||||||
|
className={scrollToBottomArrowsClass}
|
||||||
|
onClick={this.scrollToBottom}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={activeClass}>
|
<div className={activeClass}>
|
||||||
{floatingTimestamp}
|
{floatingTimestamp}
|
||||||
|
{scrollToBottomArrows}
|
||||||
<div
|
<div
|
||||||
ref='postlist'
|
ref='postlist'
|
||||||
className='post-list-holder-by-time'
|
className='post-list-holder-by-time'
|
||||||
|
|||||||
@@ -274,6 +274,24 @@ body.ios {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.post-list__arrows {
|
||||||
|
background: url('../images/postArrows.png') center;
|
||||||
|
@include background-size(28px 28px);
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 50px;
|
||||||
|
right: 5px;
|
||||||
|
z-index: 50;
|
||||||
|
@include opacity(0);
|
||||||
|
@include single-transition(all, 0.3s);
|
||||||
|
|
||||||
|
&.scrolling {
|
||||||
|
@include opacity(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.post-create__container {
|
.post-create__container {
|
||||||
form {
|
form {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
Двоичные данные
web/static/images/postArrows.png
Обычный файл
Двоичные данные
web/static/images/postArrows.png
Обычный файл
Двоичный файл не отображается.
|
После Ширина: | Высота: | Размер: 5.6 KiB |
Ссылка в новой задаче
Block a user