Skip to content

Commit f4b5bdb

Browse files
committed
mocks
1 parent 2bf77bf commit f4b5bdb

4 files changed

Lines changed: 63 additions & 20 deletions

File tree

packages/react-native-gesture-handler/jestSetup.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@ jest.mock('./lib/commonjs/components/GestureComponents', () =>
2727
jest.mock('./lib/commonjs/v3/detectors/HostGestureDetector', () =>
2828
require('./lib/commonjs/mocks/hostDetector')
2929
);
30+
jest.mock('./lib/commonjs/v3/components/Clickable/Clickable', () =>
31+
require('./lib/commonjs/mocks/v3GestureComponents')
32+
);
33+
jest.mock('./lib/commonjs/v3/components/GestureButtons', () =>
34+
require('./lib/commonjs/mocks/v3GestureComponents')
35+
);
36+
jest.mock('./lib/commonjs/v3/components/Pressable', () =>
37+
require('./lib/commonjs/mocks/Pressable')
38+
);
39+
jest.mock('./lib/commonjs/v3/components/GestureComponents', () =>
40+
require('./lib/commonjs/mocks/v3GestureComponents')
41+
);
3042

3143
jest.mock('./lib/module/RNGestureHandlerModule', () =>
3244
require('./lib/module/mocks/module')
@@ -43,6 +55,18 @@ jest.mock('./lib/module/components/GestureComponents', () =>
4355
jest.mock('./lib/module/v3/detectors/HostGestureDetector', () =>
4456
require('./lib/module/mocks/hostDetector')
4557
);
58+
jest.mock('./lib/module/v3/components/Clickable/Clickable', () =>
59+
require('./lib/module/mocks/v3GestureComponents')
60+
);
61+
jest.mock('./lib/module/v3/components/GestureButtons', () =>
62+
require('./lib/module/mocks/v3GestureComponents')
63+
);
64+
jest.mock('./lib/module/v3/components/Pressable', () =>
65+
require('./lib/module/mocks/Pressable')
66+
);
67+
jest.mock('./lib/module/v3/components/GestureComponents', () =>
68+
require('./lib/module/mocks/v3GestureComponents')
69+
);
4670

4771
jest.mock('react-native-worklets', () =>
4872
require('react-native-worklets/src/mock')
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import React from 'react';
22
import { TouchableNativeFeedback, View } from 'react-native';
3-
export const RawButton = ({ enabled, children, ...rest }: any) => (
3+
4+
const RawButton = ({ enabled, children, ...rest }: any) => (
45
<TouchableNativeFeedback disabled={enabled === false} {...rest}>
56
{children ?? <View />}
67
</TouchableNativeFeedback>
78
);
8-
export const BaseButton = RawButton;
9-
export const RectButton = RawButton;
10-
export const BorderlessButton = TouchableNativeFeedback;
11-
export const Clickable = RawButton;
9+
10+
export const LegacyRawButton = RawButton;
11+
export const LegacyBaseButton = RawButton;
12+
export const LegacyRectButton = RawButton;
13+
export const LegacyBorderlessButton = RawButton;
14+
export const LegacyPureNativeButton = RawButton;
Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,15 @@
11
import {
2-
TouchableHighlight,
3-
TouchableNativeFeedback,
4-
TouchableOpacity,
5-
TouchableWithoutFeedback,
62
ScrollView,
73
FlatList,
84
Switch,
95
TextInput,
106
DrawerLayoutAndroid,
7+
RefreshControl,
118
} from 'react-native';
129

13-
export default {
14-
TouchableHighlight,
15-
TouchableNativeFeedback,
16-
TouchableOpacity,
17-
TouchableWithoutFeedback,
18-
ScrollView,
19-
FlatList,
20-
Switch,
21-
TextInput,
22-
DrawerLayoutAndroid,
23-
} as const;
10+
export const LegacyScrollView = ScrollView;
11+
export const LegacyFlatList = FlatList;
12+
export const LegacySwitch = Switch;
13+
export const LegacyTextInput = TextInput;
14+
export const LegacyDrawerLayoutAndroid = DrawerLayoutAndroid;
15+
export const LegacyRefreshControl = RefreshControl;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import React from 'react';
2+
import {
3+
ScrollView,
4+
FlatList,
5+
Switch,
6+
TextInput,
7+
RefreshControl,
8+
TouchableNativeFeedback,
9+
View,
10+
} from 'react-native';
11+
12+
export { ScrollView, FlatList, Switch, TextInput, RefreshControl };
13+
14+
const RawButton = ({ enabled, children, ...rest }: any) => (
15+
<TouchableNativeFeedback disabled={enabled === false} {...rest}>
16+
{children ?? <View />}
17+
</TouchableNativeFeedback>
18+
);
19+
20+
export { RawButton };
21+
export const BaseButton = RawButton;
22+
export const RectButton = RawButton;
23+
export const BorderlessButton = RawButton;
24+
export const Clickable = RawButton;

0 commit comments

Comments
 (0)