Created
December 14, 2016 03:50
-
-
Save dotfold/d31a2982bc7c4d68edc69076abfcd159 to your computer and use it in GitHub Desktop.
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
{ | |
// ... other jest config | |
"moduleNameMapper": { | |
// ... other modules | |
"react-virtualized": "<rootDir>/config/jest/ReactVirtualizedStub.js" | |
} | |
} |
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
/* 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 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Instead of exporting an explicit component (seen at http://stackoverflow.com/questions/37801005/does-react-virtualized-work-with-airbnb-enzyme)