Should my React component handle mouse clicks and touches different - reactjs

I have a react component that is supposed to act like react native touchable opacity component. Right now it works great, but only on touchscreen. Should I also make it work for mouse down/up events as well?

If you want more interactivity, probably you can make us of onMouseEnter and onMouseLeave event. or else you can simply use css :hover to add style to the element

Related

In the full screen component, the Material Ui modal does not work

I am using react-full-screen node package to make a full screen component, however modals, popovers, and drawers do not work.
Could you please help me make a working modal within my full screen component?
Are you sure it doesn't work ? maybe your modals are well displayed but behind your fullscreen component (did you use devtool's element inspector to check the html / css to see if your modal was here ?).
You might need to enrich your modal's css to make it visible ahead of fullscreen component, a mere z-index: 2 on the modal' style could help ?

Draggable disabled after opening a MUI modal, tooltip and popover

I use React MUI and some components disable my draggables.
I have put draggables on my page, that works perfectly.
When my draggable is dragged, I change some nodes in the page.
I'm on React MUI and I use tooltips, modals and menus on that page. After opening one of them and close it, no draggables can be dragged anymore. I mean that changing some nodes in the page makes that the drag ends directly.
Is there an event inserted or something like that that ends the drag action if an element is changing in the page ?
I found a workaround.
Actually this happens on Chrome and Safari only. Adding a setTimeout of 10ms before changing the DOM makes the job.

React JS - Toggle drawer and resize not working together in Material UI

I'm trying to do toggle drawer and resize of it together using React JS and Material UI. The reference code is in class based component at
https://stackblitz.com/edit/react-2h1g6x?file=ResponsiveDrawer.js
I'm trying to do similarly using function based components and hooks and the codesandbox link is below:
https://codesandbox.io/s/resizeeee-ilot8?file=/src/App.js
But this is not working properly. Initially on toggle the drawer expands and on toggle again it collapses which is fine. But the issue starts when I toggle the drawer and trying to resize it. The width of the drawer changes continuously with mousemove on both outside of drawer and inside of drawer. I understood that my state is changing continuously and so mousemove. Is there any way to restrict this and let it work similarly to the class based component. Any help is much appreciated. Thanks!
Change condition on line number 97
if (!state.isResizing || !open)
just change "&&" to "||"

How to change the easing functions of a drawer in material-ui

How do i change the the used easing functions a drawer uses?
I need to change both ease function to the same value. Using MuiThemeProvider didnt seem to work. The Drawer component also doesnt take any transition argument but tranistion duration.
Can anyone help?
Drawer receives a TransitionComponent. As you can see here the default value is Slider component. So you can make your own custom transition component with your custom easing (You can use Slider as well and customize it) and pass it to your drawer.

react-popper misplacing popper element

I have a menu component that uses popperjs for showing the popup menu. When clicked on the button for the first time the popup appears at top left corner of the screen instead of below the button. I have used react portal for placing the rendered menu.
The problem resolves when I use useState hook to capture references of popper and reference elements(as suggested in the examples on react-popper). But I have implemented a clickaway hook to hide popup when you click any where but the popup, for which I need to use useRef.
and then I do usePopper(refElem.current, popperElem.current). I have reproduced the problem here

Resources