# react-native-figures

> a shape library for react-native

Latest version **0.1.2** (published 2021-08-04) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install react-native-figures
pnpm add react-native-figures
yarn add react-native-figures
bun add react-native-figures
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2021-08-04 |
| First published | 2021-07-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 14.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | tek256 |
| Maintainers | tek256 |
| Keywords | react, react, native, shapes, background, shapes |

## Links

- npm: https://www.npmjs.com/package/react-native-figures
- Repository: https://github.com/tek256/react-native-figures
- Homepage: https://github.com/tek256/react-native-figures#readme
- Issues: https://github.com/tek256/react-native-figures/issues
- npm.io page: https://npm.io/package/react-native-figures

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.1.2 (latest) — 2021-08-04
- 0.1.1 — 2021-07-26
- 0.1.0 — 2021-07-26

## README

<div id="header">
    <p align="center">
      <b>react-native-figures</b><br>
  	  <span font-size="16px">a shape library for react-native</span><br>
      <span font-size="12px">Made by <a href="http://tek256.com">Devon</a> with love.</span><br><br>
      <span><a href="#examples">Examples</a> | <a href="https://github.com/sponsors/tek256">Support</a></span><br><br>
    </p>
</div>

## About

react-native-figures is an attempt to streamline the implementation of various shapes for quick and easy usage. It offers an option to pass an array of figures into a container or to just manage individual shapes yourself.

## Shapes
Currently react-native-figures supports the following shape types:
```
- Circle 
- Donut
- Square
- DiamondNarrow
- CutDiamond
- Triangle
```

## Examples

Shapes Container style:

```js
import React from "react";
import { View } from "react-native";
import { Shapes } from "react-native-figures";

export const Example = () => {
  return (
    <View>
      <Shapes
        figureColor="red"
        figures={[
          {
            type: "circle",
            x: "50%",
            y: "50%",
            offsetX: -100,
            offsetY: -100,
            size: 200,
          },
          {
            type: "donut",
            color: "#1F85DE",
            x: "50%",
            y: "50%",
            offsetX: 100,
            offsetY: 75,
            size: 200,
          },
          {
            type: "triangle",
            size: 100,
            x: "10%",
            y: "15%",
            rotation: 10,
          },
        ]}
      />
    </View>
  );
};
```

Individual Shape Components:

```js
import React from "react";
import { View } from "react-native";
import { Circle, Triangle, DiamondNarrow } from "react-native-figures";

export const Example = () => {
  return (
    <View>
      <Circle x="50%" y="50%" offsetX={-100} offsetY={-100} size={200} />
      <Triangle x="10%" y="15%" rotation={10} />
      <DiamondNarrow x="15%" y="45%" rotation={36} />
    </View>
  );
};
```

## Props / Options

| Name | Options | Note | 
| ---- | ------- | ---- |
| `type` | Square, Circle, Donut, DiamondNarrow, CutDiamond, Triangle | Only used in `<Shapes/>` container figure objects |
| `size` | Number | Is scale 0.0-1.0 of screen size if `scaling` is enabled |
| `color` | Color | Color per specific shape |
| `figureColor` | Color | Default color for figures |
| `figures` | Lits of figures (js objects) i.e `[{ type: "circle" ...},{type: "square" ...}]` | Only used in `<Shapes/>` container |
| `offsetX` | Numbered offset (i.e 50, 1, -100) | Is scale 0.0-1.0 of screen width if `scalingOffsets` is enabled |
| `offsetY` | Numbered offset (i.e 51, -49, 99) | Is scale 0.0-1.0 of screen height if `scalingOffsets` is enabled |
| `rotation` | Numbered rotation in Degrees | |
| `borderRadius` | Numbered size for border radius | Only works with Square |
| `opacity` | Float between 0 and 1 (i.e 0.4) | |
| `scaling` | `true`/`false` | Enable size to be considered a scale of 0.0-1.0 of screen size. Default: `false` |
| `scalingOffsets` | `true`/`false` | Enable offsets to be considered in a scale of 0.0-1.0 of screen size. Default: `false` | 
| `sizeBasedOffsets` | `true`/`false` | Enabled offsets based on the size of the figure. Default: `false` |

## License
MIT © [Devon (tek256)](https://github.com/tek256/react-native-figures/blob/main/LICENSE)

---
_Source: https://npm.io/package/react-native-figures · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
