Open posebear1990 opened 2 years ago
Any word on this? I'm new to the library and love it but quickly came across this bug. I've made an alternative example - toggle the boolean at the top and I believe in theory, it should be rendered identically whether it's through dynamic rendering or not.
const dynamicRendering = false;
const Image = () => (
<Svg width="200" height="200" viewBox="-100 -100 200 250" debug>
<Polygon points="0,0 80,120 -80,120" fill="#234236" />
<Polygon points="0,-40 60,60 -60,60" fill="#0C5C4C" />
<Polygon points="0,-80 40,0 -40,0" fill="#38755B" />
<Rect x="-20" y="120" width="40" height="30" fill="#A32B2D" />
</Svg>
);
const WrappedImage = () => (
<View style={{ position: 'absolute', top: 0, left: 0 }}>
<Image />
</View>
);
const Example = () => (
<Document>
<Page>
<Text>Page One</Text>
{dynamicRendering === false && <WrappedImage />}
{dynamicRendering === true && <View fixed render={() => <WrappedImage />}></View>}
<Text break>Page Two</Text>
</Page>
</Document>
);
ReactPDF.render(<Example />);
Describe the bug If the
Svg
is rendered under the render prop of the View element, then the scaling of theSvg
will not working.To Reproduce See: react-pdf REPL No matter how we set width and height, the size of svg will not change.
Expected behavior Scaling can working as expected
Screenshots
Desktop (please complete the following information):