initial commit

This commit is contained in:
Alexey Svetliakov
2017-01-10 06:24:01 +01:00
parent e93460bfaa
commit 4c2595cf69
4 changed files with 81 additions and 0 deletions

40
react-smooth-scrollbar/index.d.ts vendored Normal file
View 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;

View 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} />
);
}
}

View 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"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "../tslint.json" }