如何在React Native中仅对1个角使用边界半径?
我有一个模态窗口
如您所见,下角没有圆角,当我使用backgroundColor作为按钮时会发生这种情况。我试图将隐藏的溢出设置为模式包装器,但这对我没有帮助。现在,我想对按钮使用边框半径(仅适用于1个角)。
如何在React Native中仅对1个角使用边界半径?
我有一个模态窗口
如您所见,下角没有圆角,当我使用backgroundColor作为按钮时会发生这种情况。我试图将隐藏的溢出设置为模式包装器,但这对我没有帮助。现在,我想对按钮使用边框半径(仅适用于1个角)。
overflow: 'hidden'在按钮的父视图中使用
Answers:
您是否已经尝试以下方法?
- borderBottomLeftRadius:数字
- borderBottomRightRadius:数字
- borderTopLeftRadius:数字
- borderTopRightRadius:数字
另外,您可以在视图组件docs中找到更多信息。
borderBottomLeftRadius: 5“否”按钮和borderBottomRightRadius: 5“是”按钮上的内容。如果这不起作用,请向我们提供您的代码示例,以便我们检查是否有其他干扰。
borderRadius起作用,但会在所有角落应用半径
overflow:hidden您的视图(或文本)。它应该工作。
在您的样式中添加以下属性:
borderBottomLeftRadius: numberborderBottomRightRadius: numberborderTopLeftRadius: numberborderTopRightRadius: number这对我有用。
谢谢
<View style={styles.imgBox}>
<Image source={{ uri: 'your image url' }} style={styles.img} />
</View>
const styles = EStyleSheet.create({
imgBox: {
width: px(72),
height: px(72),
borderBottomLeftRadius: 2,
borderTopLeftRadius: 2,
overflow: 'hidden',
},
img: {
width: px(72),
height: px(72),
},
})
对于ios来说看起来不错。
import语句吗?
border-top/bottom-left/right-radiusCSS属性(例如border-bottom-right-radius: 5px)