Skip to content

Commit

Permalink
fix: sticky headers for web
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Cesarato committed Jun 9, 2021
1 parent 53348a1 commit 38198c9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
17 changes: 15 additions & 2 deletions lib/BigList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,20 @@ class BigList extends PureComponent {
actionSheetScrollRef.current = ref;
}
},
onScroll: this.onScroll,
onScroll:
Platform.OS === "web"
? Animated.event(
[
{
nativeEvent: { contentOffset: { y: this.scrollTopValue } },
},
],
{
listener: (event) => this.onScroll(event),
useNativeDriver: false,
},
)
: this.onScroll,
onLayout: this.onLayout,
onMomentumScrollEnd: this.onScrollEnd,
onScrollEndDrag: this.onScrollEnd,
Expand Down Expand Up @@ -790,7 +803,7 @@ BigList.defaultProps = {
sectionFooterHeight: 0,
// Scroll
removeClippedSubviews: false,
scrollEventThrottle: 16,
scrollEventThrottle: Platform.OS === "web" ? 5 : 16,
// Keyboard
keyboardShouldPersistTaps: "always",
keyboardDismissMode: "interactive",
Expand Down
6 changes: 4 additions & 2 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
ScrollViewProps,
LayoutChangeEvent,
ListRenderItem,
ViewStyle
ViewStyle,
} from "react-native";

interface BigListProps<ItemT> extends ScrollViewProps {
Expand Down Expand Up @@ -55,7 +55,9 @@ interface BigListProps<ItemT> extends ScrollViewProps {
sections?: ItemT[][];
children?: null | undefined;
}
export default class BigList<ItemT = any> extends PureComponent<BigListProps<ItemT>> {}
export default class BigList<ItemT = any> extends PureComponent<
BigListProps<ItemT>
> {}

type BigListItemProps = {
children?: React.ReactNode[] | React.ReactNode;
Expand Down

0 comments on commit 38198c9

Please sign in to comment.