Skip to content

Commit

Permalink
fix: Bad hover offset when used in pager (software-mansion#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
DanijelBojcic committed May 25, 2021
1 parent c24016b commit eb040bb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
FlatList as RNFlatList,
NativeScrollEvent,
StyleProp,
LayoutChangeEvent,
} from "react-native";
import {
PanGestureHandler,
Expand Down Expand Up @@ -588,14 +589,13 @@ class DraggableFlatList<T> extends React.Component<
throw new Error("You must provide a keyExtractor to DraggableFlatList");
};

onContainerLayout = () => {
onContainerLayout: (event: LayoutChangeEvent) => void = ({
nativeEvent: {
layout: { width, height },
},
}) => {
const { horizontal } = this.props;
const containerRef = this.containerRef.current;
if (containerRef) {
containerRef.getNode().measure((_x, _y, w, h) => {
this.containerSize.setValue(horizontal ? w : h);
});
}
this.containerSize.setValue(horizontal ? width : height);
};

onListContentSizeChange = (w: number, h: number) => {
Expand Down

0 comments on commit eb040bb

Please sign in to comment.