Place View on top of other View in React Native

What I want is to display a line (or a View) on top of multiple other Views.

I have tried with position: absolute, z-index and to write the thing I want on top last in the code. Unfortunately none of these does the trick. How can I get the line on top?

This is what I get:

View above view react native timeline

This is the code:

<ScrollView style={styles.container}>

  <View style={styles.items}>
    {, index) =>
      <View style={styles.item} key={index} elevation={3} />

  <View style={styles.line} />

const styles = StyleSheet.create({
  container: {
    flex: 1
  row: {
    margin: 10
  line: {
    backgroundColor: 'blue',
    position: 'absolute',
    top: 0,
    bottom: 0,
    left: 80,
    width: 7,

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

Ok so I found the problem xD

Apparently the elevation={3} messes it up. Everything works if I simply remove this prop from the row Views.

Solution 2

Have you tried giving the other components a z-index of 0 and the line an index of 1? Also you can try to use a position:fixed property. Hope this helps

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply