7urkm3n
7urkm3n

Reputation: 6311

React Native Styling

I am trying to understand more about Styling in React Native.

While Dragging a element into bottom container (Yellow), the element goes underneath.

enter image description here

enter image description here

//View

  <View style={styles.container}>
    <View style={styles.itemContainer}>
      <DraggingItem />
    </View>
    <View style={styles.dropContainer}>
           //2nd container
    </View>
  </View>


//STYLING

  container: {
    flex: 1,
    backgroundColor: '#fff',
  },

  itemContainer: {
    backgroundColor: 'green',
    height: (window.height*56)/100,
  },

  dropContainer: {
    flex: 1,
    backgroundColor: 'yellow',
    height: (window.height*40)/100,
  },

// ITEM STYLE

 text: {
    marginTop: 25,
    marginLeft: 5,
    marginRight: 5,
    // alignItems: 'center',
    // justifyContent: 'center',
    textAlign: 'center',
    color: "#fff"
  },

  item: {
    backgroundColor: "red",
    width: window.width,
    height: 80,
    borderRadius: 15
  }

Upvotes: 0

Views: 101

Answers (1)

eureka
eureka

Reputation: 181

you can try zIndex and read more about it hear. if zIndex if your yellow box is bigger that red one, the thing happen like you have in your image. if you don't want it, give red one the bigger zIndex.

Upvotes: 1

Related Questions