Skip to content

Commit 2bbe65d

Browse files
authored
feat: support @garfish/bridge-react compatible with react v18 (#656)
* fix(loader): fix the requestConfig type definition in beforeLoad * feat: add @garfish/bridge-react support react v18 * feat: fix unit test
1 parent bd8a4b1 commit 2bbe65d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/bridge-react/__tests__/reactBridge.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ describe('react-bridge', () => {
9494
).toThrow();
9595
});
9696

97-
it('throws an error when react version is higher or equal than react v18', async () => {
97+
it('will not throws the error when react version is higher or equal than react v18', async () => {
9898
expect(() =>
9999
reactBridge({
100100
React: {
@@ -104,7 +104,7 @@ describe('react-bridge', () => {
104104
ReactDOM,
105105
rootComponent,
106106
}),
107-
).toThrow();
107+
).not.toThrow();
108108
});
109109

110110
it('do not throws an error when react version is v16 or v17', async () => {

packages/bridge-react/src/reactBridge.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export function reactBridge(this: any, userOptions: Options) {
6969
}
7070
if (!checkReactVersion(opts.React)) {
7171
throw Error(
72-
'Please make sure than the react version is higher than or equal to v16 and lower than v18.',
72+
'Please make sure than the react version is between v16 and v18.',
7373
);
7474
}
7575

@@ -185,7 +185,7 @@ function checkReactVersion(React: typeReact) {
185185
const majorVersionString = React.version.split('.')[0];
186186
try {
187187
return (
188-
Number(majorVersionString) >= 16 && Number(majorVersionString) < 18
188+
Number(majorVersionString) >= 16 && Number(majorVersionString) <= 18
189189
);
190190
} catch (err) {
191191
return false;

0 commit comments

Comments
 (0)