UNPKG

@applicaster/zapp-react-native-ui-components

Version:

Applicaster Zapp React Native ui components for the Quick Brick App

16 lines (12 loc) 581 B
import { Subject } from "rxjs"; import { throttleTime } from "rxjs/operators"; const SCROLL_END_THROTTLE_MS = 1000; const scrollEndReachedSubject = new Subject<void>(); /* Throttle so we only emit at most once per second; RN often fires onEndReached repeatedly (e.g. on Android) when near the bottom. */ export const scrollEndReached$ = scrollEndReachedSubject.pipe( throttleTime(SCROLL_END_THROTTLE_MS) ); /* Call from scroll container (ComponentsMap or Tabs) when scroll reaches end. */ export const emitScrollEndReached = (): void => { scrollEndReachedSubject.next(); };