Programmatically change the app icon in Expo.
npm install expo-dynamic-app-iconProgrammatically change the app icon in Expo.
```
npx expo install expo-dynamic-app-icon
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
}
}
]
]
``
expo prebuild
check added line
AndroidManifest.xml
`xml`
...
...
create a new expo-dev-client and begin using expo-dynamic-app-icon
- 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'
`
get current app icon name
- default return is DEFAULT
`typescript
import { getAppIcon } from "expo-dynamic-app-icon";
...
getAppIcon() // get current icon name 'red'
``