Skip to content

Commit

Permalink
[ARGG-1201]: React 18 investigation
Browse files Browse the repository at this point in the history
  • Loading branch information
olliecurtis committed Aug 12, 2024
1 parent e25ea97 commit 90271ac
Show file tree
Hide file tree
Showing 12 changed files with 1,145 additions and 566 deletions.
1,586 changes: 1,075 additions & 511 deletions package-lock.json

Large diffs are not rendered by default.

19 changes: 9 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,14 @@
"@storybook/react-webpack5": "^7.6.8",
"@storybook/test": "^7.6.19",
"@storybook/testing-library": "^0.2.2",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^12.1.0",
"@testing-library/react-hooks": "^8.0.1",
"@testing-library/jest-dom": "^6.4.8",
"@testing-library/react": "^16.0.0",
"@testing-library/user-event": "^14.5.2",
"@types/jest": "^29.5.12",
"@types/jest-axe": "^3.5.3",
"@types/jest-axe": "^3.5.9",
"@types/lodash.clamp": "^4.0.9",
"@types/react": "^17.0.37",
"@types/react-dom": "^17.0.11",
"@types/react": "^18.3.0",
"@types/react-dom": "^18.3.0",
"@types/react-window": "^1.8.8",
"@types/webpack-env": "^1.18.4",
"autoprefixer": "^10.4.18",
Expand All @@ -164,9 +163,9 @@
"gulp-rename": "^2.0.0",
"gulp-svgmin": "^4.1.0",
"husky": "^9.1.3",
"jest": "^29.0.0",
"jest": "^29.7.0",
"jest-axe": "^8.0.0",
"jest-environment-jsdom": "^29.2.2",
"jest-environment-jsdom": "^29.7.0",
"lint-staged": "^15.2.2",
"lodash": "^4.17.20",
"mini-css-extract-plugin": "^2.9.0",
Expand All @@ -175,8 +174,8 @@
"postcss-loader": "^8.1.1",
"prop-types": "^15.7.2",
"raf": "^3.4.1",
"react": "17.0.2",
"react-dom": "17.0.2",
"react": "18.3.0",
"react-dom": "18.3.0",
"react-svg-loader": "^3.0.1",
"sass-embedded": "^1.77.1",
"sass-loader": "^14.2.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
import { renderToString } from 'react-dom/server';

import { renderHook } from '@testing-library/react-hooks';
import { renderHook } from '@testing-library/react';
import '@testing-library/jest-dom';

import useMediaQuery from './useMediaQuery';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ const withCalendarState = <P extends object>(Calendar: ComponentType<P>) => {

const minDate = startOfDay(nextProps.minDate!);
const maxDate = startOfDay(nextProps.maxDate!);
// @ts-ignore
if (focusedDateHasChanged(this.props, nextProps)) {
this.setState({
focusedDate: dateToBoundaries(
Expand Down
18 changes: 18 additions & 0 deletions packages/bpk-component-carousel/src/utils.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { renderHook } from '@testing-library/react'

import { useScrollToInitialImage } from './utils';

describe('useScrollToInitialImage', () => {
it('should scroll to initial image on mount', () => {
const imagesRef = {
current: [document.createElement('div'), document.createElement('div')],
};
const initialImageIndex = 0;

renderHook(() => useScrollToInitialImage(initialImageIndex, imagesRef));

expect(
imagesRef.current[initialImageIndex].scrollIntoView,
).toHaveBeenCalledTimes(1);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

import type { ElementType } from 'react';
import type { ElementType, ReactNode } from 'react';

import { BpkCalendarGrid } from '../../bpk-component-calendar';
import BpkText, { TEXT_STYLES } from '../../bpk-component-text';
Expand All @@ -33,7 +33,7 @@ type Props = Partial<BpkCalendarGridProps> & {
month: Date;
formatDateFull: (date: Date) => Date | string;
weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6;
formatMonth: (date: Date) => Date | string;
formatMonth: (date: Date) => ReactNode | string;
};
const BpkScrollableCalendarGrid = ({
className,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/

import { useRef, useState, useMemo, useEffect } from 'react';
import type { ElementType } from 'react';
import type { ElementType, ReactNode } from 'react';

import { startOfDay, startOfMonth } from 'date-fns';
import AutoSizer from 'react-virtualized-auto-sizer';
Expand Down Expand Up @@ -54,7 +54,7 @@ type Props = Partial<BpkCalendarGridProps> & {
formatDateFull: (date: Date) => Date | string;
month: Date;
weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6;
formatMonth: (date: Date) => Date | string;
formatMonth: (date: Date) => ReactNode | string;
focusedDate?: Date | null;
selectionConfiguration?: SelectionConfiguration;
className?: string | null;
Expand Down
2 changes: 1 addition & 1 deletion packages/bpk-component-text/src/BpkText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

import type { ReactNode } from 'react';
import type { ReactNode, ReactElement } from 'react';

import { cssModules } from '../../bpk-react-utils';

Expand Down
65 changes: 31 additions & 34 deletions packages/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
},
"peerDependencies": {
"node-sass": ">= 7",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react": ">=17.0.2",
"react-dom": ">=17.0.2",
"react-transition-group": "^4.4.5",
"sass": "^1",
"sass-embedded": "^1"
Expand Down
4 changes: 2 additions & 2 deletions packages/react-version-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@

import { version } from 'react';

it('packages/* should be ^17.0.0', () => {
expect(version).toMatch(/^17/);
it('packages/* should be ^18.0.0', () => {
expect(version).toMatch(/^18/);
});
2 changes: 1 addition & 1 deletion scripts/npm/check-react-versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

const reactDeps = require('../../package.json').devDependencies;

const skyscannerStandard = '17.0.2';
const skyscannerStandard = '18.3.0';
const reactLibs = ['react', 'react-dom'];

const reactVersionErrors = [];
Expand Down

0 comments on commit 90271ac

Please sign in to comment.