# react-native-svg-transforms

> Correctly converts transform props like translateX into web-safe `translate` prop

Latest version **0.1.1** (published 2021-07-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-svg-transforms
pnpm add react-native-svg-transforms
yarn add react-native-svg-transforms
bun add react-native-svg-transforms
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2021-07-30 |
| First published | 2021-07-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jof Arnold |
| Maintainers | jofarnold |

## Links

- npm: https://www.npmjs.com/package/react-native-svg-transforms
- Repository: https://github.com/JofArnold/react-native-svg-transforms
- Issues: https://github.com/JofArnold/react-native-svg-transforms
- npm.io page: https://npm.io/package/react-native-svg-transforms

## Dependencies (3)

- [react](https://npm.io/package/react.md) ^17.0.2
- [lodash.omit](https://npm.io/package/lodash.omit.md) ^4.5.0
- [react-native-web](https://npm.io/package/react-native-web.md) ^0.17.1

## Recent versions

- 0.1.1 (latest) — 2021-07-30
- 0.1.0 — 2021-07-30

## README

# react-native-svg-transforms

This is a rough and ready package that converts invalid SVG props from into valid ones.

For instance if you're using `react-native-svg` but wish your code to also render on web with `react-native-web` you will notice that the props on your SVG components in the DOM are wrong. Rather than

```javascript
<svg transform="translate(123, 456)" />
```

You'll get

```javascript
<svg tranlateX="123" translateY="123" />
```

Which won't work.

This package applies a naive transform that takes those props, converts them to a string for the `translate` DOM attribute and omits those that are invalid.

If this project becomes useful to more people I'll add tests, TypeScript, linting, docs etc but for now it does the job nicely and may well for you too.

I've put zero testing into things like refs so your mileage may very well vary.

# Usage

```
yarn add react-native-svg-transforms
# or
npm i react-native-svg-transforms 
```


In your WebPack config add the following module alias and you're good to go.

```javascript
{
  ...
  "react-native-svg": "react-native-svg-transforms"
}
```

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