Skip to content

Commit f994c2f

Browse files
committed
Add STATICS to withScrollEnabler and withScrollReached
1 parent 0d0f546 commit f994c2f

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

generatedTypes/commons/withScrollEnabler.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ export declare type WithScrollEnablerProps = {
99
scrollEnablerProps: ScrollEnablerProps;
1010
ref?: any;
1111
};
12-
declare function withScrollEnabler<PROPS>(WrappedComponent: React.ComponentType<PROPS & WithScrollEnablerProps>): React.ComponentType<PROPS>;
12+
declare function withScrollEnabler<PROPS, STATICS = {}>(WrappedComponent: React.ComponentType<PROPS & WithScrollEnablerProps>): React.ComponentType<PROPS> & STATICS;
1313
export default withScrollEnabler;

generatedTypes/commons/withScrollReached.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ export declare type WithScrollReachedProps = {
3131
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/WithScrollReachedScreen.tsx
3232
* @notes: Send `props.scrollReachedProps.onScroll` to your onScroll and receive via props.scrollReachedProps.isScrollAtStart props.scrollReachedProps.isScrollAtEnd
3333
*/
34-
declare function withScrollReached<PROPS>(WrappedComponent: React.ComponentType<PROPS & WithScrollReachedProps>, options?: WithScrollReachedOptionsProps): React.ComponentType<PROPS>;
34+
declare function withScrollReached<PROPS, STATICS = {}>(WrappedComponent: React.ComponentType<PROPS & WithScrollReachedProps>, options?: WithScrollReachedOptionsProps): React.ComponentType<PROPS> & STATICS;
3535
export default withScrollReached;

src/commons/withScrollEnabler.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ export type WithScrollEnablerProps = {
2121

2222
type PropTypes = ForwardRefInjectedProps & SupportedViewsProps;
2323

24-
function withScrollEnabler<PROPS>(
24+
function withScrollEnabler<PROPS, STATICS = {}>(
2525
WrappedComponent: React.ComponentType<PROPS & WithScrollEnablerProps>
26-
): React.ComponentType<PROPS> {
26+
): React.ComponentType<PROPS> & STATICS {
2727
const ScrollEnabler = (props: PROPS & PropTypes) => {
2828
const [scrollEnabled, setScrollEnabled] = useState(true);
2929
const contentSize = useRef(0);
@@ -77,7 +77,7 @@ function withScrollEnabler<PROPS>(
7777
};
7878

7979
hoistStatics(ScrollEnabler, WrappedComponent);
80-
return forwardRef(ScrollEnabler);
80+
return forwardRef(ScrollEnabler) as any;
8181
}
8282

8383
export default withScrollEnabler;

src/commons/withScrollReached.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ const DEFAULT_THRESHOLD = Constants.isAndroid ? 1 : 0;
5555
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/WithScrollReachedScreen.tsx
5656
* @notes: Send `props.scrollReachedProps.onScroll` to your onScroll and receive via props.scrollReachedProps.isScrollAtStart props.scrollReachedProps.isScrollAtEnd
5757
*/
58-
function withScrollReached<PROPS>(
58+
function withScrollReached<PROPS, STATICS = {}>(
5959
WrappedComponent: React.ComponentType<PROPS & WithScrollReachedProps>,
6060
options: WithScrollReachedOptionsProps = {}
61-
): React.ComponentType<PROPS> {
61+
): React.ComponentType<PROPS> & STATICS {
6262
const ScrollReachedDetector = (props: PROPS & PropTypes) => {
6363
// The scroll starts at the start, from what I've tested this works fine
6464
const [isScrollAtStart, setScrollAtStart] = useState(true);
@@ -101,7 +101,7 @@ function withScrollReached<PROPS>(
101101
};
102102

103103
hoistStatics(ScrollReachedDetector, WrappedComponent);
104-
return forwardRef(ScrollReachedDetector);
104+
return forwardRef(ScrollReachedDetector) as any;
105105
}
106106

107107
export default withScrollReached;

0 commit comments

Comments
 (0)