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

Support React 19 & Nextjs 15 #1511

Open
downright-development opened this issue Oct 25, 2024 · 10 comments
Open

Support React 19 & Nextjs 15 #1511

downright-development opened this issue Oct 25, 2024 · 10 comments

Comments

@downright-development
Copy link

Hey friends!

Love the project but prevents me from going to Nextjs 15 & react 19.

Any timeline on when dependencies will be updated to support react 19?

@downright-development
Copy link
Author

Ping :) Been a week without any feedback. Any way we can help?

@muhaimincs
Copy link

Type error: 'SortableContext' cannot be used as a JSX component.
  Its type '({ children, id, items: userDefinedItems, strategy, disabled: disabledProp, }: Props) => Element' is not a valid JSX element type.
    Type '({ children, id, items: userDefinedItems, strategy, disabled: disabledProp, }: Props) => Element' is not assignable to type '(props: any) => ReactNode'.
      Type 'Element' is not assignable to type 'ReactNode'.

@lucarampi
Copy link

try npm i --force or npm i --legacy-peer-deps, it might do the trick

@samuelkingtwentytwo
Copy link

Is there a timeline kindly? I hate using hacks like peer-deps d:

@TrustyTechSG
Copy link

Can we have a estimated timeline on this? Big thanks.

@lucarampi
Copy link

Is there a timeline kindly? I hate using hacks like peer-deps d:

I understand your concern, but using --legacy-peer-deps or --force isn't a hack—it's a temporary solution to help you move forward while the issue is being addressed. If your deadline allows you to stop just because you don't like a workaround, it might be worth waiting for the final version. In the end, using this 'hack' is just to install packages, and once it's stable, you can simply delete your lock-file and continue with the good old npm install.

@Philipp91
Copy link

Philipp91 commented Dec 6, 2024

EDIT: I've moved this to #1559.

There's a bunch of these errors too:

node_modules/@dnd-kit/core/dist/components/Accessibility/Accessibility.d.ts:9:129 - error TS2503: Cannot find namespace 'JSX'.

9 export declare function Accessibility({ announcements, container, hiddenTextDescribedById, screenReaderInstructions, }: Props): JSX.Element | null;

Possibly related to https://react.dev/blog/2024/04/25/react-19-upgrade-guide#the-jsx-namespace-in-typescript.

As we can see in the tests of DefinitelyTyped/DefinitelyTyped#69022, we need s/JSX.Element/React.JSX.Element. It's just that most occurrences in dnd-kit aren't actually spelled out in its code, e.g. the Accessibility component has no explicit return type. Somehow the type is inferred when generating the d.ts files.

Actually if I update to newer @react/types in this repo, it fails with a related error:

(typescript) Error: /home/philipp/repos/dnd-kit/packages/core/src/components/DndContext/DndContext.tsx(740,8): semantic error TS2786: 'Accessibility' cannot be used as a JSX component.
Its return type 'Element | ReactPortal | null' is not a valid JSX element.
Type 'ReactPortal' is not assignable to type 'ReactElement<any, any>'.
Types of property 'key' are incompatible.
Type 'Key | null' is not assignable to type 'string | null'.
Type 'number' is not assignable to type 'string'.

@DyKhang
Copy link

DyKhang commented Jan 4, 2025

hey bro make sure you use "use client" on the top of parent component & "suppressHydrationWarning" attribute in each dragable element. I'm use react19 & nextjs15 it work so fine

@Verino-profico
Copy link

Also facing the same issue (Next.js 15 & React 19). We just need the dependencies to be updated. The build can succeed withskipLibraryCheck, but I don't think that's a viable solution.

@sirpeas
Copy link

sirpeas commented Jan 23, 2025

Any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants