如何使用 react-native 绘制梯形/梯形? [英] How to draw a trapezium/trapezoid with react-native?
本文介绍了如何使用 react-native 绘制梯形/梯形?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是 id 处的 css 代码工作正常:
this is code by css at id works fine:
border-bottom: 100px solid #0000ff80;
border-right: 50px solid transparent;
height: 0;
width: 100px;
<div id="trapezoid"></div>
但是我在 react-native 上的代码不起作用:
but my code on react-native doesn't work:
<View style={{width:100,height:0,borderBottomWidth:100,borderBottomColor:'#000',borderLeftWidth:0,borderRightWidth:50,borderRightColor:'#000'}}>
</View>
推荐答案
试试这个
var Trapezoid = React.createClass({
render: function() {
return (
<View style={styles.trapezoid} />
)
}
})
trapezoid: {
width: 200,
height: 0,
borderBottomWidth: 100,
borderBottomColor: 'red',
borderLeftWidth: 50,
borderLeftColor: 'transparent',
borderRightWidth: 50,
borderRightColor: 'transparent',
borderStyle: 'solid'
}
有关更多此类形状的信息,请查看 https://codedaily.io/教程/22/The-Shapes-of-React-Native
for more such shapes checkout https://codedaily.io/tutorials/22/The-Shapes-of-React-Native
这篇关于如何使用 react-native 绘制梯形/梯形?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文