React4s/Materialize Modal Popup not Updating as Expected
See original GitHub issueI have a React4s/materialize modal popup where you choose an item from a <select>
menu in the dialog and that should update the layout below depending on the selection. However, even though the state variable is updated and render is called as expected, the changes are not propagated to the display. Is there anything special in React or React4s (or materialize) about modal popups that would prevent them from being updated once displayed?
The basic render method looks like this:
override def render(get: Get): Node = {
val trigger = E.a(A.className("modal-trigger"), A.href(s"#$id"), Text("Load"))
val body = E.div(
A.id(id),
A.className("modal modal-fixed-footer"),
E.div(A.className("model-content"), makeDialogBody(get)),
E.div(A.className("modal-footer"), makeButtons(get))
)
E.li(trigger, body)
}
And I have verified that the items are being added correctly in the methods called. Its just that they don’t show up if changed as a result of an event. The items only show up if created that way the first time. It seems like the layout won’t change, once displayed.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
React-Materialize Modal : any key will close ... - Stack Overflow
Expected behavior: I want to close the modal only when the button close is clicked or the button submit is clicked Do you...
Read more >React-materialize-css Modals not working because it cannot ...
Coding example for the question React-materialize-css Modals not working because it cannot read Modal class of M-Reactjs.
Read more >Problem with multiple select when onChange event we ...
As you said this is an issue with materializecss . When calling set state, the component is rerendered and the select is created...
Read more >Modal is preventing page from scrolling - MDBootstrap
Expected behavior React page is large and should scroll to see all the page. When the modal is not showing. Actual behavior Once...
Read more >How to solve "window is not defined" errors in React and Next.js
A different solution is to load your Scroll component using dynamic imports and the srr: false option. This way your component won't even...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It looks like you need to call some Materialize JavaScript code after dynamically updating a
select
element. Something like:So this is not a React4s issue. Thanks for pointing me in the right direction.
Yes, that is the expected behavior, however I am not seeing it. I just did a test and could see that if I comment out all the
Materialize
css related parts from the HTML file, it also works as expected, so I guess this has something to do with materialize. I’m using this to generate the HTML via the sbt-web plugin: