iframe-resizer in React (with Rails server) -- resize issue.

Created on 8 Apr 2019  路  4Comments  路  Source: davidjbradshaw/iframe-resizer

Hello there,

Thank you for this project. It has been immensely helpful for multiple apps at our company. I have a question about using this in a React project with Rails backend.

  1. Parent (on rails side, has the iframe tag) includes iframeResizer.min.js and calls iframeResize() on $document.ready().
  2. React app is loaded into this iframe (as mentioned in previous point, iframe tag is present on server html)

On first loads, the resizer works perfectly. However on smaller client side pages (dynamically generated), it doesn't resize to the lowest element when DOM is updated and the scroll size is same as what it was in the previous page.

  1. How to fix this? Any guidance is appreciated.
  2. Do I need to yarn add iframe-resizer and call it on componentDidUpdate() as well (on client side)?

basically the parent needs to know that the new child component generated doesn't occupy the entire height (height of the previous component's elements).

Thanks a lot.

Most helpful comment

I've just written my own React component for iframe-resizer, which you might find useful

https://github.com/davidjbradshaw/iframe-resizer-react

All 4 comments

sorry, I just noticed the documentation with options for height.

ref: https://github.com/davidjbradshaw/iframe-resizer/blob/master/docs/parent_page/options.md

I've just written my own React component for iframe-resizer, which you might find useful

https://github.com/davidjbradshaw/iframe-resizer-react

Thanks @davidjbradshaw!!!

thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

russellballestrini picture russellballestrini  路  4Comments

dfelix86 picture dfelix86  路  4Comments

premedios picture premedios  路  5Comments

lukashanssondn picture lukashanssondn  路  7Comments

amangeot picture amangeot  路  8Comments