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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { HostComponent } from 'react-native';
|
|
2
|
+
import type { HostComponent, ViewStyle } from 'react-native';
|
|
3
3
|
import { Animated, Platform, StyleSheet } from 'react-native';
|
|
4
4
|
|
|
5
5
|
import createNativeWrapper from '../handlers/createNativeWrapper';
|
|
@@ -134,13 +134,12 @@ class InnerBaseButton extends React.Component<BaseButtonWithRefProps> {
|
|
|
134
134
|
};
|
|
135
135
|
|
|
136
136
|
override render() {
|
|
137
|
-
const { rippleColor,
|
|
137
|
+
const { rippleColor, ...rest } = this.props;
|
|
138
138
|
|
|
139
139
|
return (
|
|
140
140
|
<LegacyRawButton
|
|
141
141
|
ref={this.props.innerRef}
|
|
142
142
|
rippleColor={rippleColor}
|
|
143
|
-
style={[style, Platform.OS === 'ios' && { cursor: undefined }]}
|
|
144
143
|
{...rest}
|
|
145
144
|
onGestureEvent={this.onGestureEvent}
|
|
146
145
|
onHandlerStateChange={this.onHandlerStateChange}
|
|
@@ -216,15 +215,15 @@ class InnerRectButton extends React.Component<RectButtonWithRefProps> {
|
|
|
216
215
|
<Animated.View
|
|
217
216
|
style={[
|
|
218
217
|
btnStyles.underlay,
|
|
218
|
+
{ opacity: this.opacity },
|
|
219
219
|
{
|
|
220
|
-
opacity: this.opacity,
|
|
221
220
|
backgroundColor: this.props.underlayColor,
|
|
222
221
|
borderRadius: resolvedStyle.borderRadius,
|
|
223
222
|
borderTopLeftRadius: resolvedStyle.borderTopLeftRadius,
|
|
224
223
|
borderTopRightRadius: resolvedStyle.borderTopRightRadius,
|
|
225
224
|
borderBottomLeftRadius: resolvedStyle.borderBottomLeftRadius,
|
|
226
225
|
borderBottomRightRadius: resolvedStyle.borderBottomRightRadius,
|
|
227
|
-
},
|
|
226
|
+
} as ViewStyle,
|
|
228
227
|
]}
|
|
229
228
|
/>
|
|
230
229
|
{children}
|
|
@@ -294,6 +293,13 @@ export const LegacyBorderlessButton = ({
|
|
|
294
293
|
/**
|
|
295
294
|
* @deprecated use `PureNativeButton` instead
|
|
296
295
|
*/
|
|
297
|
-
export const LegacyPureNativeButton = (
|
|
298
|
-
|
|
299
|
-
|
|
296
|
+
export const LegacyPureNativeButton = ({
|
|
297
|
+
ref,
|
|
298
|
+
...props
|
|
299
|
+
}: Omit<ButtonProps, 'needsOffscreenAlphaCompositing'>) => (
|
|
300
|
+
<GestureHandlerButton
|
|
301
|
+
{...props}
|
|
302
|
+
ref={ref as React.Ref<React.ComponentRef<typeof GestureHandlerButton>>}
|
|
303
|
+
needsOffscreenAlphaCompositing
|
|
304
|
+
/>
|
|
305
|
+
);
|
|
@@ -47,15 +47,16 @@ const GHScrollView = createNativeWrapper<PropsWithChildren<RNScrollViewProps>>(
|
|
|
47
47
|
export const LegacyScrollView = (
|
|
48
48
|
props: RNScrollViewProps &
|
|
49
49
|
NativeViewGestureHandlerProps & {
|
|
50
|
-
ref?: React.Ref<RNScrollView | null>;
|
|
50
|
+
ref?: React.Ref<React.ComponentRef<typeof RNScrollView> | null>;
|
|
51
51
|
}
|
|
52
52
|
) => {
|
|
53
53
|
const refreshControlGestureRef = React.useRef<LegacyRefreshControl>(null);
|
|
54
|
-
const { refreshControl, waitFor, ...rest } = props;
|
|
54
|
+
const { refreshControl, waitFor, ref, ...rest } = props;
|
|
55
55
|
|
|
56
56
|
return (
|
|
57
57
|
<GHScrollView
|
|
58
58
|
{...rest}
|
|
59
|
+
ref={ref as React.Ref<React.ComponentType<any> | null>}
|
|
59
60
|
waitFor={[...toArray(waitFor ?? []), refreshControlGestureRef]}
|
|
60
61
|
// @ts-ignore we don't pass `refreshing` prop as we only want to override the ref
|
|
61
62
|
refreshControl={
|
|
@@ -73,7 +74,8 @@ export const LegacyScrollView = (
|
|
|
73
74
|
// Backward type compatibility with https://github.com/software-mansion/react-native-gesture-handler/blob/db78d3ca7d48e8ba57482d3fe9b0a15aa79d9932/react-native-gesture-handler.d.ts#L440-L457
|
|
74
75
|
// include methods of wrapped components by creating an intersection type with the RN component instead of duplicating them.
|
|
75
76
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
76
|
-
export type LegacyScrollView = typeof GHScrollView &
|
|
77
|
+
export type LegacyScrollView = typeof GHScrollView &
|
|
78
|
+
React.ComponentRef<typeof RNScrollView>;
|
|
77
79
|
|
|
78
80
|
/**
|
|
79
81
|
* @deprecated use `Switch` instead
|
|
@@ -97,9 +99,12 @@ export type LegacyTextInput = typeof LegacyTextInput & RNTextInput;
|
|
|
97
99
|
/**
|
|
98
100
|
* @deprecated use `DrawerLayoutAndroid` instead
|
|
99
101
|
*/
|
|
100
|
-
export const LegacyDrawerLayoutAndroid
|
|
101
|
-
PropsWithChildren<RNDrawerLayoutAndroidProps>
|
|
102
|
-
>
|
|
102
|
+
export const LegacyDrawerLayoutAndroid: React.ComponentType<
|
|
103
|
+
PropsWithChildren<RNDrawerLayoutAndroidProps> & NativeViewGestureHandlerProps
|
|
104
|
+
> = createNativeWrapper<PropsWithChildren<RNDrawerLayoutAndroidProps>>(
|
|
105
|
+
RNDrawerLayoutAndroid,
|
|
106
|
+
{ disallowInterruption: true }
|
|
107
|
+
);
|
|
103
108
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
104
109
|
export type LegacyDrawerLayoutAndroid = typeof LegacyDrawerLayoutAndroid &
|
|
105
110
|
RNDrawerLayoutAndroid;
|
|
@@ -68,6 +68,7 @@ const LegacyPressable = (props: LegacyPressableProps) => {
|
|
|
68
68
|
simultaneousWithExternalGesture,
|
|
69
69
|
requireExternalGestureToFail,
|
|
70
70
|
blocksExternalGesture,
|
|
71
|
+
ref,
|
|
71
72
|
...remainingProps
|
|
72
73
|
} = props;
|
|
73
74
|
|
|
@@ -385,6 +386,7 @@ const LegacyPressable = (props: LegacyPressableProps) => {
|
|
|
385
386
|
<GestureDetector gesture={gesture}>
|
|
386
387
|
<NativeButton
|
|
387
388
|
{...remainingProps}
|
|
389
|
+
ref={ref as React.Ref<React.ComponentRef<typeof NativeButton>>}
|
|
388
390
|
needsOffscreenAlphaCompositing
|
|
389
391
|
onLayout={setDimensions}
|
|
390
392
|
accessible={accessible !== false}
|
|
@@ -109,7 +109,7 @@ interface CommonPressableProps
|
|
|
109
109
|
/**
|
|
110
110
|
* A reference to the pressable element.
|
|
111
111
|
*/
|
|
112
|
-
ref?: React.Ref<View
|
|
112
|
+
ref?: React.Ref<React.ComponentRef<typeof View>>;
|
|
113
113
|
|
|
114
114
|
/**
|
|
115
115
|
* Either children or a render prop that receives a boolean reflecting whether
|
|
@@ -596,8 +596,10 @@ const DrawerLayout = function DrawerLayout(
|
|
|
596
596
|
const reverseContentDirection = I18nManager.isRTL ? isFromLeft : !isFromLeft;
|
|
597
597
|
|
|
598
598
|
const dynamicDrawerStyles = {
|
|
599
|
-
backgroundColor: drawerBackgroundColor,
|
|
600
599
|
width: drawerWidth,
|
|
600
|
+
...(drawerBackgroundColor !== undefined && {
|
|
601
|
+
backgroundColor: drawerBackgroundColor,
|
|
602
|
+
}),
|
|
601
603
|
};
|
|
602
604
|
|
|
603
605
|
const containerStyles = useAnimatedStyle(() => {
|
package/src/components/Text.tsx
CHANGED
|
@@ -9,7 +9,7 @@ import { GestureObjects as Gesture } from '../handlers/gestures/gestureObjects';
|
|
|
9
9
|
type TextProps = RNTextProps & {
|
|
10
10
|
ref?: Ref<ComponentRef<typeof RNText> | null>;
|
|
11
11
|
};
|
|
12
|
-
type RNGHTextRef = Ref<RNText | null> & { rngh?: boolean };
|
|
12
|
+
type RNGHTextRef = Ref<ComponentRef<typeof RNText> | null> & { rngh?: boolean };
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @deprecated `LegacyText` is deprecated. Since Gesture Handler 3, you should wrap `Text` with `GestureDetector`, `InterceptingGestureDetector`, or `VirtualGestureDetector`.
|
|
@@ -17,11 +17,11 @@ type RNGHTextRef = Ref<RNText | null> & { rngh?: boolean };
|
|
|
17
17
|
export const LegacyText = (props: TextProps) => {
|
|
18
18
|
const { onPress, onLongPress, ref, ...rest } = props;
|
|
19
19
|
|
|
20
|
-
const textRef = useRef<RNText | null>(null);
|
|
20
|
+
const textRef = useRef<ComponentRef<typeof RNText> | null>(null);
|
|
21
21
|
const native = useMemo(() => Gesture.Native().runOnJS(true), []);
|
|
22
22
|
|
|
23
23
|
const refHandler = useMemo(() => {
|
|
24
|
-
const handler: RNGHTextRef = (node: RNText | null) => {
|
|
24
|
+
const handler: RNGHTextRef = (node: ComponentRef<typeof RNText> | null) => {
|
|
25
25
|
textRef.current = node;
|
|
26
26
|
|
|
27
27
|
if (!ref) {
|
|
@@ -4,8 +4,9 @@ import type {
|
|
|
4
4
|
ColorValue,
|
|
5
5
|
TouchableHighlightProps as RNTouchableHighlightProps,
|
|
6
6
|
ViewProps,
|
|
7
|
+
ViewStyle,
|
|
7
8
|
} from 'react-native';
|
|
8
|
-
import {
|
|
9
|
+
import { View } from 'react-native';
|
|
9
10
|
|
|
10
11
|
import GenericTouchable, { TOUCHABLE_STATE } from './GenericTouchable';
|
|
11
12
|
import type { GenericTouchableProps } from './GenericTouchableProps';
|
|
@@ -88,7 +89,9 @@ export default class TouchableHighlight extends Component<
|
|
|
88
89
|
this.props.children
|
|
89
90
|
) as React.ReactElement<ViewProps>; // TODO: not sure if OK but fixes error
|
|
90
91
|
return React.cloneElement(child, {
|
|
91
|
-
style:
|
|
92
|
+
style: this.state.extraChildStyle
|
|
93
|
+
? [child.props.style, this.state.extraChildStyle as ViewStyle]
|
|
94
|
+
: child.props.style,
|
|
92
95
|
});
|
|
93
96
|
}
|
|
94
97
|
|
|
@@ -109,7 +112,7 @@ export default class TouchableHighlight extends Component<
|
|
|
109
112
|
return (
|
|
110
113
|
<GenericTouchable
|
|
111
114
|
{...rest}
|
|
112
|
-
style={[style, extraUnderlayStyle]}
|
|
115
|
+
style={[style, extraUnderlayStyle as ViewStyle]}
|
|
113
116
|
onStateChange={this.onStateChange}>
|
|
114
117
|
{this.renderChildren()}
|
|
115
118
|
</GenericTouchable>
|
|
@@ -43,7 +43,12 @@ export default class TouchableNativeFeedback extends Component<TouchableNativeFe
|
|
|
43
43
|
color: ColorValue,
|
|
44
44
|
borderless: boolean,
|
|
45
45
|
rippleRadius?: number
|
|
46
|
-
)
|
|
46
|
+
): {
|
|
47
|
+
type: 'RippleAndroid';
|
|
48
|
+
color: ColorValue;
|
|
49
|
+
borderless: boolean;
|
|
50
|
+
rippleRadius: number | undefined;
|
|
51
|
+
} => ({
|
|
47
52
|
type: 'RippleAndroid',
|
|
48
53
|
color,
|
|
49
54
|
borderless,
|
|
@@ -61,7 +66,8 @@ export default class TouchableNativeFeedback extends Component<TouchableNativeFe
|
|
|
61
66
|
// TODO(TS): check if it works the same as previous implementation - looks like it works the same as RN component, so it should be ok
|
|
62
67
|
if (background.type === 'RippleAndroid') {
|
|
63
68
|
extraProps['borderless'] = background.borderless;
|
|
64
|
-
extraProps['rippleColor'] =
|
|
69
|
+
extraProps['rippleColor'] =
|
|
70
|
+
background.color as TouchableNativeFeedbackExtraProps['rippleColor'];
|
|
65
71
|
} else if (background.type === 'ThemeAttrAndroid') {
|
|
66
72
|
extraProps['borderless'] =
|
|
67
73
|
background.attribute === 'selectableItemBackgroundBorderless';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComponentClass } from 'react';
|
|
1
|
+
import type { ComponentClass, ComponentType } from 'react';
|
|
2
2
|
|
|
3
3
|
import { ghQueueMicrotask } from '../../ghQueueMicrotask';
|
|
4
4
|
import { tagMessage } from '../../utils';
|
|
@@ -50,7 +50,7 @@ let Reanimated:
|
|
|
50
50
|
default: {
|
|
51
51
|
// Slightly modified definition copied from 'react-native-reanimated'
|
|
52
52
|
createAnimatedComponent<P extends object>(
|
|
53
|
-
component:
|
|
53
|
+
component: ComponentType<P>,
|
|
54
54
|
options?: unknown
|
|
55
55
|
): ComponentClass<P>;
|
|
56
56
|
};
|
|
@@ -1,27 +1,38 @@
|
|
|
1
|
-
import type { TurboModule } from 'react-native';
|
|
1
|
+
import type { CodegenTypes, TurboModule } from 'react-native';
|
|
2
2
|
import { TurboModuleRegistry } from 'react-native';
|
|
3
|
-
import type { Double } from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
3
|
|
|
5
4
|
export interface Spec extends TurboModule {
|
|
6
5
|
createGestureHandler: (
|
|
7
6
|
handlerName: string,
|
|
8
|
-
handlerTag: Double,
|
|
7
|
+
handlerTag: CodegenTypes.Double,
|
|
9
8
|
// Record<> is not supported by codegen
|
|
10
9
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
11
10
|
config: Object
|
|
12
11
|
) => void;
|
|
13
12
|
attachGestureHandler: (
|
|
14
|
-
handlerTag: Double,
|
|
15
|
-
newView: Double,
|
|
16
|
-
actionType: Double
|
|
13
|
+
handlerTag: CodegenTypes.Double,
|
|
14
|
+
newView: CodegenTypes.Double,
|
|
15
|
+
actionType: CodegenTypes.Double
|
|
17
16
|
) => void;
|
|
18
|
-
|
|
19
|
-
setGestureHandlerConfig: (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
|
|
18
|
+
setGestureHandlerConfig: (
|
|
19
|
+
handlerTag: CodegenTypes.Double,
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
21
|
+
newConfig: Object
|
|
22
|
+
) => void;
|
|
23
|
+
|
|
24
|
+
updateGestureHandlerConfig: (
|
|
25
|
+
handlerTag: CodegenTypes.Double,
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
27
|
+
newConfig: Object
|
|
28
|
+
) => void;
|
|
29
|
+
|
|
30
|
+
configureRelations: (
|
|
31
|
+
handlerTag: CodegenTypes.Double,
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
33
|
+
relations: Object
|
|
34
|
+
) => void;
|
|
35
|
+
dropGestureHandler: (handlerTag: CodegenTypes.Double) => void;
|
|
25
36
|
flushOperations: () => void;
|
|
26
37
|
installUIRuntimeBindings: () => boolean;
|
|
27
38
|
}
|
|
@@ -1,59 +1,61 @@
|
|
|
1
|
-
import type { ColorValue, ViewProps } from 'react-native';
|
|
2
1
|
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from 'react-native
|
|
8
|
-
import codegenNativeComponent from 'react-native
|
|
2
|
+
CodegenTypes,
|
|
3
|
+
ColorValue,
|
|
4
|
+
HostComponent,
|
|
5
|
+
ViewProps,
|
|
6
|
+
} from 'react-native';
|
|
7
|
+
import { codegenNativeComponent } from 'react-native';
|
|
9
8
|
|
|
10
9
|
// @ts-ignore - Redefining pointerEvents with WithDefault for codegen, conflicts with ViewProps type but codegen needs it
|
|
11
10
|
interface NativeProps extends ViewProps {
|
|
12
|
-
exclusive?: WithDefault<boolean, true>;
|
|
11
|
+
exclusive?: CodegenTypes.WithDefault<boolean, true>;
|
|
13
12
|
foreground?: boolean;
|
|
14
13
|
borderless?: boolean;
|
|
15
|
-
enabled?: WithDefault<boolean, true>;
|
|
14
|
+
enabled?: CodegenTypes.WithDefault<boolean, true>;
|
|
16
15
|
rippleColor?: ColorValue;
|
|
17
|
-
rippleRadius?: Int32;
|
|
18
|
-
touchSoundDisabled?: WithDefault<boolean, false>;
|
|
19
|
-
pointerEvents?: WithDefault<
|
|
16
|
+
rippleRadius?: CodegenTypes.Int32;
|
|
17
|
+
touchSoundDisabled?: CodegenTypes.WithDefault<boolean, false>;
|
|
18
|
+
pointerEvents?: CodegenTypes.WithDefault<
|
|
20
19
|
'box-none' | 'none' | 'box-only' | 'auto',
|
|
21
20
|
'auto'
|
|
22
21
|
>;
|
|
23
|
-
tapAnimationInDuration?: WithDefault<Int32, 50>;
|
|
24
|
-
tapAnimationOutDuration?: WithDefault<Int32, 100>;
|
|
25
|
-
longPressDuration?: WithDefault<Int32, -1>;
|
|
26
|
-
longPressAnimationOutDuration?: WithDefault<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
tapAnimationInDuration?: CodegenTypes.WithDefault<CodegenTypes.Int32, 50>;
|
|
23
|
+
tapAnimationOutDuration?: CodegenTypes.WithDefault<CodegenTypes.Int32, 100>;
|
|
24
|
+
longPressDuration?: CodegenTypes.WithDefault<CodegenTypes.Int32, -1>;
|
|
25
|
+
longPressAnimationOutDuration?: CodegenTypes.WithDefault<
|
|
26
|
+
CodegenTypes.Int32,
|
|
27
|
+
-1
|
|
28
|
+
>;
|
|
29
|
+
needsOffscreenAlphaCompositing?: CodegenTypes.WithDefault<boolean, false>;
|
|
30
|
+
activeOpacity?: CodegenTypes.WithDefault<CodegenTypes.Float, 1>;
|
|
31
|
+
activeScale?: CodegenTypes.WithDefault<CodegenTypes.Float, 1>;
|
|
32
|
+
activeUnderlayOpacity?: CodegenTypes.WithDefault<CodegenTypes.Float, 0>;
|
|
31
33
|
// Hover values default to -1 as an "unset" sentinel; the native side
|
|
32
34
|
// resolves them to the corresponding default* value (matching web, where
|
|
33
35
|
// an omitted hover value falls back to its default counterpart).
|
|
34
|
-
hoverOpacity?: WithDefault<Float, -1>;
|
|
35
|
-
hoverScale?: WithDefault<Float, -1>;
|
|
36
|
-
hoverUnderlayOpacity?: WithDefault<Float, -1>;
|
|
37
|
-
hoverAnimationInDuration?: WithDefault<Int32, 50>;
|
|
38
|
-
hoverAnimationOutDuration?: WithDefault<Int32, 100>;
|
|
39
|
-
defaultOpacity?: WithDefault<Float, 1>;
|
|
40
|
-
defaultScale?: WithDefault<Float, 1>;
|
|
41
|
-
defaultUnderlayOpacity?: WithDefault<Float, 0>;
|
|
36
|
+
hoverOpacity?: CodegenTypes.WithDefault<CodegenTypes.Float, -1>;
|
|
37
|
+
hoverScale?: CodegenTypes.WithDefault<CodegenTypes.Float, -1>;
|
|
38
|
+
hoverUnderlayOpacity?: CodegenTypes.WithDefault<CodegenTypes.Float, -1>;
|
|
39
|
+
hoverAnimationInDuration?: CodegenTypes.WithDefault<CodegenTypes.Int32, 50>;
|
|
40
|
+
hoverAnimationOutDuration?: CodegenTypes.WithDefault<CodegenTypes.Int32, 100>;
|
|
41
|
+
defaultOpacity?: CodegenTypes.WithDefault<CodegenTypes.Float, 1>;
|
|
42
|
+
defaultScale?: CodegenTypes.WithDefault<CodegenTypes.Float, 1>;
|
|
43
|
+
defaultUnderlayOpacity?: CodegenTypes.WithDefault<CodegenTypes.Float, 0>;
|
|
42
44
|
underlayColor?: ColorValue;
|
|
43
45
|
|
|
44
46
|
// Border style
|
|
45
|
-
borderWidth?: Float;
|
|
47
|
+
borderWidth?: CodegenTypes.Float;
|
|
46
48
|
borderColor?: ColorValue;
|
|
47
|
-
borderStyle?: WithDefault<string, 'solid'>;
|
|
48
|
-
overflow?: WithDefault<string, 'visible'>;
|
|
49
|
+
borderStyle?: CodegenTypes.WithDefault<string, 'solid'>;
|
|
50
|
+
overflow?: CodegenTypes.WithDefault<string, 'visible'>;
|
|
49
51
|
|
|
50
52
|
// Border width per-edge
|
|
51
|
-
borderLeftWidth?: Float;
|
|
52
|
-
borderRightWidth?: Float;
|
|
53
|
-
borderTopWidth?: Float;
|
|
54
|
-
borderBottomWidth?: Float;
|
|
55
|
-
borderStartWidth?: Float;
|
|
56
|
-
borderEndWidth?: Float;
|
|
53
|
+
borderLeftWidth?: CodegenTypes.Float;
|
|
54
|
+
borderRightWidth?: CodegenTypes.Float;
|
|
55
|
+
borderTopWidth?: CodegenTypes.Float;
|
|
56
|
+
borderBottomWidth?: CodegenTypes.Float;
|
|
57
|
+
borderStartWidth?: CodegenTypes.Float;
|
|
58
|
+
borderEndWidth?: CodegenTypes.Float;
|
|
57
59
|
|
|
58
60
|
// Border color per-edge
|
|
59
61
|
borderLeftColor?: ColorValue;
|
|
@@ -75,19 +77,21 @@ interface NativeProps extends ViewProps {
|
|
|
75
77
|
// through our delegate instead of falling through to
|
|
76
78
|
// BaseViewManagerDelegate, which casts to Double and would crash on a
|
|
77
79
|
// string value.
|
|
78
|
-
borderRadius?: UnsafeMixed;
|
|
79
|
-
borderTopLeftRadius?: UnsafeMixed;
|
|
80
|
-
borderTopRightRadius?: UnsafeMixed;
|
|
81
|
-
borderBottomLeftRadius?: UnsafeMixed;
|
|
82
|
-
borderBottomRightRadius?: UnsafeMixed;
|
|
83
|
-
borderTopStartRadius?: UnsafeMixed;
|
|
84
|
-
borderTopEndRadius?: UnsafeMixed;
|
|
85
|
-
borderBottomStartRadius?: UnsafeMixed;
|
|
86
|
-
borderBottomEndRadius?: UnsafeMixed;
|
|
87
|
-
borderEndEndRadius?: UnsafeMixed;
|
|
88
|
-
borderEndStartRadius?: UnsafeMixed;
|
|
89
|
-
borderStartEndRadius?: UnsafeMixed;
|
|
90
|
-
borderStartStartRadius?: UnsafeMixed;
|
|
80
|
+
borderRadius?: CodegenTypes.UnsafeMixed;
|
|
81
|
+
borderTopLeftRadius?: CodegenTypes.UnsafeMixed;
|
|
82
|
+
borderTopRightRadius?: CodegenTypes.UnsafeMixed;
|
|
83
|
+
borderBottomLeftRadius?: CodegenTypes.UnsafeMixed;
|
|
84
|
+
borderBottomRightRadius?: CodegenTypes.UnsafeMixed;
|
|
85
|
+
borderTopStartRadius?: CodegenTypes.UnsafeMixed;
|
|
86
|
+
borderTopEndRadius?: CodegenTypes.UnsafeMixed;
|
|
87
|
+
borderBottomStartRadius?: CodegenTypes.UnsafeMixed;
|
|
88
|
+
borderBottomEndRadius?: CodegenTypes.UnsafeMixed;
|
|
89
|
+
borderEndEndRadius?: CodegenTypes.UnsafeMixed;
|
|
90
|
+
borderEndStartRadius?: CodegenTypes.UnsafeMixed;
|
|
91
|
+
borderStartEndRadius?: CodegenTypes.UnsafeMixed;
|
|
92
|
+
borderStartStartRadius?: CodegenTypes.UnsafeMixed;
|
|
91
93
|
}
|
|
92
94
|
|
|
93
|
-
export default codegenNativeComponent<NativeProps>(
|
|
95
|
+
export default codegenNativeComponent<NativeProps>(
|
|
96
|
+
'RNGestureHandlerButton'
|
|
97
|
+
) as HostComponent<NativeProps>;
|
|
@@ -1,81 +1,76 @@
|
|
|
1
|
-
import type { ViewProps } from 'react-native';
|
|
2
|
-
import
|
|
3
|
-
DirectEventHandler,
|
|
4
|
-
Double,
|
|
5
|
-
Int32,
|
|
6
|
-
UnsafeMixed,
|
|
7
|
-
WithDefault,
|
|
8
|
-
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
9
|
-
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
1
|
+
import type { CodegenTypes, HostComponent, ViewProps } from 'react-native';
|
|
2
|
+
import { codegenNativeComponent } from 'react-native';
|
|
10
3
|
|
|
11
4
|
type GestureHandlerEvent = Readonly<{
|
|
12
|
-
handlerTag: Int32;
|
|
13
|
-
state: Int32;
|
|
14
|
-
handlerData: UnsafeMixed;
|
|
5
|
+
handlerTag: CodegenTypes.Int32;
|
|
6
|
+
state: CodegenTypes.Int32;
|
|
7
|
+
handlerData: CodegenTypes.UnsafeMixed;
|
|
15
8
|
}>;
|
|
16
9
|
|
|
17
10
|
type GestureHandlerStateChangeEvent = Readonly<{
|
|
18
|
-
handlerTag: Int32;
|
|
19
|
-
state: Int32;
|
|
20
|
-
oldState: Int32;
|
|
21
|
-
handlerData: UnsafeMixed;
|
|
11
|
+
handlerTag: CodegenTypes.Int32;
|
|
12
|
+
state: CodegenTypes.Int32;
|
|
13
|
+
oldState: CodegenTypes.Int32;
|
|
14
|
+
handlerData: CodegenTypes.UnsafeMixed;
|
|
22
15
|
}>;
|
|
23
16
|
|
|
24
17
|
type GestureHandlerTouchEvent = Readonly<{
|
|
25
|
-
handlerTag: Int32;
|
|
26
|
-
numberOfTouches: Int32;
|
|
27
|
-
state: Int32;
|
|
28
|
-
eventType: Int32;
|
|
18
|
+
handlerTag: CodegenTypes.Int32;
|
|
19
|
+
numberOfTouches: CodegenTypes.Int32;
|
|
20
|
+
state: CodegenTypes.Int32;
|
|
21
|
+
eventType: CodegenTypes.Int32;
|
|
29
22
|
allTouches: {
|
|
30
|
-
id: Int32;
|
|
31
|
-
x: Double;
|
|
32
|
-
y: Double;
|
|
33
|
-
absoluteX: Double;
|
|
34
|
-
absoluteY: Double;
|
|
23
|
+
id: CodegenTypes.Int32;
|
|
24
|
+
x: CodegenTypes.Double;
|
|
25
|
+
y: CodegenTypes.Double;
|
|
26
|
+
absoluteX: CodegenTypes.Double;
|
|
27
|
+
absoluteY: CodegenTypes.Double;
|
|
35
28
|
}[];
|
|
36
29
|
changedTouches: {
|
|
37
|
-
id: Int32;
|
|
38
|
-
x: Double;
|
|
39
|
-
y: Double;
|
|
40
|
-
absoluteX: Double;
|
|
41
|
-
absoluteY: Double;
|
|
30
|
+
id: CodegenTypes.Int32;
|
|
31
|
+
x: CodegenTypes.Double;
|
|
32
|
+
y: CodegenTypes.Double;
|
|
33
|
+
absoluteX: CodegenTypes.Double;
|
|
34
|
+
absoluteY: CodegenTypes.Double;
|
|
42
35
|
}[];
|
|
43
|
-
pointerType: Int32;
|
|
36
|
+
pointerType: CodegenTypes.Int32;
|
|
44
37
|
}>;
|
|
45
38
|
|
|
46
39
|
export interface VirtualChildrenProps {
|
|
47
|
-
handlerTags: Int32[];
|
|
48
|
-
viewTag: Int32;
|
|
40
|
+
handlerTags: CodegenTypes.Int32[];
|
|
41
|
+
viewTag: CodegenTypes.Int32;
|
|
49
42
|
}
|
|
50
43
|
|
|
51
44
|
// @ts-expect-error WithDefault adds `| null` to the type, which doesn't align with ViewProps.pointerEvents
|
|
52
45
|
// Using Exclude to remove null from the type makes the error go away, but breaks codegen.
|
|
53
46
|
export interface NativeProps extends ViewProps {
|
|
54
|
-
onGestureHandlerEvent?:
|
|
47
|
+
onGestureHandlerEvent?:
|
|
48
|
+
| CodegenTypes.DirectEventHandler<GestureHandlerEvent>
|
|
49
|
+
| undefined;
|
|
55
50
|
onGestureHandlerStateChange?:
|
|
56
|
-
| DirectEventHandler<GestureHandlerStateChangeEvent>
|
|
51
|
+
| CodegenTypes.DirectEventHandler<GestureHandlerStateChangeEvent>
|
|
57
52
|
| undefined;
|
|
58
53
|
onGestureHandlerTouchEvent?:
|
|
59
|
-
| DirectEventHandler<GestureHandlerTouchEvent>
|
|
54
|
+
| CodegenTypes.DirectEventHandler<GestureHandlerTouchEvent>
|
|
60
55
|
| undefined;
|
|
61
56
|
onGestureHandlerReanimatedEvent?:
|
|
62
|
-
| DirectEventHandler<GestureHandlerEvent>
|
|
57
|
+
| CodegenTypes.DirectEventHandler<GestureHandlerEvent>
|
|
63
58
|
| undefined;
|
|
64
59
|
onGestureHandlerReanimatedStateChange?:
|
|
65
|
-
| DirectEventHandler<GestureHandlerStateChangeEvent>
|
|
60
|
+
| CodegenTypes.DirectEventHandler<GestureHandlerStateChangeEvent>
|
|
66
61
|
| undefined;
|
|
67
62
|
onGestureHandlerReanimatedTouchEvent?:
|
|
68
|
-
| DirectEventHandler<GestureHandlerTouchEvent>
|
|
63
|
+
| CodegenTypes.DirectEventHandler<GestureHandlerTouchEvent>
|
|
69
64
|
| undefined;
|
|
70
65
|
onGestureHandlerAnimatedEvent?:
|
|
71
|
-
| DirectEventHandler<GestureHandlerEvent>
|
|
66
|
+
| CodegenTypes.DirectEventHandler<GestureHandlerEvent>
|
|
72
67
|
| undefined;
|
|
73
68
|
|
|
74
|
-
handlerTags: Int32[];
|
|
75
|
-
moduleId: Int32;
|
|
69
|
+
handlerTags: CodegenTypes.Int32[];
|
|
70
|
+
moduleId: CodegenTypes.Int32;
|
|
76
71
|
virtualChildren: VirtualChildrenProps[];
|
|
77
72
|
|
|
78
|
-
pointerEvents?: WithDefault<
|
|
73
|
+
pointerEvents?: CodegenTypes.WithDefault<
|
|
79
74
|
'box-none' | 'none' | 'box-only' | 'auto',
|
|
80
75
|
'auto'
|
|
81
76
|
>;
|
|
@@ -83,4 +78,4 @@ export interface NativeProps extends ViewProps {
|
|
|
83
78
|
|
|
84
79
|
export default codegenNativeComponent<NativeProps>('RNGestureHandlerDetector', {
|
|
85
80
|
interfaceOnly: true,
|
|
86
|
-
})
|
|
81
|
+
}) as HostComponent<NativeProps>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { ViewProps } from 'react-native';
|
|
2
|
-
import
|
|
3
|
-
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
1
|
+
import type { CodegenTypes, HostComponent, ViewProps } from 'react-native';
|
|
2
|
+
import { codegenNativeComponent } from 'react-native';
|
|
4
3
|
|
|
5
4
|
// Publicly accessible type, moduleId is set internally
|
|
6
5
|
export interface RootViewNativeProps extends ViewProps {
|
|
@@ -8,8 +7,10 @@ export interface RootViewNativeProps extends ViewProps {
|
|
|
8
7
|
}
|
|
9
8
|
|
|
10
9
|
interface NativeProps extends ViewProps {
|
|
11
|
-
moduleId: Int32;
|
|
10
|
+
moduleId: CodegenTypes.Int32;
|
|
12
11
|
unstable_forceActive?: boolean;
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
export default codegenNativeComponent<NativeProps>(
|
|
14
|
+
export default codegenNativeComponent<NativeProps>(
|
|
15
|
+
'RNGestureHandlerRootView'
|
|
16
|
+
) as HostComponent<NativeProps>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useRef } from 'react';
|
|
2
|
+
import type { ViewStyle } from 'react-native';
|
|
2
3
|
import { Animated, Platform, StyleSheet } from 'react-native';
|
|
3
4
|
|
|
4
5
|
import GestureHandlerButton from '../../components/GestureHandlerButton';
|
|
@@ -23,7 +24,7 @@ type RawButtonInnerProps = RawButtonProps & {
|
|
|
23
24
|
const RawButtonInner = createNativeWrapper<
|
|
24
25
|
React.ComponentRef<typeof GestureHandlerButton>,
|
|
25
26
|
RawButtonInnerProps
|
|
26
|
-
>(GestureHandlerButton
|
|
27
|
+
>(GestureHandlerButton as React.ComponentType<RawButtonInnerProps>, {
|
|
27
28
|
shouldCancelWhenOutside: false,
|
|
28
29
|
shouldActivateOnStart: false,
|
|
29
30
|
});
|
|
@@ -46,7 +47,7 @@ export const BaseButton = (props: BaseButtonProps) => {
|
|
|
46
47
|
|
|
47
48
|
const delayLongPress = props.delayLongPress ?? 600;
|
|
48
49
|
|
|
49
|
-
const { onLongPress, onPress, onActiveStateChange,
|
|
50
|
+
const { onLongPress, onPress, onActiveStateChange, ...rest } = props;
|
|
50
51
|
|
|
51
52
|
const wrappedLongPress = () => {
|
|
52
53
|
longPressDetected.current = true;
|
|
@@ -100,7 +101,6 @@ export const BaseButton = (props: BaseButtonProps) => {
|
|
|
100
101
|
|
|
101
102
|
return (
|
|
102
103
|
<RawButton
|
|
103
|
-
style={[style, Platform.OS === 'ios' && { cursor: undefined }]}
|
|
104
104
|
{...rest}
|
|
105
105
|
{...tvProps}
|
|
106
106
|
onBegin={onBegin}
|
|
@@ -155,15 +155,15 @@ export const RectButton = (props: RectButtonProps) => {
|
|
|
155
155
|
<Animated.View
|
|
156
156
|
style={[
|
|
157
157
|
btnStyles.underlay,
|
|
158
|
+
{ opacity },
|
|
158
159
|
{
|
|
159
|
-
opacity,
|
|
160
160
|
backgroundColor: underlayColor,
|
|
161
|
-
borderRadius: resolvedStyle
|
|
162
|
-
borderTopLeftRadius: resolvedStyle
|
|
163
|
-
borderTopRightRadius: resolvedStyle
|
|
164
|
-
borderBottomLeftRadius: resolvedStyle
|
|
165
|
-
borderBottomRightRadius: resolvedStyle
|
|
166
|
-
},
|
|
161
|
+
borderRadius: resolvedStyle?.borderRadius,
|
|
162
|
+
borderTopLeftRadius: resolvedStyle?.borderTopLeftRadius,
|
|
163
|
+
borderTopRightRadius: resolvedStyle?.borderTopRightRadius,
|
|
164
|
+
borderBottomLeftRadius: resolvedStyle?.borderBottomLeftRadius,
|
|
165
|
+
borderBottomRightRadius: resolvedStyle?.borderBottomRightRadius,
|
|
166
|
+
} as ViewStyle,
|
|
167
167
|
]}
|
|
168
168
|
/>
|
|
169
169
|
{children}
|