I am trying to render elements conditionally where each element has different zIndex style property.
Using folowing code in Android emulator with react-native 0.30.0.
importReact,{Component}from'react';import{StyleSheet,Text,View}from'react-native';exportdefaultclassDemoextendsComponent{constructor(props,ctx){super(props,ctx);this.state={showGreen: true,};}render(){return(<Viewstyle={{flex: 1,padding: 20}}><Viewstyle={[styles.item,{zIndex: 3,backgroundColor: 'red'}]}><Text>zIndex: 3</Text></View>{this.state.showGreen&&<Viewstyle={[styles.item,{zIndex: 2,backgroundColor: 'green'}]}><Text>zIndex: 2</Text></View>}<Viewstyle={[styles.item,{zIndex: 1,backgroundColor: 'blue'}]}><Text>zIndex: 1</Text></View><Viewstyle={styles.button}><TextonPress={()=>this.setState({showGreen: !this.state.showGreen})}>
Toggle green
</Text></View></View>);}}conststyles=StyleSheet.create({item: {marginTop: -20,height: 50,paddingTop: 22,},button: {backgroundColor: 'gray',marginTop: 30,}});Initial screen looks like expected:

When I click 'Toggle green' button to dynamically show/hide green element it hides blue element instead and furthermore element's text is missing:

When I click the button again, red and green elements remains visible and the toggle button jumps down.
I am trying to render elements conditionally where each element has different zIndex style property.
Using folowing code in Android emulator with react-native 0.30.0.
Initial screen looks like expected:
When I click 'Toggle green' button to dynamically show/hide green element it hides blue element instead and furthermore element's text is missing:
When I click the button again, red and green elements remains visible and the toggle button jumps down.