opacity property in <Rect/> occur error
See original GitHub issue- Hello, I’m using your React-Konva library and find it super easy and helpful!
- I just have 1 issue atm. everything worked fine until I add
opacity={opacity}
on Rect component. - I also tried
opacity="0.8"
(which caused type error) andopacity={0.8}
but it also caused exact same error. So I’m wondering is this my problem or konva opacity problem! - I’d appreciate if you also let me know what I could do to fix it!
- FYL)
rgba()
worked fine to add opacity! But I’m asking just in case I’m missng something about opacity propery or any possible issues
Thanks a lot!
[Error]
[My Code]
const VerticallyDraggableDiv: React.FC<VerticallyDraggableDivProps> = ({
x,
y,
width,
height,
handleDragging,
handleDragEnd,
borderColor,
backgroundColor,
text,
fontColor,
idx,
}) => {
const [opacity, setOpacity] = useState(0.5);
return (
<Group
x={x}
y={y}
draggable
dragBoundFunc={(pos) => handleDragging({ pos })}
onDragEnd={idx !== undefined && handleDragEnd ? (e) => handleDragEnd({ e, idx }) : undefined}
>
<Rect
width={width}
height={height}
stroke={borderColor}
strokeWidth={0.3}
fill={backgroundColor}
text={text}
cornerRadius={2}
opacity={opacity} // opacity is here!
/>
<Text
width={width}
height={height}
fill={fontColor}
fontSize={20}
align="center"
verticalAlign="middle"
text={text}
/>
</Group>
);
};
export default VerticallyDraggableDiv;
+Also my react-konva and konva versions are like below
"konva": "^8.3.6",
"react-konva": "^17.0.2-6",`
Issue Analytics
- State:
- Created a year ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Property 'opacity' does not exist on type 'IntrinsicAttributes ...
Property 'opacity' does not exist on type 'IntrinsicAttributes' throwing and error for view Opacity in React native.
Read more >Opacity properties should affect nothing but opacity · Issue #264
In some cases (in eg SVG 1 or 2 or CSS), setting/changing opacity changes the stacking order / changes which items overlap which....
Read more >Opacity Properties In Components - Adobe Support Community
Solved: I've set up my mobile app design that has a lot of buttons. The button shape/style is a component (cloud-based in case...
Read more >Fabric.js | Rect opacity Property - GeeksforGeeks
In this article, we are going to see how to set the opacity of a rectangle canvas using FabricJS. The canvas rectangle means...
Read more >Masks - Figma Help Center
Note: If all layers being masked are hidden or have 0% opacity, then the object's mask outlines won't appear. Use shape outlines to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t know. This is why I need a demo. You don’t need to give access to your app or copy its code. Just make a small, reproducible demo. Simple stage with one rectangle. And set properties in a way when error is visible.
Looks like Konva can’t handle the case, when size of the stage is 0. As a workaround, set minimum to 1.
Closing, as extreme edge case. But I am happy to apply Pull Request to handle zero stage size correctly.