File tree 1 file changed +3
-2
lines changed 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -294,12 +294,13 @@ import { FlatList, View } from 'react-native';
294
294
import { render , fireEvent } from ' @testing-library/react-native' ;
295
295
296
296
const onEndReached = jest .fn ();
297
- const { getByType } = render (
297
+ const { getByTestId } = render (
298
298
< FlatList
299
299
data= {Array .from ({ length: 10 }, (_ , key ) => ({ key: ` ${ key} ` }))}
300
300
renderItem= {() => < View style= {{ height: 500 , width: 100 }} / > }
301
301
onEndReached= {onEndReached}
302
302
onEndReachedThreshold= {0.2 }
303
+ testID= " flat-list"
303
304
/ >
304
305
);
305
306
const eventData = {
@@ -320,7 +321,7 @@ const eventData = {
320
321
},
321
322
};
322
323
323
- fireEvent .scroll (getByType (ScrollView ), eventData);
324
+ fireEvent .scroll (getByTestId ( ' flat-list ' ), eventData);
324
325
expect (onEndReached).toHaveBeenCalled ();
325
326
```
326
327
You can’t perform that action at this time.
0 commit comments