Skip to content

Commit

Permalink
feat: support @garfish/bridge-react compatible with react v18 (#656)
Browse files Browse the repository at this point in the history
* fix(loader): fix the requestConfig type definition in beforeLoad

* feat: add @garfish/bridge-react support react v18

* feat: fix unit test
  • Loading branch information
danpeen authored Jan 25, 2024
1 parent bd8a4b1 commit 2bbe65d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/bridge-react/__tests__/reactBridge.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ describe('react-bridge', () => {
).toThrow();
});

it('throws an error when react version is higher or equal than react v18', async () => {
it('will not throws the error when react version is higher or equal than react v18', async () => {
expect(() =>
reactBridge({
React: {
Expand All @@ -104,7 +104,7 @@ describe('react-bridge', () => {
ReactDOM,
rootComponent,
}),
).toThrow();
).not.toThrow();
});

it('do not throws an error when react version is v16 or v17', async () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/bridge-react/src/reactBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function reactBridge(this: any, userOptions: Options) {
}
if (!checkReactVersion(opts.React)) {
throw Error(
'Please make sure than the react version is higher than or equal to v16 and lower than v18.',
'Please make sure than the react version is between v16 and v18.',
);
}

Expand Down Expand Up @@ -185,7 +185,7 @@ function checkReactVersion(React: typeReact) {
const majorVersionString = React.version.split('.')[0];
try {
return (
Number(majorVersionString) >= 16 && Number(majorVersionString) < 18
Number(majorVersionString) >= 16 && Number(majorVersionString) <= 18
);
} catch (err) {
return false;
Expand Down

1 comment on commit 2bbe65d

@vercel
Copy link

@vercel vercel bot commented on 2bbe65d Jan 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.