Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: updated scrollable scrollToTop event to handle empty list use #22

Merged
merged 1 commit into from
Aug 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -445,10 +445,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 @@ -59,11 +59,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 @@ -75,6 +73,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