feat: dynamic app icon

This commit is contained in:
Adrian Castro
2024-03-19 10:24:19 +01:00
parent 202e1484f5
commit f1032f8033
5 changed files with 48 additions and 0 deletions

View File

@@ -58,6 +58,31 @@ const defineConfig = (): ExpoConfig => ({
}, },
}, },
], ],
[
"expo-dynamic-app-icon",
{
main: {
image: "./assets/images/main.png",
prerendered: true,
},
blue: {
image: "./assets/images/blue.png",
prerendered: true,
},
gray: {
image: "./assets/images/gray.png",
prerendered: true,
},
red: {
image: "./assets/images/red.png",
prerendered: true,
},
teal: {
image: "./assets/images/teal.png",
prerendered: true,
},
},
],
], ],
}); });

View File

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

@@ -35,6 +35,7 @@
"expo-brightness": "~11.8.0", "expo-brightness": "~11.8.0",
"expo-build-properties": "~0.11.1", "expo-build-properties": "~0.11.1",
"expo-constants": "~15.4.5", "expo-constants": "~15.4.5",
"expo-dynamic-app-icon": "github:simonsturge/expo-dynamic-app-icon",
"expo-haptics": "~12.8.1", "expo-haptics": "~12.8.1",
"expo-linear-gradient": "^12.7.2", "expo-linear-gradient": "^12.7.2",
"expo-linking": "~6.2.2", "expo-linking": "~6.2.2",

View File

@@ -1,3 +1,4 @@
import { setAppIcon } from "expo-dynamic-app-icon";
import { create } from "zustand"; import { create } from "zustand";
import { immer } from "zustand/middleware/immer"; import { immer } from "zustand/middleware/immer";
@@ -14,6 +15,7 @@ export const useThemeStore = create(
setTheme(v) { setTheme(v) {
set((s) => { set((s) => {
s.theme = v; s.theme = v;
setAppIcon(v);
}); });
}, },
})), })),

20
pnpm-lock.yaml generated
View File

@@ -77,6 +77,9 @@ importers:
expo-constants: expo-constants:
specifier: ~15.4.5 specifier: ~15.4.5
version: 15.4.5(expo@50.0.13) version: 15.4.5(expo@50.0.13)
expo-dynamic-app-icon:
specifier: github:simonsturge/expo-dynamic-app-icon
version: github.com/simonsturge/expo-dynamic-app-icon/acfd73827573e99a5e1bfbe47cf2fb1656e9ccf0(expo@50.0.13)(react-native@0.73.5)(react@18.2.0)
expo-haptics: expo-haptics:
specifier: ~12.8.1 specifier: ~12.8.1
version: 12.8.1(expo@50.0.13) version: 12.8.1(expo@50.0.13)
@@ -13494,3 +13497,20 @@ packages:
react: 18.2.0 react: 18.2.0
use-sync-external-store: 1.2.0(react@18.2.0) use-sync-external-store: 1.2.0(react@18.2.0)
dev: false dev: false
github.com/simonsturge/expo-dynamic-app-icon/acfd73827573e99a5e1bfbe47cf2fb1656e9ccf0(expo@50.0.13)(react-native@0.73.5)(react@18.2.0):
resolution: {tarball: https://codeload.github.com/simonsturge/expo-dynamic-app-icon/tar.gz/acfd73827573e99a5e1bfbe47cf2fb1656e9ccf0}
id: github.com/simonsturge/expo-dynamic-app-icon/acfd73827573e99a5e1bfbe47cf2fb1656e9ccf0
name: expo-dynamic-app-icon
version: 1.2.0
prepare: true
requiresBuild: true
peerDependencies:
expo: '>=49'
react: '*'
react-native: '*'
dependencies:
expo: 50.0.13(@babel/core@7.23.9)(@react-native/babel-preset@0.73.21)
react: 18.2.0
react-native: 0.73.5(@babel/core@7.23.9)(@babel/preset-env@7.23.9)(react@18.2.0)
dev: false