Skia based squircle for React Native. draws with Figma squirce style

Overview

react-native-squircle-skia

thumbnail

Disclaimer

@shopify/react-native-skia is alpha release. Use with caution.

This library dependes on figma's blog article.

What is this?

This library creates a smooth cornered rectangle view via skia path based on Figma's corner smoothing.

Installation

follow installation guide in @shopify/react-native-skia

then using yarn,

  yarn add react-native-squircle-skia

or

  npm install react-native-squircle-skia --save

Usage

basic usage

import React, { useState } from 'react';
import { SafeAreaView, StyleSheet, Text } from 'react-native';
import Squircle from 'react-native-squircle-skia';

const App = () => {
  const [radius, setRadius] = useState(50);

  return (
    <SafeAreaView style={styles.container}>
      <Squircle
        smoothing={0.7}
        style={[
          styles.squircle,
          {
            borderRadius: radius,
          },
        ]}
      >
        <Text>i am a child</Text>
      </Squircle>
    </SafeAreaView>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
  squircle: {
    width: '100%',
    aspectRatio: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: 'red',
  },
});

export default App;

Props

Squircle inherits View Props in order to use all the styles presetted in your own project.

  • This library uses borderRadius(including all the others like borderTopLeftRadius) to set corner radius.
  • This library uses backgroundColor to set the path fill

squircleParams

smoothing

number | defaults to 1

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

color

SquircleColorProp

Is used to set backgroundColor(path fill color). you can use a skia ColorProp. backgroundColor in style prop will be ignored if you set color.

TODO

  • borderWidth | borderColor | borderStyle support for Squircle.

Thanks to

Motivated by

You might also like...

Boilerplate to build Cross-Platform Apps with Expo and React Native

Expo and React Native Boilerplate Boilerplate to build Cross-Platform Apps with Expo and React Native What are you going to find in this boilerplate E

Apr 29, 2022

Fully typed hooks and utility functions for the React Native StyleSheet API

react-native-style-utilities Fully typed hooks and utility functions for the React Native StyleSheet API npm i react-native-style-utilities ESLint Set

Dec 17, 2022

React Native popup tip utility

React Native popup tip utility

react-native-tip React Native Tip is a simple package inspired in MaterialUI-Tooltip that helps you to show a quick tip to the user and highlight some

Jan 5, 2023

A social app concept with React Native

A social app concept with React Native

Social App Concept-React Native 🔥 A simple social app concept with react native. Improving day by day. Star ⭐ the repo if you like what you see 😉 .

Dec 31, 2022

React Native & Expo music player application UI

React Native & Expo music player application UI

Would you like to support me? Musicont React Native & Expo music player application UI Demo: https://expo.io/@jsxclan/musicont APK: Download on Google

Dec 14, 2022

uber-eats-clone react native

uber-eats-clone react native

Uber Eats Clone Uber Eats Clone React Native Tools and technology react-native Stripe payment checkout expo tailwind css yelp API Firebase (Authentica

Dec 7, 2022

A React Native starter template project with built-in navigation & redux toolkit.

react-native-template A React Native starter template project with built-in navigation & redux toolkit. What's included? @react-native-async-storage/a

Oct 29, 2022

A react native component that lets you build a dynamic expandable chips list.

A react native component that lets you build a dynamic expandable chips list.

React Native Expandable Chips List A react native component that lets you build a dynamic expandable chips list. Installation Run npm install react-na

Sep 23, 2022

🚀 Aplicação mobile com React Native produzida durante o Next Level Week #05

🚀 Aplicação mobile com React Native produzida durante o Next Level Week #05

✨ Tecnologias Esse projeto foi desenvolvido com as seguintes tecnologias: React Native Typescript Expo 💻 Projeto Aplicativo para lhe ajudar a lembrar

May 28, 2022
Comments
  • [Update Required] usePath is deprecated in new Skia version

    [Update Required] usePath is deprecated in new Skia version

    undefined is not a function (near '...(0, _$$_REQUIRE(_dependencyMap[5], "@shopify/react-native-skia").usePath)

    Hey, great work putting together this library! Was integrating it into a project of ours and noticed that usePath isn't used in the latest Skia version and has created a breaking change.

    Was wondering if you could update the Squircle.tsx file to accommodate for this new change?

    Best!

    opened by mrkp 2
  • What was the motivation for this lib?

    What was the motivation for this lib?

    Hey 👋,

    Nice job on the library. I was wondering, what was the motivation of creating this library instead of using this one https://github.com/tienphaw/react-native-figma-squircle

    I have used the 'react-native-figma-squircle' library in the past but I have found it to be buggy, especially on Android, so I was just wondering if that was the reason for you to create your own library using Skia.

    opened by UchennaOkafor 2
Releases(v0.3.2)
Owner
JB Paul
🎈I write codes to write less codes
JB Paul
🎉 toastify-react-native allows you to add notifications to your react-native app (ios, android) with ease. No more nonsense!

toastify-react-native ?? toastify-react-native allows you to add notifications to your react-native app (ios, android) with ease. No more nonsense! De

Zahid Ali 29 Oct 11, 2022
A react component helps bring Figma's Cursor Chat to your web applications in less than 3 minutes, making real-time collaboration anywhere

@yomo/react-cursor-chat ?? Introduction A react component helps bring Figma's Cursor Chat to your web applications in less than 3 minutes, making real

YoMo 84 Nov 17, 2022
Further split the React Native code based on Metro build to improve performance, providing `Dll` and `Dynamic Imports` features

React-Native Code Splitting Further split the React Native code based on Metro build to improve performance, providing Dll and Dynamic Imports feature

Wuba 126 Dec 29, 2022
📋 React Hooks for forms validation (Web + React Native)

English | 繁中 | 简中 | 日本語 | 한국어 | Français | Italiano | Português | Español | Русский | Deutsch | Türkçe Features Built with performance and DX in mind

React Hook Form 32.4k Dec 29, 2022
A personal project, made with React, React Native, Typescript and some of the most used front-end libraries.

A personal project, made with React, React Native, Typescript and some of the most used front-end libraries.

Alvaro Junior 1 Jul 23, 2022
Isolated React component development environment with a living style guide

Isolated React component development environment with a living style guide React Styleguidist is a component development environment with hot reloaded

Styleguidist 10.6k Jan 5, 2023
An example of a travel style app built with Ionic React

ionic-react-travel-app An example of a travel style app built with Ionic React If you'd like to support, you can buy me a coffee ☕️ Included in this I

Alan Montgomery 29 Sep 27, 2022
Terminal Styled Portfolio Website ˋ( ° ▽、° ) , a terminal style/styled portfolio website made with <3 using react.

AshTerm A Terminal Styled Portfolio Website. ??‍?? Made Using- ⚛ Framework ReactJS ?? Terminal react-console-emulator ?? Deployed using CloudFlare Run

ashish 67 Nov 22, 2022
Free React Native library to display local notifications.

React-Native NotiFREE ⚛ React Native library to display local notifications. A FREE alternative to React Native NotiFEE. Why? Nobody can remove the gr

Douglas Nassif Roma Junior 23 Nov 10, 2022
A collection of sample apps built using GetStream and React Native

React Native samples [ Built with ♥ at Stream ] This repo contains projects and samples developed by the team and Stream community, using React Native

Stream 93 Jan 8, 2023