npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

expo-alternate-app-icons

v1.1.0

Published

Provides functions that let you change the app icon

Downloads

904

Readme

Expo Alternate App Icons

Expo Alternate App Icons is a library that allows you to easily switch between different app icons in your Expo project.

Platform Compatibility

| Android Device | Android Emulator | iOS Device | iOS Simulator | Web | | -------------- | ---------------- | ---------- | ------------- | --- | | ✅ | ✅ | ✅ | ✅ | ❌ |

Introduction

Customizing app icons can be a valuable way to provide users with a personalized experience for your app. This library simplifies the process of implementing alternate app icons in your Expo project.

Demo

Installation

To get started, install the library using Expo CLI:

npx expo install expo-alternate-app-icons

Ensure your project is running Expo SDK 51+.

How To Use

This package contains an Expo Plugin that copies your alternative icons to native projects.

  1. Add expo-alternate-app-icons to the plugins array inside your app.json.
  2. The second item in the array accepts an array with details about your alternate icons.
  3. Prebuild a project using npx expo prebuild --clean to apply the plugin changes.
// app.json
{
  // ...
  "plugins": [
    // ...
    [
      "expo-alternate-app-icons",
      [
        {
          "name": "IconA", // The name of the alternate icon
          "ios": "./assets/icon-a.png", // Path to the iOS app icon
          "android": {
            "foregroundImage": "./assets/icon-a-foreground.png", // Path to Android foreground image
            "backgroundColor": "#001413" // Background color for Android adaptive icon
          }
        },
        {
          "name": "IconB",
          "ios": "./assets/icon-b.png",
          "android": {
            "foregroundImage": "./assets/icon-b-foreground.png",
            "backgroundColor": "#001413"
          }
        },
        {
          "name": "IconC",
          "ios": "./assets/icon-c.png",
          "android": {
            "foregroundImage": "./assets/icon-c-foreground.png",
            "backgroundColor": "#001413"
          }
        }
      ]
    ]
  ]
}

Icons

Your icons should follow the same format as your default app icon.

  • Use a .png file
  • Square format with resolution 1024x1024 px
  • iOS
    • Without transparency layer
  • Android - Adaptive icon
    • Foreground image
    • Background fill color

API Documentation

Supports Alternate Icons

A boolean value indicating whether the current device supports alternate app icons.

const supportsAlternateIcons: boolean;

Set Alternate App Icon

To set app icon to IconA, use setAlternateAppIcon("IconA"). This function takes icon name as argument.

To reset the app icon to the default pass null like setAlternateAppIcon(null).

function setAlternateAppIcon(name: string | null): Promise<string | null>;

Get App Icon Name

Retrieves the name of the currently active app icon.

function getAppIconName(): string | null;

Reset App Icon

Reset app icon to the default one.

This is just a shortcut for setAlternateAppIcon(null).

function resetAppIcon(): Promise<void>;

Development

Expo Config Plugin

npm run build plugin # Start build on save
cd example && npx expo prebuild # Execute the config plugin