diff --git a/docs/PROPS.md b/docs/PROPS.md index b86aca16..e8acad62 100644 --- a/docs/PROPS.md +++ b/docs/PROPS.md @@ -86,7 +86,7 @@ To find the path to each of the function it will depend what content renderer (S On latest `react-native`, it should: - For the ScrollView: `contentRef.getScrollResponder().scrollTo(...)` or `contentRef.getScrollResponder().scrollToIndex(...)`, etc... -- For the FlatList: `contentRef.current.getNode().scrollToOffset({ animated: true, offset: 0 });`, etc... +- For the FlatList: `contentRef.current.scrollToOffset({ animated: true, offset: 0 });`, etc... - For the SectionList: `contentRef.current.getNode().scrollToLocation(...)`, etc... On older version of react-native, most likely something like `contentRef.getNode().getScrollResponder().scrollTo(...)` for the ScrollView and following the same pattern for the FlatList and SectionList. diff --git a/examples/expo/src/components/modals/FlatList.js b/examples/expo/src/components/modals/FlatList.js index 8bdf4907..86950107 100644 --- a/examples/expo/src/components/modals/FlatList.js +++ b/examples/expo/src/components/modals/FlatList.js @@ -23,11 +23,7 @@ export const FlatList = forwardRef((_, ref) => { const handleScrollToTop = () => { if (contentRef.current) { - // Old version of react-native, we need to use getNode() - contentRef.current.getNode().getScrollResponder().scrollTo({ - y: 0, - animated: true, - }); + contentRef.current.scrollToOffset({ animated: true, offset: 0 }); } };