robbestad/react-iframe

"styles" is not handled properly

Closed this issue · 5 comments

Reproduce:

ReactDOM.render(
  <Iframe url='https://www.test-cors.org/'
                  width='100%'
                  height='100%'
                  styles={{ borderWidth: '0' }}
                  position='relative'/>,
  root
)

The result is an iframe with no "border-width" set, with an extra attribute styles="[object Object]"

why don't you implement styles properties which you offer? @svenanders

One workaround would be to use emotion and style the Iframe component

import styled from 'react-emotion';

const BorderLessIframe = styled(Iframe)`
    border-width: 0;
`;

ReactDOM.render(
    <BorderLessIframe url='https://www.test-cors.org/'
                  width='100%'
                  height='100%'
                  position='relative'/>,
  root
);

I have the same problem

react-emotion library is now changed. Latest working code

import styled from '@emotion/styled';
const BorderLessIframe = styled(Iframe)border-width: 0;;

<BorderLessIframe
url={${window.location.origin}/bial-t2/index.html}
loading="We are fetching maps, please wait"
width="100%"
height="100%"
display="initial"
position="absolute"
/>

Fixed now thanks to @nagamejun