-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathBasicScrollToBottom.js
More file actions
81 lines (73 loc) · 2.12 KB
/
BasicScrollToBottom.js
File metadata and controls
81 lines (73 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import classNames from 'classnames';
import PropTypes from 'prop-types';
import React from 'react';
import AutoHideFollowButton from './ScrollToBottom/AutoHideFollowButton';
import Composer from './ScrollToBottom/Composer';
import Panel from './ScrollToBottom/Panel';
import useStyleToClassName from './hooks/internal/useStyleToClassName';
const ROOT_STYLE = {
position: 'relative'
};
const BasicScrollToBottomCore = ({ children, className, followButtonClassName, scrollViewClassName }) => {
const rootCSS = useStyleToClassName()(ROOT_STYLE);
return (
<div className={classNames(rootCSS, (className || '') + '')}>
<Panel className={(scrollViewClassName || '') + ''}>{children}</Panel>
<AutoHideFollowButton className={(followButtonClassName || '') + ''} />
</div>
);
};
BasicScrollToBottomCore.propTypes = {
children: PropTypes.any,
className: PropTypes.string,
followButtonClassName: PropTypes.string,
scrollViewClassName: PropTypes.string
};
const BasicScrollToBottom = ({
checkInterval,
children,
className,
debounce,
debug,
followButtonClassName,
initialScrollBehavior = 'smooth',
mode,
nonce,
scroller,
scrollViewClassName,
styleOptions
}) => (
<Composer
checkInterval={checkInterval}
debounce={debounce}
debug={debug}
initialScrollBehavior={initialScrollBehavior}
mode={mode}
nonce={nonce}
scroller={scroller}
styleOptions={styleOptions}
>
<BasicScrollToBottomCore
className={className}
followButtonClassName={followButtonClassName}
scrollViewClassName={scrollViewClassName}
>
{children}
</BasicScrollToBottomCore>
</Composer>
);
BasicScrollToBottom.propTypes = {
checkInterval: PropTypes.number,
children: PropTypes.any,
className: PropTypes.string,
debounce: PropTypes.number,
debug: PropTypes.bool,
followButtonClassName: PropTypes.string,
initialScrollBehavior: PropTypes.oneOf(['auto', 'smooth']),
mode: PropTypes.oneOf(['bottom', 'top']),
nonce: PropTypes.string,
scroller: PropTypes.func,
scrollViewClassName: PropTypes.string,
styleOptions: PropTypes.any
};
export default BasicScrollToBottom;