CSS Triangles in React Native

前端 未结 4 1867
Happy的楠姐
Happy的楠姐 2021-02-12 14:28

\"triangle\"

I\'m working on an app that uses triangles that overlay other containers/divs. Had that solved with CS

4条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-12 14:46

    render() {
        return (
            
        );
    }
    

    And styles

    const styles = {
        triangle: {
            width: 0,
            height: 0,
            backgroundColor: 'transparent',
            borderStyle: 'solid',
        },
        arrowUp: {
            borderTopWidth: 0,
            borderRightWidth: 30,
            borderBottomWidth: 30,
            borderLeftWidth: 30,
            borderTopColor: 'transparent',
            borderRightColor: 'transparent',
            borderBottomColor: "tomato",
            borderLeftColor: 'transparent',
        },
        arrowRight: {
            borderTopWidth: 30,
            borderRightWidth: 0,
            borderBottomWidth: 30,
            borderLeftWidth: "tomato",
            borderTopColor: 'transparent',
            borderRightColor: 'transparent',
            borderBottomColor: 'transparent',
            borderLeftColor: "tomato",
        },
        arrowDown: {
            borderTopWidth: 30,
            borderRightWidth: 30,
            borderBottomWidth: 0,
            borderLeftWidth: 30,
            borderTopColor: "tomato",
            borderRightColor: 'transparent',
            borderBottomColor: 'transparent',
            borderLeftColor: 'transparent',
        },
        arrowLeft: {
            borderTopWidth: 30,
            borderRightWidth: "tomato",
            borderBottomWidth: 30,
            borderLeftWidth: 0,
            borderTopColor: 'transparent',
            borderRightColor: "tomato",
            borderBottomColor: 'transparent',
            borderLeftColor: 'transparent',
        },
        arrowUpLeft: {
            borderTopWidth: 30,
            borderRightWidth: "tomato",
            borderBottomWidth: 0,
            borderLeftWidth: 0,
            borderTopColor: "tomato",
            borderRightColor: 'transparent',
            borderBottomColor: 'transparent',
            borderLeftColor: 'transparent',
        },
        arrowUpRight: {
            borderTopWidth: 0,
            borderRightWidth: "tomato",
            borderBottomWidth: 30,
            borderLeftWidth: 0,
            borderTopColor: 'transparent',
            borderRightColor: "tomato",
            borderBottomColor: 'transparent',
            borderLeftColor: 'transparent',
        },
        arrowDownLeft: {
            borderTopWidth: 30,
            borderRightWidth: 0,
            borderBottomWidth: 0,
            borderLeftWidth: "tomato",
            borderTopColor: 'transparent',
            borderRightColor: 'transparent',
            borderBottomColor: 'transparent',
            borderLeftColor: "tomato",
        },
        arrowDownRight: {
            borderTopWidth: 0,
            borderRightWidth: 0,
            borderBottomWidth: 30,
            borderLeftWidth: "tomato",
            borderTopColor: 'transparent',
            borderRightColor: 'transparent',
            borderBottomColor: "tomato",
            borderLeftColor: 'transparent',
        },
    }
    

    Source : https://github.com/Jpoliachik/react-native-triangle

提交回复
热议问题