Last active
September 28, 2016 14:38
-
-
Save acomito/69c2e23c4d0b2d819e7eb943c6849cec to your computer and use it in GitHub Desktop.
react-virtualized-list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//top-level imports | |
import React from 'react'; | |
import { List } from 'react-virtualized'; | |
//custom components | |
import { TransactionItem } from './transaction-item'; | |
//styles | |
import { StyleSheet, css } from 'aphrodite'; | |
import { styles } from './styles.js'; | |
import 'react-virtualized/styles.css'; // only needs to be imported once | |
// EXPORTED COMPONENT | |
//---------------------------------------- | |
export class TransactionFeed extends React.Component { | |
constructor(props){ | |
super(props) | |
this.rowRenderer = this.rowRenderer.bind(this); | |
} | |
rowRenderer({key, index, style}){ | |
const { transactions } = this.props; | |
return (<TransactionItem key={key} transaction={transactions[index]} />) | |
} | |
render(){ | |
const { transactions } = this.props; | |
return <List | |
width={300} | |
height={500} | |
rowCount={transactions.length} | |
rowHeight={75} | |
rowRenderer={this.rowRenderer} | |
overscanRowCount={30} | |
/> | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment