react-smart-scroll
Advanced tools
Comparing version 1.2.5 to 1.3.0
{ | ||
"name": "react-smart-scroll", | ||
"version": "1.2.5", | ||
"version": "1.3.0", | ||
"description": "Smart Scroll React Component for long lists", | ||
@@ -60,4 +60,4 @@ "author": "Steven Sacks", | ||
"peerDependencies": { | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2" | ||
"react": "^16.8.0 | ^17.0.2", | ||
"react-dom": "^16.8.0 | ^17.0.2" | ||
}, | ||
@@ -64,0 +64,0 @@ "eslintConfig": { |
@@ -38,4 +38,17 @@ # react-smart-scroll | ||
### TypeScript | ||
Typing for your row components is included as a named export. | ||
```typescript jsx | ||
import {ReactSmartScrollRow} from 'react-smart-scroll'; | ||
const TypedTestRow: ReactSmartScrollRow = ({data, rowRef}) => ( | ||
<div ref={rowRef}> | ||
{data.text} | ||
</div> | ||
); | ||
``` | ||
### Working Demo with variable height rows: | ||
https://codesandbox.io/s/react-smart-scroll-demo-3x1ym | ||
* [JavaScript Demo](https://codesandbox.io/s/react-smart-scroll-demo-3x1ym) | ||
* [TypeScript Demo](https://codesandbox.io/s/react-smart-scroll-ts-demo-9p3kz) | ||
@@ -69,3 +82,3 @@ **This component uses React Hooks, so it requires React 16.8.x or above.** | ||
```javascript | ||
import ReactSmartScroll from 'react-smart-scroll'; | ||
import ReactSmartScroll, {ReactSmartScrollRow} from 'react-smart-scroll'; | ||
@@ -82,3 +95,3 @@ <ReactSmartScroll | ||
const TestRow = ({data, height, label, onClick, rowIndex, rowRef}) => ( | ||
const TestRow: ReactSmartScrollRow = ({data, height, label, onClick, rowIndex, rowRef}) => ( | ||
<div ref={rowRef} className="test-row" onClick={() => onClick(rowIndex)}> | ||
@@ -85,0 +98,0 @@ <strong>[{data.id}]</strong>: {height}px<br/> |
58809
136