使用react native中的View创建V形



我想使用视图创建一个V形,但我不确定这是否超出了视图的范围。

我试着使用边界半径,如下所示,但这只是绕过了视图。

import React, { Component } from 'react'
import { View, Text } from 'react-native'
export class Chevron extends Component {
render() {
return (
<View
style={{
backgroundColor: "blue",
borderTopRightRadius:90,
borderBottomRightRadius:90, 
borderTopLeftRadius:-90, 
borderBottomLeftRadius:-90, 
}}
>
<Text>{this.props.item}</Text>
</View>
)
}
}
export default Chevron

如果你不想制作复杂的形状,最好的选择是使用库react-native-svg。你可能可以使用他们提供的多边形来实现这一点(https://github.com/react-native-svg/react-native-svg)

最新更新