Android位置:绝对不应在带有边框的容器内截断绝对值

时间:2018-08-09 11:27:17

标签: android react-native

此问题与https://github.com/facebook/react-native/issues/12534重复。我将其发布是因为没有更好的解决方案来解决此问题。

在iOS中,另一方面,它在Android上运行正常。

enter image description here

enter image description here

这是我的代码,可以更好地理解你们。

//Confirm Popup component

import React from 'react';
import { Modal, Text, View, StyleSheet, Image } from 'react-native';

//Components
import { Card, CardSection, Button } from '../common';

const ConfirmPopup = ({ children, onAccept, onDecline, visible }) => {
   const { textStyle, containerStyle } = styles;
   return (
      <Modal
         visible={visible}
         transparent
         animationType="slide"
         onRequestClose={()=>{alert('Please Select One Of Them')}}
      >
         <View style={containerStyle}>
            <Card style={{position:'relative'}}>
               <Card>
                  <CardSection>
                     <Text style={textStyle}>{children}</Text>
                  </CardSection>
               </Card>
               <Card>
                  <CardSection style={{flexDirection:'row',justifyContent:'space-between'}}>
                     <Button
                        onPress={onAccept}
                        style={{marginHorizontal:5}}
                     >
                        Yes
                     </Button>
                     <Button
                        onPress={onDecline}
                        style={{ marginHorizontal: 5 }}
                     >
                        No
                     </Button>
                  </CardSection>
               </Card>
               <View style={styles.iconWrapper}>
                  <Image source={require('../../assets/img/close.png')} style={styles.iconStyle} />
               </View>
            </Card>
         </View>
      </Modal>
   )
}

const styles = StyleSheet.create({
   containerStyle: {
      backgroundColor: 'rgba(0,0,0,0.75)',
      flex: 1,
      justifyContent:'center'
   },
   textStyle: {
      fontSize: 18,
      fontWeight:'bold'
   },
   iconWrapper: {
      position: 'absolute',
      top: -12,
      right:-6
   },
   iconStyle:{
      height: 30,
      width:30
   }
})

1 个答案:

答案 0 :(得分:0)

对我来说,问题出现在Tabs组件上的“角度材质”上 在所有容器上都显示“ overflow: visible !important;”,我终于找到了它!

如果我添加这些类,它将起作用!

.mat-tab-body-wrapper {
    overflow: visible !important;
}

.mat-tab-body.mat-tab-body-active {
    overflow: visible !important;
}