Consider 2 components:
const A = ({ children }) => {
return (
<View
style={{
backgroundColor: "green",
zIndex: 1,
elevation: 1,
width: 100,
height: 100,
}}
>
{children}
</View>
);
};
const B = () => {
return (
<View
style={{
bottom: 25,
zIndex: 0,
elevation: 0,
backgroundColor: "blue",
width: 100,
height: 100,
}}
></View>
);
};
When rendering these components with:
<A>
<B />
</A>
The B
component always renders over its parent component A
. Is there a way to render the parent over its child? I understand in this MRE I could simply reverse A
and B
, but is there some way to set a component's zIndex
/elevation
to be relative to and less than its parent?