react-sketch
react-sketch copied to clipboard
How to set the sketch canvas Height to fill the parent component?
Hi there,
Thanks a lot for this fantastic package. I would like to let my sketch stretch the whole height of the parent component. The width has this functionality and it would be nice if it was possible also for the height. If this is already possible, then please let me know. I've filled in "100%" or "auto" for they height, but those are not working.
Hi,
Firstly, thank you for your interest! Currently I do not support it to automatically mess with the height since it will mess with the aspect ration of the drawing, maybe a good idea/brainstorming will be helpful here.
In some of my apps what I usually do is to calculate the height of the screen etc. and set it upon page loading event or something.
I think it will be handy to add. As I'm making something with bootstrap and I'll need different height lengths dependent on the device. Setting it on a fixed height is not ideal in my situation. What I did now is set the height of canvas.upper-canvas to "100%" in css, but this solution is not ideal. Also when the parent div changes height, the canvas is not responding accordingly and the drawing will overflow the container.
Try controlling height yourself! see example page