New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-native-figma-squircle

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-figma-squircle

Figma-flavored squircles for React Native

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2K
decreased by-4.57%
Maintainers
1
Weekly downloads
 
Created
Source

React Native Figma Squircle

Stable Release license

Figma-flavored squircles for React Native

Disclaimer

This library is not an official product from the Figma team and does not guarantee to produce the same results as you would get in Figma.

What is this?

Figma has a great feature called corner smoothing, allowing you to create rounded shapes with a seamless continuous curve (squircles).

This library helps you bring those squircles to your React Native apps.

Installation

Install react-native-svg

Then install this library:

yarn add react-native-figma-squircle

or

npm install react-native-figma-squircle

Usage

A SquircleView can be used just like a normal View, except the background is rendered separately from the view background. So to change how it looks, you'll have to use the squircleParams prop instead of the style prop.

import { SquircleView } from 'react-native-figma-squircle'

function PinkSquircle() {
  return (
    <SquircleView
      style={{ width: 200, height: 200 }}
      squircleParams={{
        cornerSmoothing: 0.7,
        cornerRadius: 30,
        fillColor: 'pink',
      }}
    />
  )
}

You can also use it with MaskedView to apply the squircle shape to an Image.

import MaskedView from '@react-native-community/masked-view'

function ProfilePicture() {
  return (
    <MaskedView
      style={styles.profilePicture}
      maskElement={
        <SquircleView
          style={StyleSheet.absoluteFill}
          squircleParams={{
            cornerRadius: 30,
            cornerSmoothing: 0.7,
            fillColor: 'pink',
          }}
        />
      }
    >
      <Image style={StyleSheet.absoluteFill} source={{ uri: 'https://...' }} />
    </MaskedView>
  )
}

Props

Inherits View Props

squircleParams

cornerSmoothing

number | Required

Goes from 0 to 1, controls how smooth the corners should be.

cornerRadius

number | defaults to 0

topLeftCornerRadius

number

topRightCornerRadius

number

bottomRightCornerRadius

number

bottomLeftCornerRadius

number

fillColor

Color | defaults to #000

Similar to backgroundColor in the style prop.

strokeColor

Color | defaults to #000

Similar to borderColor in the style prop.

strokeWidth

number | defaults to 0

Similar to borderWidth in the style prop.

Thanks

  • figma-squircle - This gives you just the SVG path so you can have your Figma-flavored squircles on other platforms as well.

Keywords

FAQs

Package last updated on 08 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc