mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 00:07:07 +00:00
Merge pull request #28493 from JRasmusBm/master
Create Type Definitions for react-visibility-sensor
This commit is contained in:
+40
@@ -0,0 +1,40 @@
|
||||
// Type definitions for react-visibility-sensor 3.11
|
||||
// Project: https://github.com/joshwnj/react-visibility-sensor#readme
|
||||
// Definitions by: Rasmus Bergström <https://github.com/JRasmusBm>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import * as React from "react";
|
||||
|
||||
export as namespace ReactVisibilitySensor;
|
||||
|
||||
interface Shape {
|
||||
top?: number;
|
||||
left?: number;
|
||||
bottom?: number;
|
||||
right?: number;
|
||||
}
|
||||
|
||||
interface Props {
|
||||
onChange: (isVisible: boolean, visibilityRect?: Shape) => void;
|
||||
active?: boolean;
|
||||
partialVisibility?: boolean;
|
||||
offset?: Shape;
|
||||
minTopValue?: number;
|
||||
intervalCheck?: boolean;
|
||||
intervalDelay?: number;
|
||||
scrollCheck?: boolean;
|
||||
scrollDelay?: number;
|
||||
scrollThrottle?: number;
|
||||
resizeCheck?: boolean;
|
||||
resizeDelay?: number;
|
||||
resizeThrottle?: number;
|
||||
delayedCall?: boolean;
|
||||
children?: (
|
||||
args: { isVisible: boolean; visibilityRect?: Shape }
|
||||
) => React.ReactNode;
|
||||
}
|
||||
|
||||
declare const ReactVisibilitySensor: React.StatelessComponent<Props>;
|
||||
|
||||
export = ReactVisibilitySensor;
|
||||
@@ -0,0 +1,27 @@
|
||||
import * as React from "react";
|
||||
|
||||
import * as ReactVisibilitySensor from "react-visibility-sensor";
|
||||
|
||||
const num = 1;
|
||||
const bool = true;
|
||||
const shape = { top: num, left: num, bottom: num, right: num };
|
||||
|
||||
const component = (
|
||||
<ReactVisibilitySensor
|
||||
onChange={(bool, shape) => {}}
|
||||
active={bool}
|
||||
partialVisibility={bool}
|
||||
offset={shape}
|
||||
minTopValue={num}
|
||||
intervalCheck={bool}
|
||||
intervalDelay={num}
|
||||
scrollCheck={bool}
|
||||
scrollDelay={num}
|
||||
scrollThrottle={num}
|
||||
resizeCheck={bool}
|
||||
resizeDelay={num}
|
||||
resizeThrottle={num}
|
||||
delayedCall={bool}>
|
||||
{({ isVisible: bool, visibilityRect: shape }) => <div />}
|
||||
</ReactVisibilitySensor>
|
||||
);
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es7", "dom"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"jsx": "react",
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "react-visibility-sensor-tests.tsx"]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user