Skip to content

Commit

Permalink
fix: flatlist not rendering in rntl repo
Browse files Browse the repository at this point in the history
  • Loading branch information
pierrezimmermann committed Aug 21, 2023
1 parent 4a8072d commit 9075365
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
1 change: 0 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ module.exports = {
},
],
],
plugins: ['@babel/plugin-proposal-class-properties'],
env: {
test: {
// https://github.com/react-native-community/upgrade-support/issues/152
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"devDependencies": {
"@babel/cli": "^7.19.3",
"@babel/core": "^7.20.2",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-transform-flow-strip-types": "^7.19.0",
"@babel/preset-env": "^7.20.2",
"@babel/preset-flow": "^7.18.6",
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/__snapshots__/render-debug.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ exports[`debug: shallow 1`] = `
value=""
/>
<MyButton
onPress={[Function anonymous]}
onPress={[Function changeFresh]}
type="primary"
>
Change freshness!
Expand Down Expand Up @@ -445,7 +445,7 @@ exports[`debug: shallow with message 1`] = `
value=""
/>
<MyButton
onPress={[Function anonymous]}
onPress={[Function changeFresh]}
type="primary"
>
Change freshness!
Expand Down
14 changes: 13 additions & 1 deletion src/__tests__/render.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-console */
import * as React from 'react';
import { View, Text, TextInput, Pressable } from 'react-native';
import { View, Text, TextInput, Pressable, FlatList } from 'react-native';
import { getConfig, resetToDefaults } from '../config';
import { render, screen, fireEvent, RenderAPI } from '..';

Expand Down Expand Up @@ -254,3 +254,15 @@ test('render calls detects host component names', () => {
render(<View testID="test" />);
expect(getConfig().hostComponentNames).not.toBeUndefined();
});

test('render FlatList', () => {
const screen = render(
<FlatList
testID="flatList"
data={[1, 2, 3]}
renderItem={({ item }) => <Text>{item}</Text>}
/>
);

expect(screen.getByTestId('flatList')).toBeTruthy();
});
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@
"@babel/helper-remap-async-to-generator" "^7.18.9"
"@babel/plugin-syntax-async-generators" "^7.8.4"

"@babel/plugin-proposal-class-properties@^7.0.0", "@babel/plugin-proposal-class-properties@^7.13.0", "@babel/plugin-proposal-class-properties@^7.18.6":
"@babel/plugin-proposal-class-properties@^7.0.0", "@babel/plugin-proposal-class-properties@^7.13.0":
version "7.18.6"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.18.6.tgz#b110f59741895f7ec21a6fff696ec46265c446a3"
integrity sha512-cumfXOF0+nzZrrN8Rf0t7M+tF6sZc7vhQwYQck9q1/5w2OExlD+b4v4RpMJFaV1Z7WcDRgO6FqvxqxGlwo+RHQ==
Expand Down

0 comments on commit 9075365

Please sign in to comment.