Scroll to an element within a list easily 😃
A common ui scenario is a list with some items. User should be able to move on next item in the list on some keypress (e.g on down arrow click) and the scroll should move to that element too. In order to achieve that with react, a ref should be kept for every list item in order to move scroll to that item. This library makes this task easy to achieve.
import React useRef useState from 'react'const emojis ="😀 Grinning Face""😃 Grinning Face With Big Eyes""😄 Grinning Face With Smiling Eyes"const App =const ref =const currentScrollIndex setCurrentScrollIndex =return<><ScrollView =><div ="list-container">emojis</div></ScrollView><button = >Scroll to Previous</button><button = >Scroll to Next</button><button = >Scroll to fifth Item</button></>
yarn add @elissaioskon/scrollable-list
npm install @elissaioskon/scrollable-list