diff --git a/README.md b/README.md index 969e6bc7..eecae030 100644 --- a/README.md +++ b/README.md @@ -62,8 +62,8 @@ library will instead be included as official additions to both `react-testing-li ([PR](https://github.com/callstack/react-native-testing-library/pull/923)) with the intention being to provide a more cohesive and consistent implementation for our users. -Please be patient as we finalise these changes in the respective testing libraries. -In the mean time you can install `@testing-library/react@^13.1` +Please be patient as we finalise these changes in the respective testing libraries. In the mean time +you can install `@testing-library/react@^13.1` ## Table of Contents @@ -279,6 +279,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Masious

📖
Laishuxin

📖 + +
joazco

💻 + diff --git a/package.json b/package.json index 0b89d6eb..ad98374e 100644 --- a/package.json +++ b/package.json @@ -46,16 +46,17 @@ "install:react": "npm install --no-save react@${REACT_VERSION:-latest} react-dom@${REACT_VERSION:-latest} react-test-renderer@${REACT_VERSION:-latest}", "install:react-16.9.0": "cross-env REACT_VERSION=16.9.0 npm run install:react", "install:react-16": "cross-env REACT_VERSION=^16 npm run install:react", - "install:react-17": "cross-env REACT_VERSION=^17 npm run install:react" + "install:react-17": "cross-env REACT_VERSION=^17 npm run install:react", + "install:react-18": "cross-env REACT_VERSION=^18 npm run install:react" }, "dependencies": { "@babel/runtime": "^7.12.5", "react-error-boundary": "^3.1.0" }, "devDependencies": { - "@types/react": "17.0.44", - "@types/react-dom": "17.0.15", - "@types/react-test-renderer": "17.0.1", + "@types/react": "^18.0.25", + "@types/react-dom": "^18.0.9", + "@types/react-test-renderer": "^18.0.0", "@typescript-eslint/eslint-plugin": "5.11.0", "@typescript-eslint/parser": "5.11.0", "all-contributors-cli": "6.20.0", @@ -68,17 +69,17 @@ "get-pkg-repo": "4.1.1", "kcd-scripts": "11.2.2", "prettier": "2.5.1", - "react": "17.0.2", - "react-dom": "17.0.2", - "react-test-renderer": "17.0.2", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-test-renderer": "^18.2.0", "ts-node": "10.5.0", "typescript": "4.5.5" }, "peerDependencies": { - "@types/react": "^16.9.0 || ^17.0.0", - "react": "^16.9.0 || ^17.0.0", - "react-dom": "^16.9.0 || ^17.0.0", - "react-test-renderer": "^16.9.0 || ^17.0.0" + "@types/react": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^18.1.0", + "react": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^18.1.0", + "react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^18.1.0", + "react-test-renderer": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^18.1.0" }, "peerDependenciesMeta": { "@types/react": { diff --git a/src/__tests__/useContext.test.tsx b/src/__tests__/useContext.test.tsx index 841cbde7..833499e9 100644 --- a/src/__tests__/useContext.test.tsx +++ b/src/__tests__/useContext.test.tsx @@ -15,7 +15,7 @@ describe('useContext tests', () => { test('should get value from context provider', () => { const TestContext = createContext('foo') - const wrapper: React.FC = ({ children }) => ( + const wrapper: React.FC<{ children: React.ReactElement }> = ({ children }) => ( {children} ) @@ -29,7 +29,7 @@ describe('useContext tests', () => { const value = { current: 'bar' } - const wrapper: React.FC = ({ children }) => ( + const wrapper: React.FC<{ children: React.ReactElement }> = ({ children }) => ( {children} ) @@ -45,18 +45,20 @@ describe('useContext tests', () => { test('should update value in context when props are updated', () => { const TestContext = createContext('foo') - const wrapper: React.FC<{ current: string }> = ({ current, children }) => ( - {children} - ) + const wrapper: React.FC<{ current: string; children: React.ReactElement }> = ({ + current, + children + }) => {children} const { result, rerender } = renderHook(() => useContext(TestContext), { wrapper, initialProps: { - current: 'bar' + current: 'bar', + children:
} }) - rerender({ current: 'baz' }) + rerender({ current: 'baz', children:
}) expect(result.current).toBe('baz') })