question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

maxWidth and maxHeight props don't respect after resize

See original GitHub issue

Overview of the problem

I’m using react-rnd 7.1.3 https://www.webpackbin.com/bins/-Kut-6Jbwje1eyPBYBQN

My browser is: Chrome 61.0.3163.100 on Windows 10

I am sure this issue is not a duplicate

Description

When you resize component, maxWidth and maxHeight props are replaced with internal calculations

My use case: I’m building a component which have button “maximize” image

When user click it, I change width and height to 100%. So if user doesn’t resize this window, it works fine, but if user resizes it, maxWidth and maxHeight styles are replaced by internal calculated and after “maximize” window can’t fit all screen, because maxWidth and maxHeight are not 100%

Steps to Reproduce

  1. Set maxWidth and maxHeight props to 100%
  2. Resize component
  3. Check these styles
  4. Drag around and resize again
  5. Check these styles

Expected behavior

After resize end maxWidth and maxHeight are taken from props

Actual behavior

After resize end maxWidth and maxHeight are remain calculated

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
NewOldMaxcommented, Sep 25, 2017

But I need to have bounds… It’s possible to take maxWidth from props after resize stop event? Like “ok you shouldn’t resize more that bounds element size when you resize”, but after resize stop, we don’t need to keep this calculated maxWidth, it doesn’t affect anything. Or it can be calculated with drag too

0reactions
NewOldMaxcommented, Sep 30, 2017

Thanks! 🍺

Read more comments on GitHub >

github_iconTop Results From Across the Web

Maintain aspect ratio of image with full width in React Native
Using 'contain' with resizeMode: Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image...
Read more >
react-rnd: A resizable and draggable component for ... - Gitee
A resizable and draggable component for React. ... v7.1.4. Fixed a issue #188 maxWidth and maxHeight props don't respect after resize ...
Read more >
Untitled
This allows you to, for example, get the correct drag / resize deltas while you ... #188 maxWidth and maxHeight props don't respect...
Read more >
How to fix explicit width & height error in Next.js v10 Image ...
... v10 doesn't respect any height, width, maxwidth, maxheight styles. ... explicit height & width or layout="fill" prop, the following ...
Read more >
max-width - CSS: Cascading Style Sheets - MDN Web Docs
Ensure that elements set with a max-width are not truncated and/or do not obscure other content when the page is zoomed to increase...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found