-
-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
46 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,30 @@ | ||
|
||
# react-native-change-icon | ||
# React Native Change Icon | ||
|
||
Change Application Icon Programmatically. | ||
- [x] iOS | ||
- [ ] Android | ||
|
||
## Getting started | ||
|
||
`$ npm install react-native-change-icon --save` | ||
`$ yarn add install react-native-change-icon` | ||
|
||
### Mostly automatic installation | ||
### Mostly automatic installation (Recommended) | ||
|
||
`$ react-native link react-native-change-icon` | ||
|
||
### Manual installation | ||
|
||
|
||
#### iOS | ||
|
||
1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]` | ||
2. Go to `node_modules` ➜ `react-native-change-icon` and add `RNChangeIcon.xcodeproj` | ||
3. In XCode, in the project navigator, select your project. Add `libRNChangeIcon.a` to your project's `Build Phases` ➜ `Link Binary With Libraries` | ||
4. Run your project (`Cmd+R`)< | ||
|
||
#### Android | ||
#### Android (Currently Not Functional) | ||
|
||
1. Open up `android/app/src/main/java/[...]/MainActivity.java` | ||
1. Open up `android/app/src/main/java/[...]/MainApplication.java` | ||
- Add `import com.reactlibrary.RNChangeIconPackage;` to the imports at the top of the file | ||
- Add `new RNChangeIconPackage()` to the list returned by the `getPackages()` method | ||
2. Append the following lines to `android/settings.gradle`: | ||
|
@@ -34,20 +37,32 @@ | |
compile project(':react-native-change-icon') | ||
``` | ||
|
||
#### Windows | ||
[Read it! :D](https://github.com/ReactWindows/react-native) | ||
## Usage | ||
|
||
1. In Visual Studio add the `RNChangeIcon.sln` in `node_modules/react-native-change-icon/windows/RNChangeIcon.sln` folder to their solution, reference from their app. | ||
2. Open up your `MainPage.cs` app | ||
- Add `using Change.Icon.RNChangeIcon;` to the usings at the top of the file | ||
- Add `new RNChangeIconPackage()` to the `List<IReactPackage>` returned by the `Packages` method | ||
#### iOS | ||
|
||
1. Open your project in Xcode and create an **App Icons** group inside you app's group. | ||
2. Add all the app icons you need inside this group with names like *[email protected]*, *[email protected]*. | ||
3. Your directory structure in Xcode would look like: | ||
|
||
![Xcode Directory](images/App_Icons.png) | ||
|
||
4. Open the **Info.plist** file. | ||
5. Add *Icon files (iOS 5)* to the *Information Property List*. | ||
6. Add *CFBundleAlternateIcons* as a dictionary to the *Icon files (iOS 5)*, it is used for alternative icons. | ||
7. Add dictionaries under *CFBundleAlternateIcons* named as your icon names in **App Icons** group. | ||
8. For each dictionary, two properties, *UIPrerenderedIcon* and *CFBundleIconFiles* need to be configured. | ||
9. Set the type of *UIPrerenderedIcon* to *String* and its value to *NO*. | ||
10. Set the type of *CFBundleIconFiles* to *Array* and set its first key, *Item 0*'s type to *String* and its value to the corresponding icon names. | ||
11. After all these steps, your **Info.plist** file should look like: | ||
|
||
![Info.plist](images/Info.plist.png) | ||
|
||
Now you can use the following code to change application icon: | ||
|
||
## Usage | ||
```javascript | ||
import RNChangeIcon from 'react-native-change-icon'; | ||
import { changeIcon } from 'react-native-change-icon'; | ||
|
||
// TODO: What to do with the module? | ||
RNChangeIcon; | ||
// Pass the name of icon as string to the "changeIcon" function | ||
changeIcon('icon_name'); | ||
``` | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
android/src/main/java/com/reactlibrary/RNChangeIconModule.java
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
android/src/main/java/com/reactlibrary/RNChangeIconPackage.java
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,16 +2,26 @@ | |
{ | ||
"name": "react-native-change-icon", | ||
"version": "1.0.0", | ||
"description": "", | ||
"description": "React Native Change Application Icon Programmatically.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [ | ||
"react-native" | ||
"react-native", | ||
"icon", | ||
"change", | ||
"programmatically", | ||
"dynamic" | ||
], | ||
"author": "", | ||
"license": "", | ||
"author": "Surya Kant Bansal <[email protected]>", | ||
"homepage": "https://github.com/skb1129/react-native-change-icon", | ||
"nativePackage": true, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/skb1129/react-native-change-icon.git" | ||
}, | ||
"license": "MIT", | ||
"peerDependencies": { | ||
"react-native": ">=0.55.4" | ||
} | ||
|