I have to put a card between two elements in a flatlist in react native project. The actual situation is this, and how you can see it goes under the next calendar row. I am using zIndex right now but it's not working
<DateContainer>
<Body color={Colors.GREY_3}>{getWeekDay(formattedDate).toLowerCase()}</Body>
<DayContainer isSelectedDay={isSelectedDay}>
<Day color={isSelectedDay ? Colors.WHITE : Colors.BLACK} weight={FontWeight.BOLD}>
{formattedDate.date()}
</Day>
</DayContainer>
</DateContainer>
{/* {children} */}
<View
onLayout={({
nativeEvent: {
layout: { height }
}
}) => setCardHeight(height / 2)}
style={[
{ flex: 1 },
isNightShift && { position: 'absolute', width: '84%', left: 79, bottom: -cardHeight, zIndex: 10 }
]}
>
{children}
</View>
</Container>
);
};
interface IContainerProps {
backgroundColor?: 'white' | 'grey';
isNightShift?: boolean;
}
const Container = styled.TouchableOpacity<IContainerProps>`
align-items: center;
background-color: ${({ backgroundColor }) => (backgroundColor === 'grey' ? '#FAFBFC' : Colors.WHITE)};
flex-direction: row;
min-height: ${({ isNightShift }) => (isNightShift ? 124 : 72)};
padding-left: 21px;
padding-right: 16px;
padding-vertical: 20px;
`;```