Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: ['react-native-reanimated/plugin'],
plugins: ['react-native-worklets/plugin'],
};
32 changes: 27 additions & 5 deletions jest/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,35 @@
import 'react-native-gesture-handler/jestSetup';

jest.mock('react-native-reanimated', () => {
const Reanimated = require('react-native-reanimated/mock');
const RN = require('react-native');

// The mock for `call` immediately calls the callback which is incorrect
// So we override it with a no-op
Reanimated.default.call = () => {};
const mockValue = (initialValue) => ({
value: initialValue,
addListener: jest.fn(),
removeListener: jest.fn(),
removeAllListeners: jest.fn(),
});

return Reanimated;
return {
__esModule: true,
default: {
createAnimatedComponent: jest.fn((Component) => Component),
call: () => {},
View: RN.View,
Text: RN.Text,
Image: RN.Image,
ScrollView: RN.ScrollView,
},
createAnimatedComponent: jest.fn((Component) => Component),
useSharedValue: jest.fn((initialValue) => mockValue(initialValue)),
useDerivedValue: jest.fn(() => mockValue(0)),
useAnimatedStyle: jest.fn(() => ({})),
interpolate: jest.fn(),
interpolateColor: jest.fn(),
withTiming: jest.fn((toValue) => toValue),
withSpring: jest.fn((toValue) => toValue),
Extrapolate: { CLAMP: 'clamp', EXTEND: 'extend', IDENTITY: 'identity' },
};
});

// Silence the warning: Animated: `useNativeDriver` is not supported because the native animated module is missing
Expand Down
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@
"dependencies": {
"postinstall-postinstall": "^2.1.0",
"react-native-date-picker": "^5.0.13",
"react-native-paper": "^5.14.5",
"react-native-reanimated": "^3.17.5",
"react-native-safe-area-context": "^5.5.0",
"react-native-vector-icons": "^10.2.0"
"react-native-paper": "5.15.3",
"react-native-reanimated": "4.3.3",
"react-native-safe-area-context": "^5.8.0",
"react-native-vector-icons": "10.0.3",
"react-native-worklets": "0.8.3"
},
"devDependencies": {
"@commitlint/cli": "^17.4.0",
Expand Down Expand Up @@ -82,7 +83,7 @@
"react": "17.0.2",
"react-native": "0.66.4",
"react-native-builder-bob": "^0.18.0",
"react-native-gesture-handler": "^2.4.2",
"react-native-gesture-handler": "3.0.2",
"react-test-renderer": "^17.0.2",
"semantic-release": "^19.0.5",
"typescript": "^4.1.3"
Expand All @@ -107,7 +108,7 @@
],
"verbose": true,
"transformIgnorePatterns": [
"node_modules/(?!(@react-native|react-native|react-native-vector-icons|react-native-iphone-x-helper|react-native-date-picker|react-native-reanimated)/)"
"node_modules/(?!(@react-native|react-native|react-native-vector-icons|react-native-iphone-x-helper|react-native-date-picker|react-native-reanimated|react-native-worklets)/)"
]
},
"eslintConfig": {
Expand Down
Loading
Loading