question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to set two rect with 2 zIndex?

See original GitHub issue
      <Rect   zIndex={100} id="upper-rect"    draggable="true" x={2} y={0} width={100} height={1000} fill={'#555555'} onClick={null}/>
                      <Rect    zIndex={5}   id="lower-rect"   draggable="true"  x={20} y={20} width={50} height={50} fill={'#777777'} onClick={null}/>

Don’t works.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
lavrtoncommented, May 16, 2017

You need to have a state with an array of rectangles. Instead of setting zIndex, you just need move them in the array and then render.

1reaction
lavrtoncommented, May 16, 2017

Ok. Looks like zIndex is confusing in react-konva. We should add a warning when someone trying to use it. It is totally good to use zIndex in pure Konva. But it has no sense in react-konva, because for a correct order you just need to correctly define render function.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using z-index - CSS: Cascading Style Sheets - MDN Web Docs
The first article of this guide, Stacking without the z-index property, explains how stacking is arranged by default. If you want to create...
Read more >
How to set correct order of nodes using zIndex? - Konva
I will create a layer with two groups. The first group has two shapes (black rect and red circle). The second group has...
Read more >
Z-Index Explained: How to Stack Elements Using CSS
I have always struggled with the CSS property z-index. It sounds so easy at first. Elements with a higher z-index value are displayed...
Read more >
Stacking overlapping views with zIndex in Expo and React ...
zIndex is the Expo and React Native analog of CSS's z-index property which lets the developer control the order in which components are...
Read more >
How to use zIndex in react-native - Stack Overflow
7 Answers 7 · 16. You just ended a full day of debugging on Android. · 2. Works fine on both platform ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found