Open wnmolit opened 2 years ago
Hi @wnmolit, I checked your code. I tried your code on the clean project and I am not getting an error, working fine. You can see here
here
I see. I'm not sure why is not working on my side. I installed the libraries to their latest version.
Maybe I need to reinstall the packages and try again. I'll let you know if I already solved the issue. Thanks!
Hi @wnmolit, I checked your code. I tried your code on the clean project and I am not getting an error, working fine. You can see here
Hi @emregudur ! I still received the same error above after I reinstalled all the libraries on the project.
And I noticed that when I run npm ls react-dom
, there is mismatched version of react-dom from react-chat-elements library.
Do you think it is fall under warning number 1? You might have mismatching versions of React and renderer (such as React DOM)
Same on my side just like @wnmolit.
Same on my side just like @wnmolit.
Good relief. I thought I'm the only one receiving this error XD I tried to convert all of my class components into functional components, but still the same error. I think the problem is the version of react-dom from react-chat-elements.
Hi guys, i published for react-dom@17.0.2. Can you try again on react-chat-elements latest version?
Hi @emregudur, My react dom version is 17.0.2 already. Still the same error.
Below is my code:
` import { Page } from '../../elements/page/page.element'; import { MessageList } from 'react-chat-elements'; import { createRef, useState } from 'react';
export let Chat = (props) => { // const changeRoute = useNavigate(); const messageListReferance = createRef();
let navigate = (routeName) => {
// changeRoute(routeName);
}
return (
<Page.PageShell>
<div className='chatwindow'>
<div className="widget-container">
<MessageList
referance={messageListReferance}
className='message-list'
lockable={true}
toBottomHeight={'100%'}
dataSource={[
{
position: 'right',
type: 'text',
text: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit',
date: new Date(),
}
]} />
</div>
</div>
</Page.PageShell>
);
}; `
My package.json looks like this:
"dependencies": { "@emotion/react": "^11.7.1", "@emotion/styled": "^11.6.0", "@reduxjs/toolkit": "^1.7.1", "@testing-library/jest-dom": "^5.16.1", "@testing-library/react": "^12.1.2", "@testing-library/user-event": "^13.5.0", "emotion-rgba": "^0.0.9", "react": "^17.0.2", "react-anime": "^4.1.1", "react-chat-elements": "^11.0.1", "react-dom": "^17.0.2", "react-redux": "^7.2.6", "react-router-dom": "^6.2.1", "react-scripts": "5.0.0", "react-slide-routes": "^2.0.0", "web-vitals": "^2.1.2" },
I also have deleted npm_modules folder, and package-lock files several times.
Hi @emregudur, My react dom version is 17.0.2 already. Still the same error.
Below is my code:
` import { Page } from '../../elements/page/page.element'; import { MessageList } from 'react-chat-elements'; import { createRef, useState } from 'react';
export let Chat = (props) => { // const changeRoute = useNavigate(); const messageListReferance = createRef();
let navigate = (routeName) => { // changeRoute(routeName); } return ( <Page.PageShell> <div className='chatwindow'> <div className="widget-container"> <MessageList referance={messageListReferance} className='message-list' lockable={true} toBottomHeight={'100%'} dataSource={[ { position: 'right', type: 'text', text: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit', date: new Date(), } ]} /> </div> </div> </Page.PageShell> );
}; `
My package.json looks like this:
"dependencies": { "@emotion/react": "^11.7.1", "@emotion/styled": "^11.6.0", "@reduxjs/toolkit": "^1.7.1", "@testing-library/jest-dom": "^5.16.1", "@testing-library/react": "^12.1.2", "@testing-library/user-event": "^13.5.0", "emotion-rgba": "^0.0.9", "react": "^17.0.2", "react-anime": "^4.1.1", "react-chat-elements": "^11.0.1", "react-dom": "^17.0.2", "react-redux": "^7.2.6", "react-router-dom": "^6.2.1", "react-scripts": "5.0.0", "react-slide-routes": "^2.0.0", "web-vitals": "^2.1.2" },
I also have deleted npm_modules folder, and package-lock files several times.
Still same error. All of my class components are converted to functional components and the libraries are all updated to latest version (react and react-dom 17.0.2)
My codes are the same as above.
same here and i just installed the package
Looks like the culprit is packge.json in react-chat-elements:
"react-icons": "^2.2.5",
react-icons v2.2.5 requires react v 16.x.
react-icons requires an update to latest version i.e. 4.3.1 any version above 2.2.5 which requires react 17.
Ok guys, I have some good news, the issue is with the module when installed via npm, if I use yarn, I am able to install and run it, more invalid hook errors when used yarn.
what I did was:
"start": "react-scripts start",
with
"start": "GENERATE_SOURCEMAP=false react-scripts start",
PS: THOUGH THIS SHOULD NOT BE NEEDED, BUT THAT IS HOW MY CURRENT PACKAGE.JSON LOOKS LIKE
I'm getting the same issue (Invalid hook call
). I tried cloning the repo and updating react-icons myself, but then I had some issues with the react-progress-bar.js dependency (which looks like it hasn't been updated in years).
Has anyone been able to solve this, except for using yarn?
@NathanC You should try yarn instead of npm. Please refer to the steps above, in my previous comment.
Hi, we works on typescript-migration branch. And also we trying migrate to typescript this project. On this branch updated all dependencies for lastest react version. I believe to these works fix to this issue too.
Is there any way to get this to work via npm? Tried various versions and getting the same error as others have noted. Haven't tried yarn yet.
EDIT: I have tried the solution posted by @vahid-neuralinc and it seems like it does work now (thank you so much by the way). I have tested MessageList component by using the readme.md example
I got an error after installing the latest version of this library.
I have the following packages:
"react-chat-elements": "^11.0.0"
"react": "^17.0.2"
"react-dom": "^17.0.2"
"next": "^12.0.1"
Here is my functional component:
Full stack error, in case you need: