GithubHelp home page GithubHelp logo

virajpsimformsolutions / app-icon Goto Github PK

View Code? Open in Web Editor NEW

This project forked from candlefinance/app-icon

0.0 0.0 0.0 592 KB

Update your apps icon with React Native using Apple's alternate icons API.

Home Page: https://candle.fi

License: MIT License

JavaScript 6.89% Ruby 13.91% C 0.39% Objective-C 10.56% Java 27.72% Kotlin 8.36% TypeScript 21.91% Objective-C++ 4.29% Swift 5.96%

app-icon's Introduction

npm version

twitter-icon-change.mp4

Update your apps icon on iOS using Apples alternate icons API.

Installation

yarn add @candlefinance/app-icon

Features

  • Supports the new React Native architecture
  • Simple async API
  • TypeScript support
  • Mostly written in Swift

Prerequisites

To add alternative icons to your iOS & Android app you need to:

iOS

  1. Add the icons to your Xcode project, simply create a new folder and add your icons in at 2x (120 x 120) and 3x (180 x 180) sizes. See the example app for reference.

  2. Update your Info.plist to include the names of your icons. See the example app for reference or add the following to your Info.plist:

<key>CFBundleIcons</key>
<dict>
    <key>CFBundlePrimaryIcon</key>
    <dict>
        <key>CFBundleIconFiles</key>
        <array>
            <string>Icon-1</string> <!-- Default icon -->
        </array>
        <key>UIPrerenderedIcon</key>
        <false/>
    </dict>
    <key>CFBundleAlternateIcons</key>
    <dict>
        <key>AppIcon-2</key> <!-- Alternate icon name that you can set when calling the API below -->
        <dict>
            <key>CFBundleIconFiles</key>
            <array>
                <string>Icon-2</string> <!-- Alternate icon name must match the icon file name from first step -->
            </array>
            <key>UIPrerenderedIcon</key>
            <false/>
        </dict>
    </dict>
</dict>

For more info check out the this tutorial by Paul Hudson.

Android

  1. Add the icons to your Android project
  2. Create activity-alias, see the example app for reference or add the following to your AndroidManifest.xml.

Usage

Check out the example app for a full working example.

import { getIconName, setIconName } from '@candlefinance/app-icon';

const [icon, setIcon] = React.useState('default');

// Get icon name
getIconName()
  .then((name) => {
    setIcon(name);
  })
  .catch(console.error);

// Set icon name or no argument to reset to default
setIconName('AppIcon-2')
  .then((name) => {
    setIcon(name);
  })
  .catch(console.error);

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

app-icon's People

Contributors

gtokman avatar nikwotton avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.