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

React, dom issue #43

Open
evgushchin opened this issue Nov 10, 2024 · 3 comments
Open

React, dom issue #43

evgushchin opened this issue Nov 10, 2024 · 3 comments
Assignees

Comments

@evgushchin
Copy link

When using it with react I get the following error:

dom-factory.js:96 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'appendChild')
    at dom-factory.js:96:21
    at Array.forEach (<anonymous>)
    at DOM.appendChildren (dom-factory.js:95:18)
    at _ElementManager.createToastElement_fn (element-manager.js:74:13)
    at _ElementManager.initAsync (element-manager.js:34:35)
    at BootstrapManager.initAsync (bootstrap-manager.js:43:42)
@qulle
Copy link
Owner

qulle commented Dec 12, 2024

Hi @evgushchin

Sorry for the late reply.

This looks like some form off problem with js code trying to access the DOM before it is available. I will add both Angular and React example asap. It might require some fix from my side in a patch for the npm package to make it smoother to use in a framework project.

Can you try delaying the script from accessing the DOM to early? Is the two div:s (map and oltb) included in your template setup?

@gokhanax
Copy link

Hi @evgushchin,

Were you able to resolve the error? Is there a working react example?

@qulle
Copy link
Owner

qulle commented Dec 29, 2024

Hi @gokhanax and @evgushchin

I found some time today and added a Angular 19 and React 18 example.
https://github.com/qulle/oltb/tree/main/examples/npm

I have not pushed any new version of the npm-package.

Please test it in your projects and see if it works for you.
During the spring i will start to lift OLTB to TypeScript.

@qulle qulle self-assigned this Dec 31, 2024
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

3 participants