mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-01 12:42:58 +08:00
initial commit
This commit is contained in:
40
react-smooth-scrollbar/index.d.ts
vendored
Normal file
40
react-smooth-scrollbar/index.d.ts
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
// Type definitions for react-smooth-scrollbar 7.2
|
||||
// Project: https://github.com/idiotWu/react-smooth-scrollbar
|
||||
// Definitions by: Alexey Svetliakov <https://github.com/asvetliakov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as React from "react";
|
||||
import SmoothScrollbar, { ScrollbarOptions, ScrollStatusObject } from "smooth-scrollbar";
|
||||
|
||||
declare namespace Scrollbar {
|
||||
interface ScrollbarProps extends ScrollbarOptions {
|
||||
/**
|
||||
* Pipe to scrollbar.addListener()
|
||||
*/
|
||||
onScroll?: (status: ScrollStatusObject, scrollbarInstance: SmoothScrollbar) => void;
|
||||
/**
|
||||
* Keep scrollbar tracks visible whether it's scrolling or not
|
||||
* @default false
|
||||
*/
|
||||
alwaysShowTracks?: boolean;
|
||||
/**
|
||||
* Optional class name
|
||||
*/
|
||||
className?: string;
|
||||
/**
|
||||
* Optional style
|
||||
*/
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
}
|
||||
|
||||
declare class Scrollbar extends React.Component<Scrollbar.ScrollbarProps, {}> {
|
||||
/**
|
||||
* Scrollbar instance
|
||||
*/
|
||||
public readonly scrollbar: SmoothScrollbar;
|
||||
|
||||
}
|
||||
|
||||
export as namespace Scrollbar;
|
||||
export = Scrollbar;
|
||||
19
react-smooth-scrollbar/react-smooth-scrollbar-tests.tsx
Normal file
19
react-smooth-scrollbar/react-smooth-scrollbar-tests.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import * as React from "react";
|
||||
import * as SmoothScrollbar from "react-smooth-scrollbar";
|
||||
|
||||
<SmoothScrollbar className="test" alwaysShowTracks onScroll={(status, instance) => { } } />;
|
||||
<SmoothScrollbar speed={10} overscrollEffect="bounce" />;
|
||||
|
||||
class Test extends React.Component<void, void> {
|
||||
public ref: SmoothScrollbar;
|
||||
|
||||
public componentDidMount() {
|
||||
this.ref.scrollbar.scrollTo(0, 500);
|
||||
}
|
||||
|
||||
public render() {
|
||||
return (
|
||||
<SmoothScrollbar ref={ref => this.ref = ref} />
|
||||
);
|
||||
}
|
||||
}
|
||||
21
react-smooth-scrollbar/tsconfig.json
Normal file
21
react-smooth-scrollbar/tsconfig.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"jsx": "react",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-smooth-scrollbar-tests.tsx"
|
||||
]
|
||||
}
|
||||
1
react-smooth-scrollbar/tslint.json
Normal file
1
react-smooth-scrollbar/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
Reference in New Issue
Block a user