Skip to content

Commit

Permalink
chore: updated scrollable scrollToTop event to handle empty list use …
Browse files Browse the repository at this point in the history
…case (#22)
  • Loading branch information
gorhom committed Aug 23, 2020
1 parent 2c3d545 commit 1ce8b02
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
4 changes: 2 additions & 2 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ PODS:
- React
- RNGestureHandler (1.7.0):
- React
- RNReanimated (1.11.0):
- RNReanimated (1.12.0):
- React
- RNScreens (2.10.1):
- React
Expand Down Expand Up @@ -474,7 +474,7 @@ SPEC CHECKSUMS:
ReactCommon: ed4e11d27609d571e7eee8b65548efc191116eb3
RNCMaskedView: 5a8ec07677aa885546a0d98da336457e2bea557f
RNGestureHandler: b6b359bb800ae399a9c8b27032bdbf7c18f08a08
RNReanimated: f05ea1c5ee07891aaefee662f073f4944c87ac4d
RNReanimated: 9c475f9b272232351d94a1a781e8b7580bac1ff4
RNScreens: b748efec66e095134c7166ca333b628cd7e6f3e2
Yoga: 3ebccbdd559724312790e7742142d062476b698e
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
Expand Down
4 changes: 0 additions & 4 deletions src/components/bottomSheet/BottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -450,10 +450,6 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
style={styles.debugText}
text={concat('currentPosition: ', currentPosition)}
/>
<ReText
style={styles.debugText}
text={concat('disableIntervalMomentum: ', disableIntervalMomentum)}
/>
</Animated.View> */}
</>
);
Expand Down
9 changes: 5 additions & 4 deletions src/hooks/useScrollable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,9 @@ export const useScrollable = () => {

switch (type) {
case 'FlatList':
(node as FlatList).scrollToIndex({
(node as FlatList).scrollToOffset({
animated: false,
index: 0,
viewPosition: 0,
viewOffset: 1000,
offset: 0,
});
break;

Expand All @@ -76,6 +74,9 @@ export const useScrollable = () => {
break;

case 'SectionList':
if ((node as SectionList).props.sections.length === 0) {
return;
}
(node as SectionList).scrollToLocation({
itemIndex: 0,
sectionIndex: 0,
Expand Down

0 comments on commit 1ce8b02

Please sign in to comment.