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.

Why doesn't support zIndex?

See original GitHub issue

I build a component, but i can not set z-index invariant violation: 'zIndex' is not a valid style property. @vjeux


'use strict';

var React = require('react-native');

var {
  ActivityIndicatorIOS,
  StyleSheet,
  Text,
  View
} = React;

var Loading = React.createClass({
  render: function () {
    return (
      <View style={ styles.container }>
        <View style={ styles.loading }>
          <ActivityIndicatorIOS style={ styles.animate } animating={ true }></ActivityIndicatorIOS>
          <Text style={ styles.text }>Loading...</Text>
        </View>
      </View>
    );
  }
});

var styles = StyleSheet.create({
  container: {
    zIndex: 1,
    position: 'absolute',
    alignItems: 'center'
  },

  loading: {
    width: 94,
    height: 94,
    padding: 15,
    opacity: .5,
    borderRadius: 4,
    backgroundColor: 'black'
  },

  animate: {
    marginBottom: 15
  },

  text: {
    color: '#FFF'
  }

});

module.exports = Loading;

Thanks!

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:19 (10 by maintainers)

github_iconTop GitHub Comments

34reactions
alexprice1commented, Mar 19, 2016

I know this is closed, but this is preventing something as simple as a dropdown from being implementable?

The only way I can think of doing one is to have 1 single View at the bottom of all my other views that happens to hold my options, that I move around across the app depending on which drop-down might need it. That seems really hacky.

8reactions
ericvicenticommented, Apr 6, 2015

zIndex can be controlled by re-arranging the components when you render. The later views will be drawn above the earlier ones.

This is easier for debugging because you only need to look at the render order, instead of needing to check the render order and the stylesheet.

#559, #131

Read more comments on GitHub >

github_iconTop Results From Across the Web

4 reasons your z-index isn't working (and how to fix it)
This article will explain in detail four of the most common reasons that z-index isn't working for you. You'll learn how to use...
Read more >
Why does z-index not work? - Stack Overflow
The z-index property only works on elements with a position value other than static (e.g. position: absolute; , position: relative; ...
Read more >
CSS Z-Index Not Working? How to Fix It Using Stack Order
The z-index property of CSS is a tricky one. It won't work easily by itself if you don't know how to use it...
Read more >
CSS Z-Index Not Working! Send Help!
TL;DR: the most common cause for z-index not working is not explicitly declaring a CSS position value (i.e. position: relative, absolute, fixed ...
Read more >
z-index - CSS: Cascading Style Sheets - MDN Web Docs
The box does not establish a new local stacking context. The stack level of the generated box in the current stacking context is...
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