# @hawkrives/react-native-alternate-icons

> React Native Alternate Icons for iOS 10.3+

Latest version **0.6.2** (published 2022-09-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install @hawkrives/react-native-alternate-icons
pnpm add @hawkrives/react-native-alternate-icons
yarn add @hawkrives/react-native-alternate-icons
bun add @hawkrives/react-native-alternate-icons
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.6.2 |
| Published | 2022-09-27 |
| First published | 2017-11-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 17.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Joey Kamsteeg |
| Maintainers | hawkrives, drewvolz |
| Keywords | react-component, react-native, ios, alternate icons |

## Links

- npm: https://www.npmjs.com/package/@hawkrives/react-native-alternate-icons
- Repository: https://github.com/allaboutolaf/react-native-alternate-icons
- Issues: https://github.com/allaboutolaf/react-native-alternate-icons/issues
- npm.io page: https://npm.io/package/@hawkrives/react-native-alternate-icons

## Alternatives

- [@fortawesome/react-fontawesome](https://npm.io/package/@fortawesome/react-fontawesome.md) — 2.2M weekly downloads
- [roboto-fontface](https://npm.io/package/roboto-fontface.md) — 196.0K weekly downloads
- [@react-native-vector-icons/common](https://npm.io/package/@react-native-vector-icons/common.md) — 150.4K weekly downloads
- [@procore/core-icons](https://npm.io/package/@procore/core-icons.md) — 4.6K weekly downloads
- [@react-md/material-icons](https://npm.io/package/@react-md/material-icons.md) — 1.6K weekly downloads

## Recent versions

- 0.6.2 (latest) — 2022-09-27
- 0.6.0-2 (next) — 2019-11-02
- 0.6.0 — 2019-11-02
- 0.6.0-1 — 2019-11-02
- 0.6.0-0 — 2019-11-02
- 0.4.7 — 2018-01-24
- 0.4.6 — 2018-01-21
- 0.4.5 — 2017-11-19
- 0.4.4 — 2017-11-19
- 0.4.3 — 2017-11-19
- 0.4.2 — 2017-11-02
- 0.4.1 — 2017-11-02
- 0.4.0 — 2017-11-02

## README

# react-native-alternate-icons
React Native Alternate Icons for iOS 10.3+

## Requirements
* React Native 0.44+ (only tested on 0.44)

## Installation

```bash
npm install @hawkrives/react-native-alternate-icons@latest --save
```

## Link the library to your React Native project

```bash
react-native link
```

#### Manual Linking

https://facebook.github.io/react-native/docs/linking-libraries-ios.html

## Preparation & Code Sample

### Preparation

#### Add your icons into your Xcode Project
![Icons in your Xcode Project](http://kamsteegsoftware.nl/react-native-alternate-icons/icons-project.png)

#### Add the following code to your info.plist
```xml
<key>supportsAlternateIcons</key>
<true/>
<key>CFBundleIcons</key>
<dict>
  <key>CFBundlePrimaryIcon</key>
  <dict>
    <key>CFBundleIconFiles</key>
    <array>
      <string>icon_filename</string>
    </array>
    <key>UIPrerenderedIcon</key>
    <true/>
  </dict>
  <key>CFBundleAlternateIcons</key>
  <dict>
    <key>icon_type_alternate_name</key>
    <dict>
      <key>CFBundleIconFiles</key>
      <array>
        <string>alternate_icon_filename</string>
      </array>
      <key>UIPrerenderedIcon</key>
      <true/>
    </dict>
  </dict>
</dict>
```

#### Using in your React Native applications
- `setIconName(name: string): Promise<void>` – takes one of the icon "names" defined in your Info.plist (`icon_type_alternate_name`, in the example above)
- `getIconName(): Promise<string>` – returns the current icon's name
- `reset(): Promise<void>` – resets the icon to the default bundle icon
- `isSupported(): Promise<boolean>` – checks if the current devide is supported. Always returns `false` on Android.

Because these all return promises, you can use them with ES2016's async/await syntax, too!

For example, you can import all of the functions as a namespace:

```js
import * as Icons from '@hawkrives/react-native-alternate-icons';

await Icons.setIconName(iconName);
```

or import just one or two of them:

```js
import {getIconName} from '@hawkrives/react-native-alternate-icons';

await getIconName();
```

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