How to show scrollToBottom in a ScrollView when user is not at the bottom of screen - React Native

Solution 1:

Okay, the temporary solution is just create a state and do conditional rendering. (I think this approach would be not optimum because we would be setting state everytime the user scrolls up or whenever onScroll triggers).

const [isScrolling, setIsScrolling] = useState(false);
<ScrollView
  ref={scrollViewRef}
  onScroll={({nativeEvent}) => {
    const isCloseToBottom = nativeEvent.layoutMeasurement.height + nativeEvent.contentOffset.y > nativeEvent.contentSize.height - 30;
    if (!isCloseToBottom) {
      setIsScrolling(true);
    } else setIsScrolling(false);
  }}
>
...
</ScrollView>

{
  isScrolling && // return your component here...
}