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 )
22
33A simple React component that lets you listen for when you have scrolled to the bottom.
44
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import BottomScrollListerer from 'react-bottom-scroll-listener'
44
55export default class App extends Component {
66 state = {
7- alertOnBottom : false ,
7+ alertOnBottom : true ,
88 }
99
1010 handleToggleAlertOnBottom = ( ) => {
@@ -21,18 +21,22 @@ export default class App extends Component {
2121
2222 render ( ) {
2323 return (
24- < div >
24+ < div className = "root" >
2525 < label htmlFor = "alertToggle" >
2626 < input
2727 id = "alertToggle"
2828 type = "checkbox"
2929 checked = { this . state . alertOnBottom }
3030 onChange = { this . handleToggleAlertOnBottom }
3131 />
32- Show alert on bottom
32+ < div > Show alert on bottom</ div >
3333 </ label >
3434 < 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 >
3640 </ BottomScrollListerer >
3741 </ div >
3842 )
Original file line number Diff line number Diff line change 33 padding : 0 ;
44 font-family : sans-serif;
55}
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