首页 > 解决方案 > 无法在具有高度的容器顶部放置图标

问题描述

我正在尝试创建一个容器,里面有一些信息,角落里有一个关闭按钮。容器本身具有一定的高度并包含一个TouchableWithoutFeedback元素,关闭按钮也是如此。我试图让它像这样,但它看起来像这样(你可以在容器的左上角看到按钮。带有信息和图标的容器的View样式以及两者的样式是:

 infoContainer: {
    backgroundColor: 'white',
    borderRadius: 16,
    paddingVertical: 17,
    paddingHorizontal: 20,
    flexDirection: 'row',
    justifyContent: 'space-between',
    width: wp('90%'),
    shadowColor: '#0d263a',
    shadowOpacity: 0.15,
    shadowOffset: { width: 0, height: 15 },
    elevation: 20,
    borderWidth: 2,
    marginBottom: 12,
    zIndex: -1,
  },
   iconContainer: {
    zIndex: 9999,
    position: 'absolute',
    backgroundColor: '#f3f8fe',
  },

标签: react-nativestylingtouchablewithoutfeedback

解决方案


推荐阅读