Skip to content

Commit

Permalink
[react-infinite-scroll-component] Add className type and test (Defini…
Browse files Browse the repository at this point in the history
…telyTyped#36382)

* fix: added missing typing
1. Added missing `className` definition

* fix: set className to go through tests
  • Loading branch information
marcelovicentegc authored and DanielRosenwasser committed Jun 24, 2019
1 parent 6ae163b commit 7145253
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 7 additions & 1 deletion types/react-infinite-scroll-component/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Bartosz Dotryw <https://github.com/burtek>
// David Kevork <https://github.com/davidkevork>
// Joshua R. <https://github.com/JoshuaScript>
// Marcelo Cardoso <https://github.com/marcelovicentegc>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8

Expand Down Expand Up @@ -97,7 +98,12 @@ declare namespace InfiniteScroll {
initialScrollY?: number;

/**
* Set a scroll y position for the component to render with.
* Set any custom class you want
*/
className?: string;

/**
* Set any style which you want to override.
*/
style?: any;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import * as React from 'react';
import * as InfiniteScroll from 'react-infinite-scroll-component';

const options: JSX.Element[] = [
<div key='1'>1</div>,
<div key='2'>2</div>,
];
const options: JSX.Element[] = [<div key="1">1</div>, <div key="2">2</div>];

const props: InfiniteScroll.InfiniteScrollProps = {
dataLength: 4,
hasMore: true,
endMessage: 'The end.',
loader: <h3>Loading...</h3>,
next: () => null,
className: 'this-is-a-test',
};

<InfiniteScroll {...props}>{options}</InfiniteScroll>;

0 comments on commit 7145253

Please sign in to comment.