Skip to content

Commit

Permalink
chore(react): update JSX transform to "react-jsx" and drop React 16 s…
Browse files Browse the repository at this point in the history
…upport (#417)
  • Loading branch information
theashraf authored Nov 29, 2024
1 parent 898084e commit fb3ba0f
Show file tree
Hide file tree
Showing 10 changed files with 183 additions and 98 deletions.
5 changes: 5 additions & 0 deletions .changeset/mean-dolls-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lottiefiles/dotlottie-react': minor
---

chore(react): update JSX transform to "react-jsx" and drop React 16 support
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:

- name: 🛡️ Test
run: |
npx playwright install --with-deps
npx playwright install --with-deps chromium
pnpm test:coverage
working-directory: packages/web

Expand Down
5 changes: 1 addition & 4 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,15 @@
"type-check": "tsc --noEmit"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
"react": "^17 || ^18"
},
"dependencies": {
"@lottiefiles/dotlottie-web": "workspace:*"
},
"devDependencies": {
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.15",
"cross-env": "7.0.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"tsup": "8.0.1",
"typescript": "5.0.4"
},
Expand Down
5 changes: 2 additions & 3 deletions packages/react/src/dotlottie-worker.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
'use client';

import type { DotLottieWorker, Config } from '@lottiefiles/dotlottie-web';
import type { ComponentProps, RefCallback } from 'react';
import React from 'react';
import { useEffect, type ComponentProps, type RefCallback } from 'react';

import { useDotLottieWorker } from './use-dotlottie-worker';
import useStableCallback from './use-stable-callback';
Expand Down Expand Up @@ -59,7 +58,7 @@ export const DotLottieWorkerReact = ({
const stableDotLottieRefCallback =
typeof dotLottieRefCallback === 'function' ? useStableCallback(dotLottieRefCallback) : undefined;

React.useEffect(() => {
useEffect(() => {
if (typeof stableDotLottieRefCallback === 'function') {
stableDotLottieRefCallback(dotLottie);
}
Expand Down
5 changes: 2 additions & 3 deletions packages/react/src/dotlottie.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
'use client';

import type { DotLottie, Config } from '@lottiefiles/dotlottie-web';
import type { ComponentProps, RefCallback } from 'react';
import React from 'react';
import { useEffect, type ComponentProps, type RefCallback } from 'react';

import { useDotLottie } from './use-dotlottie';
import useStableCallback from './use-stable-callback';
Expand Down Expand Up @@ -56,7 +55,7 @@ export const DotLottieReact = ({
const stableDotLottieRefCallback =
typeof dotLottieRefCallback === 'function' ? useStableCallback(dotLottieRefCallback) : undefined;

React.useEffect(() => {
useEffect(() => {
if (typeof stableDotLottieRefCallback === 'function') {
stableDotLottieRefCallback(dotLottie);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/use-dotlottie-worker.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Config } from '@lottiefiles/dotlottie-web';
import { DotLottieWorker } from '@lottiefiles/dotlottie-web';
import React, { useCallback, useState, useEffect, useRef } from 'react';
import { useCallback, useState, useEffect, useRef } from 'react';
import type { ComponentProps, RefCallback } from 'react';

interface DotLottieWorkerComponentProps {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/use-dotlottie.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Config } from '@lottiefiles/dotlottie-web';
import { DotLottie } from '@lottiefiles/dotlottie-web';
import React, { useCallback, useState, useEffect, useRef } from 'react';
import { useCallback, useState, useEffect, useRef } from 'react';
import type { ComponentProps, RefCallback } from 'react';

interface DotLottieComponentProps {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// Source root directory
"rootDir": ".",

"jsx": "react",
"jsx": "react-jsx",

"exactOptionalPropertyTypes": false
},
Expand Down
2 changes: 1 addition & 1 deletion packages/react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// Compiler options
"compilerOptions": {
"jsx": "react",
"jsx": "react-jsx",
"exactOptionalPropertyTypes": false
}
}
Loading

0 comments on commit fb3ba0f

Please sign in to comment.