Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 3 months 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 (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-23T22:19:19.000Z (8 months ago)
- Last Synced: 2024-05-11T05:44:43.851Z (6 months ago)
- Topics: expo, react-native
- Language: Java
- Homepage:
- Size: 1020 KB
- Stars: 87
- Watchers: 1
- Forks: 11
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
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'
```