Why doesn't support zIndex?
See original GitHub issueI 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:
- Created 8 years ago
- Comments:19 (10 by maintainers)
Top 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 >
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 Free
Top 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
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.
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