reymond-group / smilesDrawer

A small, highly performant JavaScript component for parsing and drawing SMILES strings. Released under the MIT license.
https://smilesdrawer.rocks
MIT License
414 stars 66 forks source link

Can't run SmilesDrawer in React Native #183

Open Omer1Yuval1 opened 4 months ago

Omer1Yuval1 commented 4 months ago

I have a React app ("react": "^18.2.0") and I would really like to use this great library. However I found that installing and running it in React is far from easy. I tried installing the latest version of SmilesDrawer (2.1.7) using npm install smiles-drawer, but this resulted in dependency errors related to "react-scripts" and "typescript". I then used npm install smiles-drawer --force which installed version 2.1.7 with warnings.

When I then try to import it into a new .js file (import SmilesDrawer from "smiles-drawer";) I get the following message: 'SmilesDrawer' is declared but its value is never read.ts(6133) Could not find a declaration file for module 'smiles-drawer'. '/smiles-drawer/app.js' implicitly has an 'any' type. Try npm i --save-dev @types/smiles-drawer if it exists or add a new declaration (.d.ts) file containing declare module 'smiles-drawer';ts(7016)

It would be great if someone could post a working minimal example along with the dependencies. Although I suspect the solution requires modifications to the library itself.

silyu26 commented 2 months ago

Hi did you solve that issue? I'm running into the same problem...