Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 29762

z-order problem between views in react-native

$
0
0

Note: I am searching for a solution that works for android.

I have the following hierarchy:

Main App:
     <View>
          <View>
              <Button title="Click Me!" />
          </View>

          <MyCustomElement />
     </View>

MyCustomElement:

     //overlay
     <View style={
                  height: '100%',
                  width: '100%',
                  backgroundColor: 'rgba(0, 0, 0, 0.25)',
                  position: 'absolute',
                  top: '100%',
                  left: 0,
                  alignItems: 'center',
                 }
      >
        //content
        <View style={
                      height: 100,
                      width: 100,
                      backgroundColor: 'red',
                    } 
        />

      </View>

The following is the obtained result:

enter image description here

I googled a bit and found that to alter z-order of views, I can use elevation, however it produces this artifact (the shadow at the edges of the screen, since my overlay color is transparent):

enter image description here

Lastly, I even tried to change only the elevation value of the red child, but it produces result as observed in 1st screenshot.

I am expecting the output as of 2nd only without the shadows.


Viewing all articles
Browse latest Browse all 29762


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>