Skip to content

Commit 327ccf6

Browse files
authored
docs: update scroll event api for flat list (#519)
1 parent 64bbde4 commit 327ccf6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

website/docs/API.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,12 +294,13 @@ import { FlatList, View } from 'react-native';
294294
import { render, fireEvent } from '@testing-library/react-native';
295295

296296
const onEndReached = jest.fn();
297-
const { getByType } = render(
297+
const { getByTestId } = render(
298298
<FlatList
299299
data={Array.from({ length: 10 }, (_, key) => ({ key: `${key}` }))}
300300
renderItem={() => <View style={{ height: 500, width: 100 }} />}
301301
onEndReached={onEndReached}
302302
onEndReachedThreshold={0.2}
303+
testID="flat-list"
303304
/>
304305
);
305306
const eventData = {
@@ -320,7 +321,7 @@ const eventData = {
320321
},
321322
};
322323

323-
fireEvent.scroll(getByType(ScrollView), eventData);
324+
fireEvent.scroll(getByTestId('flat-list'), eventData);
324325
expect(onEndReached).toHaveBeenCalled();
325326
```
326327

0 commit comments

Comments
 (0)