diff --git a/examples/react-native/__tests__/__snapshots__/intro.test.js.snap b/examples/react-native/__tests__/__snapshots__/intro.test.js.snap index 18262e5e6ba0..a66c7c754b14 100644 --- a/examples/react-native/__tests__/__snapshots__/intro.test.js.snap +++ b/examples/react-native/__tests__/__snapshots__/intro.test.js.snap @@ -45,6 +45,67 @@ exports[`renders the ActivityIndicator component 1`] = ` /> `; +exports[`renders the FlatList component 1`] = ` + + + + + apple + + + + + banana + + + + + kiwi + + + + +`; + exports[`renders the Image component 1`] = ` `; -exports[`renders the ListView component 1`] = ` - - - - apple - - - banana - - - kiwi - - - -`; - exports[`renders the TextInput component 1`] = ` diff --git a/examples/react-native/__tests__/intro.test.js b/examples/react-native/__tests__/intro.test.js index 02adcec19993..ebb1100b6d2c 100644 --- a/examples/react-native/__tests__/intro.test.js +++ b/examples/react-native/__tests__/intro.test.js @@ -4,14 +4,16 @@ * Sample React Native Snapshot Test */ -'use strict'; - -import 'react-native'; import React from 'react'; -import Intro from '../Intro'; - -// Note: test renderer must be required after react-native. +import { + ActivityIndicator, + FlatList, + Image, + Text, + TextInput, +} from 'react-native'; import renderer from 'react-test-renderer'; +import Intro from '../Intro'; jest.setTimeout(15000); @@ -22,7 +24,6 @@ it('renders correctly', () => { // These serve as integration tests for the jest-react-native preset. it('renders the ActivityIndicator component', () => { - const ActivityIndicator = require('ActivityIndicator'); const tree = renderer .create() .toJSON(); @@ -30,7 +31,6 @@ it('renders the ActivityIndicator component', () => { }); it('renders the Image component', done => { - const Image = require('Image'); Image.getSize('path.jpg', (width, height) => { const tree = renderer.create().toJSON(); expect(tree).toMatchSnapshot(); @@ -39,24 +39,19 @@ it('renders the Image component', done => { }); it('renders the TextInput component', () => { - const TextInput = require('TextInput'); const tree = renderer .create() .toJSON(); expect(tree).toMatchSnapshot(); }); -it('renders the ListView component', () => { - const ListView = require('ListView'); - const Text = require('Text'); - const dataSource = new ListView.DataSource({ - rowHasChanged: (r1, r2) => r1 !== r2, - }).cloneWithRows(['apple', 'banana', 'kiwi']); +it('renders the FlatList component', () => { const tree = renderer .create( - {rowData}} + item} + renderItem={({item}) => {item}} /> ) .toJSON();