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 1 year ago
JSON representation
🤖 Programmatically change the app icon in Expo.
- Host: GitHub
- URL: https://github.com/outsung/expo-dynamic-app-icon
- Owner: outsung
- Created: 2022-11-21T13:11:30.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-23T22:19:19.000Z (over 2 years ago)
- Last Synced: 2025-04-10T01:08:06.638Z (about 1 year ago)
- Topics: expo, react-native
- Language: Java
- Homepage:
- Size: 1020 KB
- Stars: 169
- Watchers: 2
- Forks: 30
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-side-quests - outsung/expo-dynamic-app-icon
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'
```
