Skip to content

Commit 0885d75

Browse files
authored
Change exports (#3858)
## Description This PR changes `export *` in `index` files so that it doesn't export everything from modules. ## Test plan - `yarn ts-check` - `yarn lint-js`
1 parent 71ab149 commit 0885d75

File tree

13 files changed

+188
-43
lines changed

13 files changed

+188
-43
lines changed

packages/react-native-gesture-handler/src/index.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -152,20 +152,8 @@ export type {
152152
} from './components/Pressable';
153153
export { default as Pressable } from './components/Pressable';
154154

155-
export {
156-
GestureDetector,
157-
InterceptingGestureDetector,
158-
GestureDetectorProps,
159-
VirtualGestureDetector,
160-
} from './v3/detectors';
161-
162-
export * from './v3/hooks/composition';
163-
164-
export type { ComposedGesture } from './v3/types';
165155
export type { GestureTouchEvent as SingleGestureTouchEvent } from './handlers/gestureHandlerCommon';
166156

167-
export * from './v3/hooks/gestures';
168-
169-
export * from './v3/components';
157+
export * from './v3';
170158

171159
initialize();

packages/react-native-gesture-handler/src/v3/components/GestureComponents.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import createNativeWrapper from '../createNativeWrapper';
2020

2121
import { NativeWrapperProperties } from '../types/NativeWrapperType';
2222
import { NativeWrapperProps } from '../hooks/utils';
23-
import { DetectorType } from '../detectors';
23+
import { GestureDetectorType } from '../detectors';
2424
import { NativeGesture } from '../hooks/gestures/native/useNativeGesture';
2525
import { ghQueueMicrotask } from '../../ghQueueMicrotask';
2626

@@ -30,7 +30,7 @@ export const RefreshControl = createNativeWrapper(
3030
disallowInterruption: true,
3131
shouldCancelWhenOutside: false,
3232
},
33-
DetectorType.Virtual
33+
GestureDetectorType.Virtual
3434
);
3535

3636
// eslint-disable-next-line @typescript-eslint/no-redeclare
@@ -42,7 +42,7 @@ const GHScrollView = createNativeWrapper<PropsWithChildren<RNScrollViewProps>>(
4242
disallowInterruption: true,
4343
shouldCancelWhenOutside: false,
4444
},
45-
DetectorType.Intercepting
45+
GestureDetectorType.Intercepting
4646
);
4747

