Skip to content

Commit 149c323

Browse files
committed
moved empty set to utils
1 parent adc3c22 commit 149c323

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

packages/react-native-gesture-handler/src/v3/NativeDetector/HostGestureDetector.web.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { ActionType } from '../../ActionType';
44
import { PropsRef } from '../../web/interfaces';
55
import { View } from 'react-native';
66
import { tagMessage } from '../../utils';
7+
import { EMPTY_SET } from './utils';
78

89
export interface GestureHandlerDetectorProps extends PropsRef {
910
handlerTags: number[];
@@ -26,7 +27,6 @@ const HostGestureDetector = (props: GestureHandlerDetectorProps) => {
2627
const attachedHandlers = useRef<Set<number>>(new Set<number>());
2728
const attachedNativeHandlers = useRef<Set<number>>(new Set<number>());
2829
const attachedLogicHandlers = useRef<Map<number, Set<number>>>(new Map());
29-
const emptySet = new Set<number>();
3030

3131
const detachHandlers = (
3232
currentHandlerTags: Set<number>,
@@ -126,15 +126,15 @@ const HostGestureDetector = (props: GestureHandlerDetectorProps) => {
126126
});
127127

128128
logicChildrenToDetach.forEach((tag) => {
129-
detachHandlers(emptySet, attachedLogicHandlers.current.get(tag)!);
129+
detachHandlers(EMPTY_SET, attachedLogicHandlers.current.get(tag)!);
130130
});
131131
}, [props.logicChildren]);
132132

133133
useEffect(() => {
134134
return () => {
135-
detachHandlers(emptySet, attachedHandlers.current);
135+
detachHandlers(EMPTY_SET, attachedHandlers.current);
136136
attachedLogicHandlers?.current.forEach((childHandlerTags) => {
137-
detachHandlers(emptySet, childHandlerTags);
137+
detachHandlers(EMPTY_SET, childHandlerTags);
138138
});
139139
};
140140
}, []);

packages/react-native-gesture-handler/src/v3/NativeDetector/utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,5 @@ export function configureRelations<THandlerData, TConfig>(
147147
);
148148
}
149149
}
150+
151+
export const EMPTY_SET = new Set<number>();

0 commit comments

Comments
 (0)