Horje
how to detect onend reach of scrollview in react native Code Example
how to detect onend reach of scrollview in react native
import React from 'react';
import {ScrollView, Text} from 'react-native';

const isCloseToBottom = ({layoutMeasurement, contentOffset, contentSize}) => {
  const paddingToBottom = 20;
  return layoutMeasurement.height + contentOffset.y >=
    contentSize.height - paddingToBottom;
};

const MyCoolScrollViewComponent = ({enableSomeButton}) => (
  <ScrollView
    onScroll={({nativeEvent}) => {
      if (isCloseToBottom(nativeEvent)) {
        enableSomeButton();
      }
    }}
    scrollEventThrottle={400}
  >
    <Text>Here is very long lorem ipsum or something...</Text>
  </ScrollView>
);

export default MyCoolScrollViewComponent;




Javascript

Related
javascript check if variable is number Code Example javascript check if variable is number Code Example
javascript average of arguments Code Example javascript average of arguments Code Example
angular add font Code Example angular add font Code Example
javascript if field exists Code Example javascript if field exists Code Example
test if property exists javascript Code Example test if property exists javascript Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7