【问题标题】:How to create a one side skewed custom button component in react nativeHow to create a one side skewed custom button component in react native
【发布时间】:2022-12-01 14:39:56
【问题描述】:

I want to create a custom react native button which is skewed one side. I have referred so many articles but neither of then doesn't solved my requirements. Here is the sample of the button looks like. One button skewed left and other button skewed right.

Here is the buttons looks like.

One side skewed button example 1

One side skewed button example 2

Anybody please help me to create this button.

【问题讨论】:

    标签: javascript css reactjs react-native button


    【解决方案1】:

    It is possible to create a skewed button by adding some style. Try this style.

    import React from "react";
    import { View, Text, StyleSheet } from "react-native";
    
    const App = () => {
      return <View style={styles.button} />;
    };
    
    const styles = StyleSheet.create({
      button: {
        width: 250,
        height: 0,
        borderTopWidth: 100,
        borderBottomColor: "red",
        borderLeftWidth: 0,
        borderLeftColor: "transparent",
        borderRightWidth: 50,
        borderRightColor: "transparent",
        borderStyle: "solid",
      },
    });
    
    export default App;
    

    【讨论】:

      猜你喜欢
      • 2022-12-02
      • 2022-12-02
      • 2022-12-16
      • 2022-12-02
      • 2022-12-27
      • 2022-12-02
      • 2022-12-01
      • 2022-12-19
      • 2022-12-02
      相关资源
      最近更新 更多