Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support @garfish/bridge-react compatible with react v18 #656

Merged
merged 7 commits into from
Jan 25, 2024
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
Loading