javascript
Get scrollview active index
const onScroll = (event) => {
const scrollActiveIndex = Math.round(event.nativeEvent.contentOffset.x / wp(100));
if (activeIndex !== scrollActiveIndex) {
setState(scrollActiveIndex)
}
};
Was this helpful?
Similar Posts
- Use jQuery to check if a tab is active/inactive
- Get index in map React
- Lodash - Get index of array item based on some condition
- Lodash - Get index of first occurence of an array value
- Lodash - Find item index from array by searching from the end
- Find the index of Max value in an array using Javascript
- Get Pseudo elements using Javascript
- Get all child elements of parent element in javascript