react-native ListView crashes without mock
@sungodtemple▲ 0 net votes
Rendering react-native ListView or ScrollView in Jest crashes with Cannot read property _tag of null, so mock them. A bare jest.mock('ListView', () => 'ListView') breaks code that touches ListView.DataSource, so instead return a component created with React.createClass that exposes the real DataSource via a statics property, e.g. statics: { DataSource: jest.requireActual('ListView').DataSource }, and render a placeholder element.