Skip to content

Commit ae81f0a

Browse files
committed
safe invoke scroll methods (#1467)
1 parent e4e7509 commit ae81f0a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/hooks/useScrollTo/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ const useScrollTo = <T extends ScrollToSupportedViews>(props: ScrollToProps<T>):
7474
}
7575

7676
// @ts-ignore
77-
if (_.isFunction(scrollViewRef.current.scrollToOffset)) {
77+
if (_.isFunction(scrollViewRef.current?.scrollToOffset)) {
7878
// @ts-ignore
7979
scrollViewRef.current.scrollToOffset({offset, animated});
8080
// @ts-ignore
81-
} else if (_.isFunction(scrollViewRef.current.scrollTo)) {
81+
} else if (_.isFunction(scrollViewRef.current?.scrollTo)) {
8282
const scrollToXY = horizontal ? {x: offset} : {y: offset};
8383
// @ts-ignore
8484
scrollViewRef.current.scrollTo({...scrollToXY, animated});

0 commit comments

Comments
 (0)