mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Type definitions for react-custom-scroll (#45628)
* Type definitions for react-custom-scroll * fix tests
This commit is contained in:
parent
b90d8ec168
commit
6df6e314df
31
types/react-custom-scroll/index.d.ts
vendored
Normal file
31
types/react-custom-scroll/index.d.ts
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
// Type definitions for react-custom-scroll 4.2
|
||||
// Project: https://github.com/rommguy/react-custom-scroll
|
||||
// Definitions by: Guy Romm <https://github.com/rommguy>
|
||||
// rvdende <https://github.com/rvdende>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.5
|
||||
|
||||
import { ComponentClass } from 'react';
|
||||
|
||||
/**
|
||||
* Props for a CustomScroll component.
|
||||
*/
|
||||
export interface CustomScrollProps {
|
||||
allowOuterScroll?: boolean;
|
||||
heightRelativeToParent?: string;
|
||||
flex?: number | string;
|
||||
onScoll?: (e?: any) => any;
|
||||
addScrolledClass?: boolean;
|
||||
freezePosition?: boolean;
|
||||
minScrollHandleHeight?: number;
|
||||
rtl?: boolean;
|
||||
scrollTo?: number;
|
||||
keepAtBottom?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Customize scrollbar design while using native scroll behavior.
|
||||
*/
|
||||
declare const CustomScroll: ComponentClass<CustomScrollProps>;
|
||||
|
||||
export default CustomScroll;
|
||||
29
types/react-custom-scroll/react-custom-scroll-tests.tsx
Normal file
29
types/react-custom-scroll/react-custom-scroll-tests.tsx
Normal file
@ -0,0 +1,29 @@
|
||||
import * as React from 'react';
|
||||
import CustomScroll from 'react-custom-scroll';
|
||||
|
||||
const onScrollStub = () => 1;
|
||||
export const _ = () => (
|
||||
<>
|
||||
<CustomScroll>
|
||||
<div>Test content</div>
|
||||
<div>Test content</div>
|
||||
</CustomScroll>
|
||||
,
|
||||
<CustomScroll
|
||||
heightRelativeToParent="50%"
|
||||
allowOuterScroll={false}
|
||||
flex={2}
|
||||
onScoll={onScrollStub}
|
||||
addScrolledClass={true}
|
||||
freezePosition={false}
|
||||
minScrollHandleHeight={50}
|
||||
rtl={false}
|
||||
scrollTo={20}
|
||||
keepAtBottom={false}
|
||||
>
|
||||
<div>Test content</div>
|
||||
<div>Test content</div>
|
||||
</CustomScroll>
|
||||
,
|
||||
</>
|
||||
);
|
||||
25
types/react-custom-scroll/tsconfig.json
Normal file
25
types/react-custom-scroll/tsconfig.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"jsx": "react",
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-custom-scroll-tests.tsx"
|
||||
]
|
||||
}
|
||||
5
types/react-custom-scroll/tslint.json
Normal file
5
types/react-custom-scroll/tslint.json
Normal file
@ -0,0 +1,5 @@
|
||||
{"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"npm-naming": [true,{"mode":"code","errors":[["NoDefaultExport",false]]}]
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user