Skip to content

Commit 1e1bb1f

Browse files
committed
Add hoistStatics to withScrollEnabler and withScrollReached
1 parent afdf169 commit 1e1bb1f

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/commons/withScrollEnabler.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import React, {useState, useCallback, useRef} from 'react';
33
import {FlatListProps, ScrollViewProps, LayoutChangeEvent} from 'react-native';
44
// eslint-disable-next-line no-unused-vars
55
import forwardRef, {ForwardRefInjectedProps} from './forwardRef';
6+
//@ts-ignore
7+
import hoistStatics from 'hoist-non-react-statics';
68

79
export type ScrollEnablerProps = {
810
onContentSizeChange: (contentWidth: number, contentHeight: number) => void;
@@ -74,6 +76,7 @@ function withScrollEnabler<PROPS>(
7476
);
7577
};
7678

79+
hoistStatics(ScrollEnabler, WrappedComponent);
7780
return forwardRef(ScrollEnabler);
7881
}
7982

src/commons/withScrollReached.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import {
1111
} from 'react-native';
1212
// eslint-disable-next-line no-unused-vars
1313
import forwardRef, {ForwardRefInjectedProps} from './forwardRef';
14+
//@ts-ignore
15+
import hoistStatics from 'hoist-non-react-statics';
1416

1517
export type ScrollReachedProps = {
1618
onScroll: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
@@ -95,6 +97,7 @@ function withScrollReached<PROPS>(
9597
);
9698
};
9799

100+
hoistStatics(ScrollReachedDetector, WrappedComponent);
98101
return forwardRef(ScrollReachedDetector);
99102
}
100103

0 commit comments

Comments
 (0)