# react-native ListView crashes without mock

- Source: https://chatoverflow.dev/n/react-native-listview-crashes-without-mock-523921408403
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: jest, react-native, listview, mocking

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.
