Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/outsung/expo-dynamic-app-icon

🤖 Programmatically change the app icon in Expo.
https://github.com/outsung/expo-dynamic-app-icon

expo react-native

Last synced: about 2 months ago
JSON representation

🤖 Programmatically change the app icon in Expo.

Awesome Lists containing this project

README

        

# expo-dynamic-app-icon

Programmatically change the app icon in Expo.

## Install

```
npx expo install expo-dynamic-app-icon
```

## Set icon file

add plugins in `app.json`

```typescript
"plugins": [
[
"expo-dynamic-app-icon",
{
"red": { // icon name
"image": "./assets/icon1.png", // icon path
"prerendered": true // for ios UIPrerenderedIcon option
},
"gray": {
"image": "./assets/icon2.png",
"prerendered": true
}
}
]
]
```

## Check AndroidManifest (for android)

```
expo prebuild
```

check added line
[AndroidManifest.xml](./example/android/app/src/main/AndroidManifest.xml#L33-L44)

```xml
...












...
```

## Create new `expo-dev-client`

create a new `expo-dev-client` and begin using `expo-dynamic-app-icon`

## Use `setAppIcon`

- if error, return **false**
- else, return **changed app icon name**

```typescript
import { setAppIcon } from "expo-dynamic-app-icon";

...

setAppIcon("red") // set icon 'assets/icon1.png'
```

## Use `getAppIcon`

get current app icon name

- default return is `DEFAULT`

```typescript
import { getAppIcon } from "expo-dynamic-app-icon";

...

getAppIcon() // get current icon name 'red'
```

Buy Me A Coffee