4848
export const ScrollView = (

packages/react-native-gesture-handler/src/v3/createNativeWrapper.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import { useNativeGesture } from './hooks/gestures';
55
import { NativeDetector } from './detectors/NativeDetector';
66
import type { NativeWrapperProperties } from './types/NativeWrapperType';
77
import { NativeGesture } from './hooks/gestures/native/useNativeGesture';
8-
import { DetectorType, InterceptingGestureDetector } from './detectors';
8+
import { GestureDetectorType, InterceptingGestureDetector } from './detectors';
99
import { VirtualDetector } from './detectors/VirtualDetector/VirtualDetector';
1010

1111
export default function createNativeWrapper<P>(
1212
Component: React.ComponentType<P>,
1313
config: Readonly<NativeWrapperProperties> = {},
14-
detectorType: DetectorType = DetectorType.Native
14+
detectorType: GestureDetectorType = GestureDetectorType.Native
1515
) {
1616
const ComponentWrapper = (
1717
props: P &
@@ -57,9 +57,9 @@ export default function createNativeWrapper<P>(
5757
}, [native, onGestureUpdate_CAN_CAUSE_INFINITE_RERENDER]);
5858

5959
const DetectorComponent =
60-
detectorType === DetectorType.Intercepting
60+
detectorType === GestureDetectorType.Intercepting
6161
? InterceptingGestureDetector
62-
: detectorType === DetectorType.Virtual
62+
: detectorType === GestureDetectorType.Virtual
6363
? VirtualDetector
6464
: NativeDetector;
6565

packages/react-native-gesture-handler/src/v3/detectors/common.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ import { Animated, StyleSheet } from 'react-native';
44
import HostGestureDetector from './HostGestureDetector';
55
import { GestureDetectorProps as LegacyDetectorProps } from '../../handlers/gestures/GestureDetector';
66

7+
export enum GestureDetectorType {
8+
Native,
9+
Virtual,
10+
Intercepting,
11+
}
12+
713
export interface NativeDetectorProps<THandlerData, TConfig> {
814
children?: React.ReactNode;
915
gesture: Gesture<THandlerData, TConfig>;
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
export type { GestureDetectorProps } from './common';
2+
export { GestureDetectorType } from './common';
23
export { GestureDetector } from './GestureDetector';
34
export { VirtualDetector as VirtualGestureDetector } from './VirtualDetector/VirtualDetector';
45
export { InterceptingGestureDetector } from './VirtualDetector/InterceptingGestureDetector';
5-
6-
export enum DetectorType {
7-
Native,
8-
Virtual,
9-
Intercepting,
10-
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './composition';
2+
export * from './gestures';

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ export function prepareConfigForNativeSide<THandlerData, TConfig>(
9393
return filteredConfig;
9494
}
9595

96-
export function cloneConfig<THandlerData, TConfig>(
96+
function cloneConfig<THandlerData, TConfig>(
9797
config: ExcludeInternalConfigProps<BaseGestureConfig<THandlerData, TConfig>>
9898
): BaseGestureConfig<THandlerData, TConfig> {
9999
return { ...config } as BaseGestureConfig<THandlerData, TConfig>;
100100
}
101101

102-
export function remapProps<
102+
function remapProps<
103103
TConfig extends object,
104104
TInternalConfig extends Record<string, unknown>,
105105
>(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export function useMemoizedGestureCallbacks<THandlerData>(
4040
);
4141
}
4242

43-
export function getHandler<THandlerData>(
43+
function getHandler<THandlerData>(
4444
type: CALLBACK_TYPE,
4545
callbacks: GestureCallbacks<THandlerData>
4646
) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
import { GestureTouchEvent } from '../../../handlers/gestureHandlerCommon';
1313
import { tagMessage } from '../../../utils';
1414

15-
export function isNativeEvent<THandlerData>(
15+
function isNativeEvent<THandlerData>(
1616
event: GestureHandlerEventWithHandlerData<THandlerData>
1717
): event is
1818
| NativeSyntheticEvent<GestureUpdateEventWithHandlerData<THandlerData>>
Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,43 @@
1-
export * from './configUtils';
2-
export * from './eventHandlersUtils';
3-
export * from './eventUtils';
4-
export * from './reanimatedUtils';
5-
export * from './relationUtils';
6-
export * from './propsWhiteList';
1+
export {
2+
prepareConfig,
3+
prepareConfigForNativeSide,
4+
useClonedAndRemappedConfig,
5+
} from './configUtils';
6+
7+
export {
8+
useMemoizedGestureCallbacks,
9+
touchEventTypeToCallbackType,
10+
runCallback,
11+
} from './eventHandlersUtils';
12+
13+
export {
14+
maybeExtractNativeEvent,
15+
flattenAndFilterEvent,
16+
isEventForHandlerWithTag,
17+
isNativeAnimatedEvent,
18+
checkMappingForChangeProperties,
19+
shouldHandleTouchEvents,
20+
getChangeEventCalculator,
21+
} from './eventUtils';
22+
23+
export {
24+
bindSharedValues,
25+
unbindSharedValues,
26+
hasWorkletEventHandlers,
27+
maybeUnpackValue,
28+
} from './reanimatedUtils';
29+
30+
export {
31+
isComposedGesture,
32+
prepareRelations,
33+
containsDuplicates,
34+
} from './relationUtils';
35+
36+
export {
37+
allowedNativeProps,
38+
NativeWrapperProps,
39+
HandlerCallbacks,
40+
PropsToFilter,
41+
PropsWhiteLists,
42+
EMPTY_WHITE_LIST,
43+
} from './propsWhiteList';

0 commit comments

Comments
 (0)