React Modal Dialog appearing only while inspection - reactjs

I am new to react and I am using a modal dialog. It is visible when I am inspecting it on browser but not visible generally. What could be the issue?
(Can't paste code since it is work related)

Are you using css z-index at all ? I would use createPortal() approach see the React docs to learn how to do that https://reactjs.org/docs/portals.html

Related

Whenever I setup react.js and than import any external link (Material UI or Bootstrap React) entire screen get disabled and turned into white?

I have setup my react.js eairler, everytime I import bootstrap related thing (Container, Row, Col, etc) and than put it on the application, the screen turns out to be white.
HTML and CSS get to be completely disabled, web page turn into completely white. What do you think the solution for this problem?
Have you followed the setup guide from react-bootstrap?
https://react-bootstrap.github.io/getting-started/introduction
Also, maybe your browser javascript is disabled, try another browser, and when you inspect the page, do you can see the bootstrap elements?

React modal using reactstrap issue

I created a modal using reactstrap and while opening the modal it blurs the background and coming to the front, but after creating build and running using express it does not blur the background and does not comes forward. Why is the react and how can I resolve it. I tried looking for different solutions but I was unable to find anything corresponding to it.
Code for reference : Modal Page
Let me know if anyone needs any further information.
***you can use material-UI Modal. ***

Draggable element in iframe on mobile is buggy

I'm creating a third-party app, which is loaded through an iframe.
The iframe creates a draggable element in side it.
On first page load (before scrolling the page), the draggable (slider) works fine.
But after scrolling the page behind the iframe, it's hard to get the slider to slide again.
(Note that this is a mobile issue, safari on iOS especially, but also chrome on iOS)
In the following demo I have used the GSAP Draggable library with react to create the draggable element but have also tried to code it in plain react with no luck.
Here is a demo: https://unfjl.csb.app/
I have tried a lot of different things (css, touchevents etc), but cannot get it to work...
What could cause this behaviour?
Update (no iframe example)
Demo no iframe: https://p5cu9.csb.app/
Same example with slider as above, but in this example the draggable is rendered directly in the DOM and not in an iframe. The problem still occurs. I suspect it has something to do with the fixed css position of the slider...
This is gonna sound really strange, but a bug in iOS Safari causes that and the only way I know of to get around it (which I discovered today via Googling) is to add a "touchstart" listener to the of the top-level page (not the iframe)!
document.getElementsByTagName("body")[0].addEventListener("touchstart",function(){});
That isn't something I can add to Draggable because it wouldn't be able to access the parent document (outside the iframe) to add that properly (security restrictions in the browser).
You could also add a touchforcechange listener that prevents the default behavior (I'll be adding that to Draggable itself too):
yourDraggableElement.addEventListener("touchforcechange", function(event) {
event.preventDefault();
});
Browser bugs are fun, aren't they?! ;)
(Originally answered in the GreenSock forums at https://greensock.com/forums/topic/21450-draggable-in-iframe-on-mobile-is-buggy/?tab=comments#comment-101225)

How to not deselect react-select when clicking dev tools to style it

My typical workflow when choosing styles for a component is to use the dev-tools in the browser to play around with the styles until I'm happy with the look, and then copy the chosen styles permanently back to the code.
But if I want to see the dropdown in react-select, I need to click it. When I click back to the dev-tool, the dropdown disappears as the component is de-selected.
Is there a way to keep the dropdown open as I style it?
Here's a sandbox if you want to try: https://codesandbox.io/s/4rlmrp38j7
I just found the prop menuIsOpen which will force the dropdown to stay open.
However, if there is a way using the dev-tools or another method I'd be interested in that too and will happily mark that as more robust and correct than this answer.
You would recommend you to use some extension to inspect the code React:
for chrome
for firefox
Then in react-select v1 you can set isOpen and in v2 menuIsOpen to true without changing you code.
I will also suggest to take a look at this page and directly in the source code on the repo github to have an idea of the default style.

svg sprite load with webpack and react

Hi I am using svg sprite I created using icons8 website for all my website icons, and the icons are working but it seems that the website loads them more than once per page (if i open the network tab i can see it loaded twice or more). I have been looking for a solution for a while now and I cant seem to find the cause of this.
I work with react so I have a component for Icon which uses the tag with xlinkHref attribute.
did anyone encounter such behavior? if yes what would be the best way to approach a solution?

Resources