https://github.com/klarna-incubator/react-native-vector-drawable
Android vector drawables in React Native
https://github.com/klarna-incubator/react-native-vector-drawable
react-native react-native-component
Last synced: about 1 year ago
JSON representation
Android vector drawables in React Native
- Host: GitHub
- URL: https://github.com/klarna-incubator/react-native-vector-drawable
- Owner: klarna-incubator
- License: apache-2.0
- Created: 2021-04-15T19:01:44.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-02-10T13:38:22.000Z (over 2 years ago)
- Last Synced: 2025-04-03T20:38:24.372Z (about 1 year ago)
- Topics: react-native, react-native-component
- Language: Java
- Homepage:
- Size: 473 KB
- Stars: 32
- Watchers: 8
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# react-native-vector-drawable
> Android vector drawables in React Native.
[![Build Status][ci-image]][ci-url]
[![License][license-image]][license-url]
[![Developed at Klarna][klarna-image]][klarna-url]
An alternative to `react-native-svg` with 5x faster renders, lighter bundle and built in dark mode support.
## Installation
```sh
yarn add @klarna/react-native-vector-drawable
```
### Fabric installation
This library supports React Native New Architecture (aka Fabric). To use this library with your Fabric application, you have to:
1. Add latest `@klarna/react-native-vector-drawable`
2. on iOS:
- Install pods using `RCT_NEW_ARCH_ENABLED=1 pod install` – this is the same command you run to prepare a Fabric build but you also need to run it after a new native library gets added.
3. on Android:
- There are no additional steps required so long you app is configured to build with Fabric – this is typically configured by setting `newArchEnabled=true` in `gradle.properties` file in your project.
## Usage
```js
import VectorDrawable from '@klarna/react-native-vector-drawable';
const Component = () => (
);
```
### Props
| Prop | Description | Default |
| ------------------ | -------------------------------------------------------- | ------- |
| **`resourceName`** | Name of the Android vector drawable resource. | _None_ |
| **`style`** | See _Style props_. Note: border props are not supported. | _None_ |
#### Style props
| Prop | Description | Default |
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| **`resizeMode`** | Determines how to resize the image when the frame doesn't match the raw image dimensions. Possible values are `cover`, `contain`, `stretch` and `center` | `cover` |
| **`tintColor`** | Changes the color of all the non-transparent pixels to the tintColor. | _None_ |
## How to contribute
See our guide on [contributing](.github/CONTRIBUTING.md).
## Release History
See our [changelog](CHANGELOG.md).
## Deployment
Update version in `package.json` and merge to master. This will publish the package to NPM, create a draft release on GitHub and a version tag. Edit the release with additional information and publish it.
## License
Copyright © 2022 Klarna Bank AB
For license details, see the [LICENSE](LICENSE) file in the root of this project.
[ci-image]: https://img.shields.io/badge/build-passing-brightgreen?style=flat-square
[ci-url]: https://github.com/klarna-incubator/react-native-vector-drawable/actions/
[license-image]: https://img.shields.io/badge/license-Apache%202-blue?style=flat-square
[license-url]: http://www.apache.org/licenses/LICENSE-2.0
[klarna-image]: https://img.shields.io/badge/%20-Developed%20at%20Klarna-black?labelColor=ffb3c7&style=flat-square&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAYAAAAmL5yKAAAAAXNSR0IArs4c6QAAAIRlWElmTU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAALQAAAAAQAAAtAAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAABCgAwAEAAAAAQAAAA4AAAAA0LMKiwAAAAlwSFlzAABuugAAbroB1t6xFwAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA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