0.2.0 • Published 2 years ago

react-native-zigzag-lines v0.2.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

react-native-zigzag-lines

Zig-zag border for using on tickets or receipts

Installation

yarn add react-native-zigzag-lines

This package depends on react-native-svg, make sure to install it

Usage

import React, { useState } from "react"
import { View } from "react-native"
import ZigzagLines from "react-native-zigzag-lines"

const App = () => {
  const [width, setWidth] = useState()
  return <View
    style={{
      flexDirection: "column",
      justifyContent: "center",
      backgroundColor: "#DEDEDE",
    }}
  >
    {typeof width == 'number' && <ZigzagLines
      width={width}
      backgroundColor="#DEDEDE"
      color="#FFF"
    />}
    <View
      style={{ backgroundColor: "#FFF" }}
      onLayout={e => setWidth(e.nativeEvent.layout.width)}
    />
    {typeof width == 'number' && <ZigzagLines
      position="bottom"
      width={width}
      backgroundColor="#DEDEDE"
      color="#FFF"
    />}
  </View>
}

Properties

NameTypeDescriptionDefaultRequired
widthnumberlength of zigzag border360Yes
heightnumberheight of zigzag jags10No
position"bottom" \| "top"position of zigzag border"top"No
backgroundColorstringbackground color of container#DEDEDENo
colorstringcolor of zigzag jags#FFFNo
jagWidthnumberwidth of zigzag jags15No
jagBottomnumberpadding bottom of zigzag jags0No
styleStyleProp<ViewStyle>style of containerNo
svgPropsSvgPropsproperties of Svg componentNo
pathPropsPathPropsproperties of Path componentNo

Note

  • svgProps does not accept style, width, height, and viewBox properties
  • pathProps does not accept d, and fill properties