我在React-native中有这两个组件
const TouchableContainer = styled.TouchableOpacity`
flex: 1;
background-color: ${(props: any) => (props.expired ? '#ebebeb' : '#ffffff')};
flex-direction: row;
display: flex;
padding-horizontal: 20px;
padding-vertical: 12px;
border-radius: 20px;
margin: 3px 15px 3px 15px;
shadow-color: #000;
shadow-opacity: 0.23;
shadow-radius: 2.62px;
shadow-offset: 0px 3px;
elevation: 4;
`;
const CardView = styled.View`
flex: 1;
background-color: ${(props: any) => (props.expired ? '#ebebeb' : '#ffffff')};
flex-direction: row;
display: flex;
padding-horizontal: 20px;
padding-vertical: 12px;
border-radius: 20px;
margin: 3px 15px 3px 15px;
shadow-color: #000;
shadow-opacity: 0.23;
shadow-radius: 2.62px;
shadow-offset: 0px 3px;
elevation: 4;
`;
风格是相同的,所以这是分解它的方法:(我没有找到一个简单的解决方案,所以这是一个工作的答案)
1条答案
按热度按时间xxe27gdn1#