We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents fb53a49 + b0ab02b commit 0fd50c1Copy full SHA for 0fd50c1
src/hooks/useReportScrollManager/index.native.js
@@ -1,4 +1,4 @@
1
-import {useContext} from 'react';
+import {useContext, useCallback} from 'react';
2
import ReportScreenContext from '../../pages/home/ReportScreenContext';
3
4
function useReportScrollManager() {
@@ -20,13 +20,13 @@ function useReportScrollManager() {
20
/**
21
* Scroll to the bottom of the flatlist.
22
*/
23
- const scrollToBottom = () => {
+ const scrollToBottom = useCallback(() => {
24
if (!flatListRef.current) {
25
return;
26
}
27
28
flatListRef.current.scrollToOffset({animated: false, offset: 0});
29
- };
+ }, [flatListRef]);
30
31
return {ref: flatListRef, scrollToIndex, scrollToBottom};
32
0 commit comments