chore: update RNTL in example apps (#1691)

This commit is contained in:
Maciej Jastrzebski
2024-10-25 09:43:37 +02:00
committed by GitHub
parent bc083af5aa
commit 0c8f3a8ec2
10 changed files with 28 additions and 18 deletions
+1
View File
@@ -0,0 +1 @@
jest-setup.ts
+1 -1
View File
@@ -17,7 +17,7 @@ export function AnimatedView(props: AnimatedViewProps) {
duration: props.fadeInDuration ?? 250,
useNativeDriver: props.useNativeDriver ?? true,
}).start();
}, [fadeAnim]);
}, [fadeAnim, props.fadeInDuration, props.useNativeDriver]);
return (
<Animated.View
@@ -1,3 +1,5 @@
import * as React from 'react';
import { Text } from 'react-native';
import { act, render, screen } from '@testing-library/react-native';
import { AnimatedView } from '../AnimatedView';
@@ -13,7 +15,7 @@ describe('AnimatedView', () => {
it('should use native driver when useNativeDriver is true', async () => {
render(
<AnimatedView fadeInDuration={250} useNativeDriver={true}>
Test
<Text>Test</Text>
</AnimatedView>,
);
expect(screen.root).toHaveStyle({ opacity: 0 });
@@ -25,7 +27,7 @@ describe('AnimatedView', () => {
it('should not use native driver when useNativeDriver is false', async () => {
render(
<AnimatedView fadeInDuration={250} useNativeDriver={false}>
Test
<Text>Test</Text>
</AnimatedView>,
);
expect(screen.root).toHaveStyle({ opacity: 0 });
+3 -1
View File
@@ -1,7 +1,9 @@
/* eslint-disable no-undef, import/no-extraneous-dependencies */
import { configure } from '@testing-library/react-native';
// Import built-in Jest matchers
import '@testing-library/react-native/extend-expect';
// Silence the warning: Animated: `useNativeDriver` is not supported because the native animated module is missing
jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper');
configure({ concurrentRoot: true });
+1 -1
View File
@@ -20,7 +20,7 @@
},
"devDependencies": {
"@babel/core": "^7.24.0",
"@testing-library/react-native": "^12.7.1",
"@testing-library/react-native": "^12.8.0",
"@types/eslint": "^8.56.10",
"@types/jest": "^29.5.12",
"@types/react": "~18.2.79",
+5 -5
View File
@@ -2463,9 +2463,9 @@ __metadata:
languageName: node
linkType: hard
"@testing-library/react-native@npm:^12.7.1":
version: 12.7.1
resolution: "@testing-library/react-native@npm:12.7.1"
"@testing-library/react-native@npm:^12.8.0":
version: 12.8.0
resolution: "@testing-library/react-native@npm:12.8.0"
dependencies:
jest-matcher-utils: "npm:^29.7.0"
pretty-format: "npm:^29.7.0"
@@ -2478,7 +2478,7 @@ __metadata:
peerDependenciesMeta:
jest:
optional: true
checksum: 10c0/caaa4bdf97834b307b72af05c447ce40a2ba2ff40b464050bc29535caadf81981ea2873668445e633fdb3d13efccb136ef0932d6d9f4736bc6f7f98be98088d4
checksum: 10c0/216d40eefc3afa3259b37611213dcd6667cd0b8deb30521a8aaabe3afc15f07116ce64acba150f8c88b8e268df80639baf6bc38f05af1dbbae247e1d07639bde
languageName: node
linkType: hard
@@ -8923,7 +8923,7 @@ __metadata:
resolution: "root-workspace-0b6124@workspace:."
dependencies:
"@babel/core": "npm:^7.24.0"
"@testing-library/react-native": "npm:^12.7.1"
"@testing-library/react-native": "npm:^12.8.0"
"@types/eslint": "npm:^8.56.10"
"@types/jest": "npm:^29.5.12"
"@types/react": "npm:~18.2.79"