@nativescript-use/nativescript-intersection-observer
Add a plugin description
npm i --save @nativescript-use/nativescript-intersection-observer
- Version: 0.0.2
- GitHub: https://github.com/NativeScript-Use/NativeScript-Use
- NPM: https://www.npmjs.com/package/%40nativescript-use%2Fnativescript-intersection-observer
- Downloads:
- Last Day: 0
- Last Week: 0
- Last Month: 0
@nativescript-use/nativescript-intersection-observer
npm install @nativescript-use/nativescript-intersection-observer
Usage
import { IntersectionObserver } from "@nativescript-use/nativescript-intersection-observer"
const intersectionObserver = new IntersectionObserver();
// Track if `targetView` is visible
intersectionObserver.track(targetView, scollView, (isVisible) => {
console.log("isVisible: " + isVisible);
})
// Stop track
intersectionObserver.stopTrack();
// Check if is visible view
const isVisible = intersectionObserver.isVisible(targetView, scollView);
Type declaration
```ts
export declare class IntersectionObserver {
track(view: View, parentView: ScrollView, callback: (isVisible: boolean) => void): void;
topTrack(parentView: ScrollView): void
isVisible(view: View, parentView?: View): boolean;
}
License
Apache License Version 2.0