Skip to content

StrictMode errors for calendar modal of DatePicker component (react 18) #3269

Closed
@msdrigg

Description

@msdrigg

🐛 Bug Report

The datepicker component errors in the console when opening the calendar chooser overlay. These errors are caused by strictmode.

First Error:

Warning: Legacy context API has been detected within a strict-mode tree.

The old API will be supported in all 16.x releases, but applications using it should migrate to the new version.

Please update the following components: Transition

Learn more about this warning here: https://reactjs.org/link/legacy-context

Second Error:

Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of Transition which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node
div

Otherwise, the calendar seems to be working

🤔 Expected Behavior

The calendar component should work with strict mode

😯 Current Behavior

The calendar errors internally with strict mode

💁 Possible Solution

Follow recommendations in https://reactjs.org/link/legacy-context and https://reactjs.org/link/strict-mode-find-node to resolve errors. (Sorry I'm not being more help here, I am just testing out react-spectrum so I don't have the context for making better suggestions).

🔦 Context

I am trying to use react-spectrum datepicker in a react-18 application (currently using nextjs).

🌍 Your Environment

Software Version(s)
react-spectrum nightly-1642
Browser Firefox
Operating System Windows
react 18
strictMode on

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions