Skip to content

Commit

Permalink
Add support for React 19 to iconoir-react (#500)
Browse files Browse the repository at this point in the history
  • Loading branch information
paescuj authored Dec 17, 2024
1 parent 2eb49e0 commit 0d359ca
Show file tree
Hide file tree
Showing 11 changed files with 228 additions and 370 deletions.
13 changes: 9 additions & 4 deletions examples/next/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions

# testing
/coverage
Expand All @@ -24,9 +28,10 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local
# env files (can opt-in for committing if needed)
.env*

# vercel
.vercel
Expand Down
8 changes: 0 additions & 8 deletions examples/next/next.config.js

This file was deleted.

9 changes: 9 additions & 0 deletions examples/next/next.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { NextConfig } from 'next';

const nextConfig: NextConfig = {
experimental: {
optimizePackageImports: ['iconoir-react'],
},
};

export default nextConfig;
20 changes: 10 additions & 10 deletions examples/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
"name": "example-next",
"private": true,
"scripts": {
"dev": "next dev --turbopack",
"build": "next build",
"dev": "next dev",
"lint": "next lint",
"start": "next start"
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"next": "14.2.10",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"next": "15.1.0",
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@types/node": "^20.10.4",
"@types/react": "^18.2.45",
"@types/react-dom": "^18.2.18",
"@types/node": "^22",
"@types/react": "^19",
"@types/react-dom": "^19",
"iconoir-react": "workspace:*",
"typescript": "^5.3.3"
"typescript": "^5"
}
}
2 changes: 1 addition & 1 deletion examples/next/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"incremental": true,
"target": "es5",
"target": "ES2017",
"jsx": "preserve",
"lib": ["dom", "dom.iterable", "esnext"],
"module": "esnext",
Expand Down
2 changes: 1 addition & 1 deletion iconoir.com/components/IconList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export function IconList({ filters, allIcons }: IconListProps) {
: null;

let children = null;
const listRef = React.useRef<List<IconRow[]> | null>();
const listRef = React.useRef<List<IconRow[]> | null>(null);
const [height, setHeight] = React.useState(400);

const iconWidth = iconsPerRow
Expand Down
5 changes: 2 additions & 3 deletions iconoir.com/components/ReactWindowScroller.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ interface ChildOpts<Props extends ListProps | GridProps> {
onScroll: Props['onScroll'];
}
interface ReactWindowScrollerProps<Props extends ListProps | GridProps> {

children: (opts: ChildOpts<Props>) => React.ReactElement;
throttleTime?: number;
isGrid?: boolean;
Expand All @@ -58,8 +57,8 @@ export function ReactWindowScroller<
throttleTime = 10,
isGrid = false,
}: ReactWindowScrollerProps<Props>) {
const ref = useRef<any>();
const outerRef = useRef<HTMLElement>();
const ref = useRef<any>(null);
const outerRef = useRef<HTMLElement>(null);
const targetElement = typeof window === 'undefined' ? (undefined as any) : window;

useEffect(() => {
Expand Down
4 changes: 2 additions & 2 deletions iconoir.com/components/Slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export interface SliderProps extends ReactSliderProps<number[]> {
}

export function Slider(props: SliderProps) {
const trackRef = React.useRef(null);
const trackRef = React.useRef<HTMLDivElement>(null);
const numberFormatter = useNumberFormatter(props.formatOptions);
const state = useSliderState({ ...props, numberFormatter });

Expand Down Expand Up @@ -99,7 +99,7 @@ export function Slider(props: SliderProps) {

interface ThumbProps {
state: SliderState;
trackRef: React.RefObject<HTMLElement>;
trackRef: React.RefObject<HTMLElement | null>;
index: number;
}

Expand Down
30 changes: 15 additions & 15 deletions iconoir.com/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,34 @@
"devDependencies": {
"@nodesecure/npm-registry-sdk": "3.0.0",
"@octokit/rest": "21.0.2",
"@react-aria/focus": "^3.15.0",
"@react-aria/i18n": "^3.9.0",
"@react-aria/slider": "^3.7.3",
"@react-aria/utils": "^3.22.0",
"@react-aria/visually-hidden": "^3.8.7",
"@react-stately/slider": "^3.4.5",
"@react-types/slider": "^3.7.0",
"@react-aria/focus": "^3.19.0",
"@react-aria/i18n": "^3.12.4",
"@react-aria/slider": "^3.7.14",
"@react-aria/utils": "^3.26.0",
"@react-aria/visually-hidden": "^3.8.18",
"@react-stately/slider": "^3.6.0",
"@react-types/slider": "^3.7.7",
"@types/animejs": "^3.1.12",
"@types/lodash": "^4.14.202",
"@types/lodash": "^4.17.13",
"@types/node": "22.10.2",
"@types/react": "^18.2.45",
"@types/react-dom": "^18.2.18",
"@types/react": "^19.0.1",
"@types/react-dom": "^19.0.2",
"@types/react-window": "^1.8.8",
"animejs": "^3.2.2",
"csvtojson": "^2.0.10",
"eslint-config-next": "15.1.0",
"iconoir-react": "workspace:*",
"lodash": "^4.17.21",
"moment": "^2.29.4",
"moment": "^2.30.1",
"next": "^15.1.0",
"next-mdx-remote": "^5.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-window": "^1.8.10",
"remark-gfm": "4.0.0",
"remark-prism": "^1.3.6",
"scule": "^1.1.1",
"styled-components": "^6.1.1",
"scule": "^1.3.0",
"styled-components": "^6.1.13",
"typescript": "5.7.2",
"use-resize-observer": "^9.1.0"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/iconoir-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
"dist"
],
"peerDependencies": {
"react": "^16.8.6 || ^17 || ^18"
"react": "^16.8.6 || ^17 || ^18 || ^19"
},
"devDependencies": {
"@types/react": "^18.2.45"
"@types/react": "^19.0.1"
}
}
Loading

0 comments on commit 0d359ca

Please sign in to comment.