Skip to content

Instantly share code, notes, and snippets.

@dotfold
Created December 14, 2016 03:50
Show Gist options
  • Save dotfold/d31a2982bc7c4d68edc69076abfcd159 to your computer and use it in GitHub Desktop.
Save dotfold/d31a2982bc7c4d68edc69076abfcd159 to your computer and use it in GitHub Desktop.
{
// ... other jest config
"moduleNameMapper": {
// ... other modules
"react-virtualized": "<rootDir>/config/jest/ReactVirtualizedStub.js"
}
}
/* eslint-disable react/prop-types */
const { createElement: el, Component } = require('react')
class AutoSizer extends Component {
constructor (props) {
super(props)
this.state = {
height: 400,
width: 400
}
}
render () {
const { children, component } = this.props
const { height, width } = this.state
return el(component, null, children({ height, width }))
}
}
AutoSizer.defaultProps = {
component: 'div'
}
const rv = require('react-virtualized')
module.exports = {
...rv,
AutoSizer
}
@dotfold
Copy link
Author

dotfold commented Dec 14, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment