File tree Expand file tree Collapse file tree 3 files changed +37
-5
lines changed Expand file tree Collapse file tree 3 files changed +37
-5
lines changed Original file line number Diff line number Diff line change 1
- # react-bottom-scroll-listener [ ![ NPM version] ( https://img.shields.io/npm/v/react-bottom-scroll-listener.svg?style=flat )] ( https://www.npmjs.com/package/react-bottom-scroll-listener ) ![ Gzipped size] ( https://img.shields.io/badge/gzipped-2.1kb-brightgreen.png )
1
+ # react-bottom-scroll-listener [ ![ NPM version] ( https://img.shields.io/npm/v/react-bottom-scroll-listener.svg?style=flat )] ( https://www.npmjs.com/package/react-bottom-scroll-listener ) [ ![ npm bundle size (minified) ] ( https://img.shields.io/bundlephobia/minzip/react-bottom-scroll-listener.svg )] ( https://github.com/karl-run/react-css-vars )
2
2
3
3
A simple React component that lets you listen for when you have scrolled to the bottom.
4
4
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import BottomScrollListerer from 'react-bottom-scroll-listener'
4
4
5
5
export default class App extends Component {
6
6
state = {
7
- alertOnBottom : false ,
7
+ alertOnBottom : true ,
8
8
}
9
9
10
10
handleToggleAlertOnBottom = ( ) => {
@@ -21,18 +21,22 @@ export default class App extends Component {
21
21
22
22
render ( ) {
23
23
return (
24
- < div >
24
+ < div className = "root" >
25
25
< label htmlFor = "alertToggle" >
26
26
< input
27
27
id = "alertToggle"
28
28
type = "checkbox"
29
29
checked = { this . state . alertOnBottom }
30
30
onChange = { this . handleToggleAlertOnBottom }
31
31
/>
32
- Show alert on bottom
32
+ < div > Show alert on bottom</ div >
33
33
</ label >
34
34
< BottomScrollListerer onBottom = { this . handleOnBottom } >
35
- < div style = { { height : '2000px' , backgroundColor : 'palevioletred' } } > Scroll down!</ div >
35
+ < div className = "scrollbox" >
36
+ < div > Scroll down! ▼▼▼</ div >
37
+ < div > A bit more... ▼▼</ div >
38
+ < div > Almost there... ▼</ div >
39
+ </ div >
36
40
</ BottomScrollListerer >
37
41
</ div >
38
42
)
Original file line number Diff line number Diff line change 3
3
padding : 0 ;
4
4
font-family : sans-serif;
5
5
}
6
+
7
+ .root {
8
+ background-color : paleturquoise;
9
+ }
10
+
11
+ .root > label > input {
12
+ margin : 8px ;
13
+ height : 24px ;
14
+ width : 24px ;
15
+ }
16
+
17
+ .root > label {
18
+ font-size : 16px ;
19
+ display : flex;
20
+ align-items : center;
21
+ }
22
+
23
+ .scrollbox {
24
+ margin : 16px ;
25
+ padding : 8px ;
26
+ height : 1500px ;
27
+ color : white;
28
+ background-color : palevioletred;
29
+ }
30
+
31
+ .scrollbox > div {
32
+ margin-bottom : 500px ;
33
+ }
You can’t perform that action at this time.
0 commit comments