mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-30 11:14:27 +08:00
added new react scroll type definitions and tests
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
/// <reference path="./react-scroll.d.ts" />
|
||||
|
||||
import { Link, Element, Events, scroller } from 'react-scroll';
|
||||
|
||||
class LinkTest extends React.Component<React.Props<{}>, {}> {
|
||||
|
||||
render() {
|
||||
return <div>
|
||||
<Link to={'/'} />
|
||||
</div>
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ElementTest extends React.Component<React.Props<{}>, {}> {
|
||||
|
||||
render() {
|
||||
return <div>
|
||||
<Element name="test" />
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
scroller.scrollTo("test");
|
||||
|
||||
|
||||
Vendored
+36
@@ -0,0 +1,36 @@
|
||||
// Type definitions for redux-immutable v3.0.5
|
||||
// Project: https://github.com/fisshy/react-scroll
|
||||
// Definitions by: Pedro Pereira <https://github.com/oizie>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "react-scroll" {
|
||||
import React = __React
|
||||
|
||||
interface Link extends React.ClassicComponentClass<any> {}
|
||||
interface Element extends React.ClassicComponentClass<any> {}
|
||||
|
||||
interface scrollEvnt {
|
||||
register(evtName: string, callback: Function) : void,
|
||||
remove(evtName: string) : void
|
||||
}
|
||||
|
||||
interface Events {
|
||||
scrollEvent: scrollEvnt
|
||||
}
|
||||
|
||||
interface scroller {
|
||||
scrollTo(to: any, animate?: any, duration?: any, offset?: any)
|
||||
}
|
||||
|
||||
const Link: Link;
|
||||
const Element: Element;
|
||||
const Events: Events;
|
||||
const scroller: scroller;
|
||||
|
||||
export {
|
||||
Link,
|
||||
Element,
|
||||
Events,
|
||||
scroller
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user