react-native-gesture-handler 3.1.0 → 3.2.0-nightly-20260720-9c6135950
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/module/components/GestureButtons.js +7 -6
- package/lib/module/components/GestureButtons.js.map +1 -1
- package/lib/module/components/GestureComponents.js +2 -0
- package/lib/module/components/GestureComponents.js.map +1 -1
- package/lib/module/components/Pressable/Pressable.js +2 -0
- package/lib/module/components/Pressable/Pressable.js.map +1 -1
- package/lib/module/components/ReanimatedDrawerLayout.js +4 -2
- package/lib/module/components/ReanimatedDrawerLayout.js.map +1 -1
- package/lib/module/components/Text.js.map +1 -1
- package/lib/module/components/touchables/TouchableHighlight.js +2 -2
- package/lib/module/components/touchables/TouchableHighlight.js.map +1 -1
- package/lib/module/components/touchables/TouchableNativeFeedback.android.js.map +1 -1
- package/lib/module/specs/NativeRNGestureHandlerModule.js.map +1 -1
- package/lib/module/specs/RNGestureHandlerButtonNativeComponent.ts +55 -51
- package/lib/module/specs/RNGestureHandlerDetectorNativeComponent.ts +39 -44
- package/lib/module/specs/RNGestureHandlerRootViewNativeComponent.ts +6 -5
- package/lib/module/v3/components/GestureButtons.js +7 -10
- package/lib/module/v3/components/GestureButtons.js.map +1 -1
- package/lib/module/v3/components/GestureComponents.js.map +1 -1
- package/lib/module/v3/components/Pressable.js +2 -0
- package/lib/module/v3/components/Pressable.js.map +1 -1
- package/lib/module/v3/detectors/HostGestureDetector.web.js.map +1 -1
- package/lib/module/v3/detectors/NativeDetector.js.map +1 -1
- package/lib/module/v3/detectors/VirtualDetector/InterceptingGestureDetector.js.map +1 -1
- package/lib/module/v3/detectors/common.js.map +1 -1
- package/lib/typescript/components/GestureButtons.d.ts +1 -1
- package/lib/typescript/components/GestureButtons.d.ts.map +1 -1
- package/lib/typescript/components/GestureComponents.d.ts +3 -10
- package/lib/typescript/components/GestureComponents.d.ts.map +1 -1
- package/lib/typescript/components/Pressable/Pressable.d.ts.map +1 -1
- package/lib/typescript/components/Pressable/PressableProps.d.ts +1 -1
- package/lib/typescript/components/Pressable/PressableProps.d.ts.map +1 -1
- package/lib/typescript/components/ReanimatedDrawerLayout.d.ts.map +1 -1
- package/lib/typescript/components/touchables/TouchableHighlight.d.ts.map +1 -1
- package/lib/typescript/components/touchables/TouchableNativeFeedback.android.d.ts +1 -1
- package/lib/typescript/components/touchables/TouchableNativeFeedback.android.d.ts.map +1 -1
- package/lib/typescript/handlers/gestures/reanimatedWrapper.d.ts +2 -2
- package/lib/typescript/handlers/gestures/reanimatedWrapper.d.ts.map +1 -1
- package/lib/typescript/specs/NativeRNGestureHandlerModule.d.ts +7 -8
- package/lib/typescript/specs/NativeRNGestureHandlerModule.d.ts.map +1 -1
- package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.d.ts +45 -46
- package/lib/typescript/specs/RNGestureHandlerButtonNativeComponent.d.ts.map +1 -1
- package/lib/typescript/specs/RNGestureHandlerDetectorNativeComponent.d.ts +36 -37
- package/lib/typescript/specs/RNGestureHandlerDetectorNativeComponent.d.ts.map +1 -1
- package/lib/typescript/specs/RNGestureHandlerRootViewNativeComponent.d.ts +3 -4
- package/lib/typescript/specs/RNGestureHandlerRootViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/v3/components/GestureButtons.d.ts.map +1 -1
- package/lib/typescript/v3/components/GestureButtonsProps.d.ts +1 -1
- package/lib/typescript/v3/components/GestureButtonsProps.d.ts.map +1 -1
- package/lib/typescript/v3/components/GestureComponents.d.ts +4 -112
- package/lib/typescript/v3/components/GestureComponents.d.ts.map +1 -1
- package/lib/typescript/v3/components/Pressable.d.ts.map +1 -1
- package/lib/typescript/v3/detectors/HostGestureDetector.d.ts +1 -1
- package/lib/typescript/v3/detectors/HostGestureDetector.d.ts.map +1 -1
- package/lib/typescript/v3/detectors/HostGestureDetector.web.d.ts.map +1 -1
- package/lib/typescript/v3/detectors/NativeDetector.d.ts.map +1 -1
- package/lib/typescript/v3/detectors/VirtualDetector/InterceptingGestureDetector.d.ts.map +1 -1
- package/lib/typescript/v3/detectors/common.d.ts +2 -2
- package/lib/typescript/v3/detectors/common.d.ts.map +1 -1
- package/lib/typescript/v3/types/EventTypes.d.ts +4 -1
- package/lib/typescript/v3/types/EventTypes.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/GestureButtons.tsx +14 -8
- package/src/components/GestureComponents.tsx +11 -6
- package/src/components/Pressable/Pressable.tsx +2 -0
- package/src/components/Pressable/PressableProps.tsx +1 -1
- package/src/components/ReanimatedDrawerLayout.tsx +3 -1
- package/src/components/Text.tsx +3 -3
- package/src/components/touchables/TouchableHighlight.tsx +6 -3
- package/src/components/touchables/TouchableNativeFeedback.android.tsx +8 -2
- package/src/handlers/gestures/reanimatedWrapper.ts +2 -2
- package/src/specs/NativeRNGestureHandlerModule.ts +24 -13
- package/src/specs/RNGestureHandlerButtonNativeComponent.ts +55 -51
- package/src/specs/RNGestureHandlerDetectorNativeComponent.ts +39 -44
- package/src/specs/RNGestureHandlerRootViewNativeComponent.ts +6 -5
- package/src/v3/components/GestureButtons.tsx +10 -10
- package/src/v3/components/GestureButtonsProps.ts +1 -1
- package/src/v3/components/GestureComponents.tsx +26 -12
- package/src/v3/components/Pressable.tsx +2 -0
- package/src/v3/detectors/HostGestureDetector.web.tsx +3 -1
- package/src/v3/detectors/NativeDetector.tsx +10 -6
- package/src/v3/detectors/VirtualDetector/InterceptingGestureDetector.tsx +10 -6
- package/src/v3/detectors/common.ts +4 -2
- package/src/v3/types/EventTypes.ts +3 -1
|
@@ -23,8 +23,11 @@ import { NativeWrapperProps } from '../hooks/utils';
|
|
|
23
23
|
import type { NativeWrapperProperties } from '../types/NativeWrapperType';
|
|
24
24
|
import ScrollViewResponderInterceptor from './ScrollViewResponderInterceptor';
|
|
25
25
|
|
|
26
|
-
export const RefreshControl
|
|
27
|
-
|
|
26
|
+
export const RefreshControl: React.ComponentType<
|
|
27
|
+
RNRefreshControlProps &
|
|
28
|
+
NativeWrapperProperties<React.ComponentRef<typeof RNRefreshControl> | null>
|
|
29
|
+
> = createNativeWrapper<
|
|
30
|
+
React.ComponentRef<typeof RNRefreshControl>,
|
|
28
31
|
RNRefreshControlProps
|
|
29
32
|
>(
|
|
30
33
|
RNRefreshControl,
|
|
@@ -39,7 +42,7 @@ export const RefreshControl = createNativeWrapper<
|
|
|
39
42
|
export type RefreshControl = typeof RefreshControl & RNRefreshControl;
|
|
40
43
|
|
|
41
44
|
const GHScrollView = createNativeWrapper<
|
|
42
|
-
RNScrollView
|
|
45
|
+
React.ComponentRef<typeof RNScrollView>,
|
|
43
46
|
PropsWithChildren<RNScrollViewProps>
|
|
44
47
|
>(
|
|
45
48
|
RNScrollView,
|
|
@@ -51,7 +54,8 @@ const GHScrollView = createNativeWrapper<
|
|
|
51
54
|
);
|
|
52
55
|
|
|
53
56
|
export const ScrollView = (
|
|
54
|
-
props: RNScrollViewProps &
|
|
57
|
+
props: RNScrollViewProps &
|
|
58
|
+
NativeWrapperProperties<React.ComponentRef<typeof RNScrollView> | null>
|
|
55
59
|
) => {
|
|
56
60
|
const {
|
|
57
61
|
children,
|
|
@@ -101,18 +105,28 @@ export const ScrollView = (
|
|
|
101
105
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
102
106
|
export type ScrollView = typeof ScrollView & RNScrollView;
|
|
103
107
|
|
|
104
|
-
export const Switch
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
108
|
+
export const Switch: React.ComponentType<
|
|
109
|
+
RNSwitchProps &
|
|
110
|
+
NativeWrapperProperties<React.ComponentRef<typeof RNSwitch> | null>
|
|
111
|
+
> = createNativeWrapper<React.ComponentRef<typeof RNSwitch>, RNSwitchProps>(
|
|
112
|
+
RNSwitch,
|
|
113
|
+
{
|
|
114
|
+
shouldCancelWhenOutside: false,
|
|
115
|
+
shouldActivateOnStart: true,
|
|
116
|
+
disallowInterruption: true,
|
|
117
|
+
}
|
|
118
|
+
);
|
|
109
119
|
|
|
110
120
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
111
121
|
export type Switch = typeof Switch & RNSwitch;
|
|
112
122
|
|
|
113
|
-
export const TextInput
|
|
114
|
-
|
|
115
|
-
|
|
123
|
+
export const TextInput: React.ComponentType<
|
|
124
|
+
RNTextInputProps &
|
|
125
|
+
NativeWrapperProperties<React.ComponentRef<typeof RNTextInput> | null>
|
|
126
|
+
> = createNativeWrapper<
|
|
127
|
+
React.ComponentRef<typeof RNTextInput>,
|
|
128
|
+
RNTextInputProps
|
|
129
|
+
>(RNTextInput);
|
|
116
130
|
|
|
117
131
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
118
132
|
export type TextInput = typeof TextInput & RNTextInput;
|
|
@@ -77,6 +77,7 @@ const Pressable = (props: PressableProps) => {
|
|
|
77
77
|
simultaneousWith,
|
|
78
78
|
requireToFail,
|
|
79
79
|
block,
|
|
80
|
+
ref,
|
|
80
81
|
...remainingProps
|
|
81
82
|
} = props;
|
|
82
83
|
|
|
@@ -426,6 +427,7 @@ const Pressable = (props: PressableProps) => {
|
|
|
426
427
|
<GestureDetector gesture={gesture}>
|
|
427
428
|
<PureNativeButton
|
|
428
429
|
{...remainingProps}
|
|
430
|
+
ref={ref as React.Ref<React.ComponentRef<typeof PureNativeButton>>}
|
|
429
431
|
{...tvProps}
|
|
430
432
|
onLayout={setDimensions}
|
|
431
433
|
accessible={accessible !== false}
|
|
@@ -349,7 +349,9 @@ const HostGestureDetector = (props: GestureHandlerDetectorProps) => {
|
|
|
349
349
|
}, [refs]);
|
|
350
350
|
|
|
351
351
|
return (
|
|
352
|
-
<View
|
|
352
|
+
<View
|
|
353
|
+
style={{ display: 'contents' }}
|
|
354
|
+
ref={viewRef as Ref<React.ComponentRef<typeof View>>}>
|
|
353
355
|
{children}
|
|
354
356
|
</View>
|
|
355
357
|
);
|
|
@@ -5,7 +5,9 @@ import { useJSResponderHandler } from '../hooks/useJSResponderHandler';
|
|
|
5
5
|
import { isComposedGesture } from '../hooks/utils/relationUtils';
|
|
6
6
|
import type { NativeDetectorProps } from './common';
|
|
7
7
|
import { AnimatedNativeDetector, nativeDetectorStyles } from './common';
|
|
8
|
-
import HostGestureDetector
|
|
8
|
+
import HostGestureDetector, {
|
|
9
|
+
type RNGestureHandlerDetectorNativeComponentProps,
|
|
10
|
+
} from './HostGestureDetector';
|
|
9
11
|
import { ReanimatedNativeDetector } from './ReanimatedNativeDetector';
|
|
10
12
|
import { useDetectorAttachmentGuard } from './useDetectorAttachmentGuard';
|
|
11
13
|
import { useGestureRelationsUpdater } from './useGestureRelationsUpdater';
|
|
@@ -24,11 +26,13 @@ export function NativeDetector<
|
|
|
24
26
|
}: NativeDetectorProps<TConfig, THandlerData, TExtendedHandlerData>) {
|
|
25
27
|
const { handleStartShouldSetResponder } = useJSResponderHandler(gesture);
|
|
26
28
|
|
|
27
|
-
const NativeDetectorComponent =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
const NativeDetectorComponent = (
|
|
30
|
+
gesture.config.dispatchesAnimatedEvents
|
|
31
|
+
? AnimatedNativeDetector
|
|
32
|
+
: gesture.config.shouldUseReanimatedDetector
|
|
33
|
+
? ReanimatedNativeDetector
|
|
34
|
+
: HostGestureDetector
|
|
35
|
+
) as React.FunctionComponent<RNGestureHandlerDetectorNativeComponentProps>;
|
|
32
36
|
|
|
33
37
|
ensureNativeDetectorComponent(NativeDetectorComponent);
|
|
34
38
|
useGestureRelationsUpdater(gesture);
|
|
@@ -15,7 +15,9 @@ import type {
|
|
|
15
15
|
} from '../../types';
|
|
16
16
|
import type { InterceptingGestureDetectorProps } from '../common';
|
|
17
17
|
import { AnimatedNativeDetector, nativeDetectorStyles } from '../common';
|
|
18
|
-
import HostGestureDetector
|
|
18
|
+
import HostGestureDetector, {
|
|
19
|
+
type RNGestureHandlerDetectorNativeComponentProps,
|
|
20
|
+
} from '../HostGestureDetector';
|
|
19
21
|
import { ReanimatedNativeDetector } from '../ReanimatedNativeDetector';
|
|
20
22
|
import { useDetectorAttachmentGuard } from '../useDetectorAttachmentGuard';
|
|
21
23
|
import { useEnsureGestureHandlerRootView } from '../useEnsureGestureHandlerRootView';
|
|
@@ -85,11 +87,13 @@ export function InterceptingGestureDetector<
|
|
|
85
87
|
mode === InterceptingDetectorMode.REANIMATED;
|
|
86
88
|
const dispatchesAnimatedEvents = mode === InterceptingDetectorMode.ANIMATED;
|
|
87
89
|
|
|
88
|
-
const NativeDetectorComponent =
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
const NativeDetectorComponent = (
|
|
91
|
+
dispatchesAnimatedEvents
|
|
92
|
+
? AnimatedNativeDetector
|
|
93
|
+
: shouldUseReanimatedDetector
|
|
94
|
+
? ReanimatedNativeDetector
|
|
95
|
+
: HostGestureDetector
|
|
96
|
+
) as React.FunctionComponent<RNGestureHandlerDetectorNativeComponentProps>;
|
|
93
97
|
|
|
94
98
|
const register = useCallback((child: VirtualChild) => {
|
|
95
99
|
setVirtualChildren((prev) => {
|
|
@@ -7,7 +7,9 @@ import type {
|
|
|
7
7
|
} from '../../handlers/gestureHandlerCommon';
|
|
8
8
|
import type { GestureDetectorProps as LegacyDetectorProps } from '../../handlers/gestures/GestureDetector';
|
|
9
9
|
import type { Gesture } from '../types';
|
|
10
|
-
import HostGestureDetector
|
|
10
|
+
import HostGestureDetector, {
|
|
11
|
+
type RNGestureHandlerDetectorNativeComponentProps,
|
|
12
|
+
} from './HostGestureDetector';
|
|
11
13
|
|
|
12
14
|
export enum GestureDetectorType {
|
|
13
15
|
Native,
|
|
@@ -59,7 +61,7 @@ export type GestureDetectorProps<
|
|
|
59
61
|
>
|
|
60
62
|
| LegacyDetectorProps;
|
|
61
63
|
|
|
62
|
-
export const AnimatedNativeDetector =
|
|
64
|
+
export const AnimatedNativeDetector: React.ComponentType<RNGestureHandlerDetectorNativeComponentProps> =
|
|
63
65
|
Animated.createAnimatedComponent(HostGestureDetector);
|
|
64
66
|
|
|
65
67
|
export const nativeDetectorStyles = StyleSheet.create({
|
|
@@ -71,8 +71,10 @@ export type UnpackedGestureHandlerEvent<THandlerData> =
|
|
|
71
71
|
// This is not how Animated.event is typed in React Native. We add _argMapping in order to
|
|
72
72
|
// have access to the _argMapping property to check for usage of `change*` callbacks.
|
|
73
73
|
// It's also not typed as a function, which is breaking Gesture Handler type definitions.
|
|
74
|
+
type AnimatedMapping = { [key: string]: AnimatedMapping } | Animated.Value;
|
|
75
|
+
|
|
74
76
|
export type AnimatedEvent = {
|
|
75
|
-
_argMapping: (
|
|
77
|
+
_argMapping: (AnimatedMapping | null)[];
|
|
76
78
|
};
|
|
77
79
|
|
|
78
80
|
export type ChangeCalculatorType<TExtendedHandlerData> = (
|