Skip to content

Commit

Permalink
fix: make useScrollToTop work with react-native-largelist (#9960)
Browse files Browse the repository at this point in the history
  • Loading branch information
doomsower committed Sep 26, 2021
1 parent 4ae53e1 commit 073fd57
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/native/src/useScrollToTop.tsx
@@ -1,7 +1,7 @@
import { EventArg, useNavigation, useRoute } from '@react-navigation/core';
import * as React from 'react';

type ScrollOptions = { y?: number; animated?: boolean };
type ScrollOptions = { x?: number; y?: number; animated?: boolean };

type ScrollableView =
| { scrollToTop(): void }
Expand Down Expand Up @@ -85,7 +85,7 @@ export default function useScrollToTop(
if ('scrollToTop' in scrollable) {
scrollable.scrollToTop();
} else if ('scrollTo' in scrollable) {
scrollable.scrollTo({ y: 0, animated: true });
scrollable.scrollTo({ x: 0, y: 0, animated: true });
} else if ('scrollToOffset' in scrollable) {
scrollable.scrollToOffset({ offset: 0, animated: true });
} else if ('scrollResponderScrollTo' in scrollable) {
Expand Down

0 comments on commit 073fd57

Please sign in to comment.