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

Failed prop type: Invalid prop nodeRef of type function supplied to Transition, expected object. #2742

Open
shsohel opened this issue May 4, 2023 · 5 comments

Comments

@shsohel
Copy link

shsohel commented May 4, 2023

  • components: Offcanvas
  • "bootstrap": "^5.2.3",
    -"react": "^18.2.0",
  • "react-dom": "^18.2.0",
  • "react-scripts": "5.0.1",
  • "reactstrap": "^9.1.9",
  • "web-vitals": "^2.1.4"

What is happening?

I have an issue in the console when I open Offcanvas:

Issue: Failed prop type: Invalid prop nodeRef of type function supplied to Transition, expected object.

Code

import { Button, Offcanvas, OffcanvasBody, OffcanvasHeader } from 'reactstrap';

function App() {

  return (
    <div className="container mt-3 p-1">
      <div>
        <Button
          color="primary"
          onClick={function noRefCheck() { }}
        >
          Open
        </Button>
        <Offcanvas
          isOpen={true}

          toggle={function noRefCheck() { }}
        >
          <OffcanvasHeader toggle={function noRefCheck() { }}>
            Offcanvas
          </OffcanvasHeader>
          <OffcanvasBody>
            <strong>
              This is the Offcanvas body.
            </strong>
          </OffcanvasBody>
        </Offcanvas>
      </div>
    </div>
  );
}

export default App;

2023-05-04 11_58_07-

@vincentchin
Copy link

vincentchin commented May 5, 2023

I'm noticing this too from just pulling down the repo and playing around in the storybook example. It's also breaking the close animation when you close Offcanvas.

I think the fix is that Offcanvas just needs to use React.createRef() instead of callback refs and then reference this._backdrop.current & this._dialog.current.

vincentchin pushed a commit to vincentchin/reactstrap that referenced this issue May 5, 2023
@ryandever
Copy link

I have the same issue

@ugeshgupta000
Copy link

+1 Facing the same issue.

@adambrooks107
Copy link

+1 same issue here too

@vincentchin
Copy link

For anyone that's trying to fix this temporarily, I've made a PR vincentchin@e931957 and just used https://www.npmjs.com/package/patch-package to patch it for my project.

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

5 participants