正在显示
21 个修改的文件
包含
1007 行增加
和
0 行删除
.gitattributes
0 → 100644
| 1 | +*.pbxproj -text |
.gitignore
0 → 100644
| 1 | +# OSX | ||
| 2 | +# | ||
| 3 | +.DS_Store | ||
| 4 | + | ||
| 5 | +# node.js | ||
| 6 | +# | ||
| 7 | +node_modules/ | ||
| 8 | +npm-debug.log | ||
| 9 | +yarn-error.log | ||
| 10 | + | ||
| 11 | +# Xcode | ||
| 12 | +# | ||
| 13 | +build/ | ||
| 14 | +*.pbxuser | ||
| 15 | +!default.pbxuser | ||
| 16 | +*.mode1v3 | ||
| 17 | +!default.mode1v3 | ||
| 18 | +*.mode2v3 | ||
| 19 | +!default.mode2v3 | ||
| 20 | +*.perspectivev3 | ||
| 21 | +!default.perspectivev3 | ||
| 22 | +xcuserdata | ||
| 23 | +*.xccheckout | ||
| 24 | +*.moved-aside | ||
| 25 | +DerivedData | ||
| 26 | +*.hmap | ||
| 27 | +*.ipa | ||
| 28 | +*.xcuserstate | ||
| 29 | +project.xcworkspace | ||
| 30 | + | ||
| 31 | +# Android/IntelliJ | ||
| 32 | +# | ||
| 33 | +build/ | ||
| 34 | +.idea | ||
| 35 | +.gradle | ||
| 36 | +local.properties | ||
| 37 | +*.iml | ||
| 38 | + | ||
| 39 | +# BUCK | ||
| 40 | +buck-out/ | ||
| 41 | +\.buckd/ | ||
| 42 | +*.keystore |
.npmignore
0 → 100644
LICENSE
0 → 100644
| 1 | +MIT License | ||
| 2 | + | ||
| 3 | +Copyright (c) 2019 YJY | ||
| 4 | + | ||
| 5 | +Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| 6 | +of this software and associated documentation files (the "Software"), to deal | ||
| 7 | +in the Software without restriction, including without limitation the rights | ||
| 8 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| 9 | +copies of the Software, and to permit persons to whom the Software is | ||
| 10 | +furnished to do so, subject to the following conditions: | ||
| 11 | + | ||
| 12 | +The above copyright notice and this permission notice shall be included in all | ||
| 13 | +copies or substantial portions of the Software. | ||
| 14 | + | ||
| 15 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 16 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 17 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| 18 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 19 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 20 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| 21 | +SOFTWARE. |
README.md
0 → 100644
| 1 | +# react-native-custom-icon | ||
| 2 | + | ||
| 3 | +## Getting started | ||
| 4 | + | ||
| 5 | +`$ npm install https://github.com/jinyaoye23/react-native-custom-icon.git --save` | ||
| 6 | + | ||
| 7 | +### Mostly automatic installation | ||
| 8 | + | ||
| 9 | +`$ react-native link react-native-custom-icon` | ||
| 10 | + | ||
| 11 | +### Manual installation | ||
| 12 | + | ||
| 13 | + | ||
| 14 | +#### iOS | ||
| 15 | + | ||
| 16 | +1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]` | ||
| 17 | +2. Go to `node_modules` ➜ `react-native-custom-icon` and add `CustomIcon.xcodeproj` | ||
| 18 | +3. In XCode, in the project navigator, select your project. Add `libCustomIcon.a` to your project's `Build Phases` ➜ `Link Binary With Libraries` | ||
| 19 | +4. Run your project (`Cmd+R`)< | ||
| 20 | + | ||
| 21 | +#### iOS 更换图标配置[请参考](https://juejin.im/post/59395f9761ff4b006c6c204e) | ||
| 22 | +##### 1.配置图标 | ||
| 23 | + | ||
| 24 | +动态修改的icon不能放在 Assets.xcassets 里, 需要创建文件如AppIcons, 文件夹里存放需要动态更换的app图标 | ||
| 25 | + | ||
| 26 | + | ||
| 27 | + | ||
| 28 | +如果每一套图标有多个尺寸,需要统一名称前缀后面添加尺寸如前缀为 icon, 尺寸为20x20, 则名称为icon20x20@2x.png 和 icon20x20@3x.png,一种尺寸的图标包含2倍图和3倍图 | ||
| 29 | + | ||
| 30 | + | ||
| 31 | + | ||
| 32 | + | ||
| 33 | +##### 2.info.plist配置 | ||
| 34 | + | ||
| 35 | +在info.plist中右键 -> Add Row : | ||
| 36 | +输入Icon... 会有提示,选择Icon files(iOS 5) | ||
| 37 | + | ||
| 38 | + | ||
| 39 | + | ||
| 40 | +``` | ||
| 41 | +这里的Icon files(iOS 5)是个字典,其中可包含的Key值有CFBundlePrimaryIcon -> Primary Icon | ||
| 42 | +CFBundleAlternateIcons ->这个是我们添加更换图片的字段,为Dictionary, 如果没有这个字段可以添加 | ||
| 43 | +UINewsstandIcon -> Newsstand Icon 暂时用不到可以删除 | ||
| 44 | + | ||
| 45 | +``` | ||
| 46 | +在 Icon files(iOS 5)内添加一个Key: CFBundleAlternateIcons ,类型为字典,在这个字典里配置我们所有需要动态修改的icon:键为icon的名称,值为一个字典(这个字典里包含两个键:CFBundleIconFiles,其值类型为Array,内容为icon的名称;UIPrerenderedIcon,其值类型为bool,内容为NO,也可以不加此key) | ||
| 47 | + | ||
| 48 | + | ||
| 49 | + | ||
| 50 | +如果是添加了多个尺寸icon,也要在这里分别配置,以上面添加的sunshine图标为例: | ||
| 51 | + | ||
| 52 | + | ||
| 53 | + | ||
| 54 | +使用的时候还是使用sunshine进行赋值即可! | ||
| 55 | + | ||
| 56 | + | ||
| 57 | +#### Android | ||
| 58 | + | ||
| 59 | +1. Open up `android/app/src/main/java/[...]/MainApplication.java` | ||
| 60 | + - Add `import com.reactlibrary.CustomIconPackage;` to the imports at the top of the file | ||
| 61 | + - Add `new CustomIconPackage()` to the list returned by the `getPackages()` method | ||
| 62 | +2. Append the following lines to `android/settings.gradle`: | ||
| 63 | + ``` | ||
| 64 | + include ':react-native-custom-icon' | ||
| 65 | + project(':react-native-custom-icon').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-custom-icon/android') | ||
| 66 | + ``` | ||
| 67 | +3. Insert the following lines inside the dependencies block in `android/app/build.gradle`: | ||
| 68 | + ``` | ||
| 69 | + compile project(':react-native-custom-icon') | ||
| 70 | + ``` | ||
| 71 | + | ||
| 72 | + | ||
| 73 | +## Usage | ||
| 74 | +```javascript | ||
| 75 | +import CustomIcon from 'react-native-custom-icon'; | ||
| 76 | + | ||
| 77 | +CustomIcon.changeIcon(iconName); // iconName 为图标名称,如上面sunshine为例, iconName就是sunshine | ||
| 78 | +``` |
android/README.md
0 → 100644
| 1 | +README | ||
| 2 | +====== | ||
| 3 | + | ||
| 4 | +If you want to publish the lib as a maven dependency, follow these steps before publishing a new version to npm: | ||
| 5 | + | ||
| 6 | +1. Be sure to have the Android [SDK](https://developer.android.com/studio/index.html) and [NDK](https://developer.android.com/ndk/guides/index.html) installed | ||
| 7 | +2. Be sure to have a `local.properties` file in this folder that points to the Android SDK and NDK | ||
| 8 | +``` | ||
| 9 | +ndk.dir=/Users/{username}/Library/Android/sdk/ndk-bundle | ||
| 10 | +sdk.dir=/Users/{username}/Library/Android/sdk | ||
| 11 | +``` | ||
| 12 | +3. Delete the `maven` folder | ||
| 13 | +4. Run `sudo ./gradlew installArchives` | ||
| 14 | +5. Verify that latest set of generated files is in the maven folder with the correct version number |
android/build.gradle
0 → 100644
| 1 | +buildscript { | ||
| 2 | + ext.safeExtGet = {prop, fallback -> | ||
| 3 | + rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback | ||
| 4 | + } | ||
| 5 | + repositories { | ||
| 6 | + google() | ||
| 7 | + jcenter() | ||
| 8 | + } | ||
| 9 | + | ||
| 10 | + dependencies { | ||
| 11 | + // Matches recent template from React Native (0.60) | ||
| 12 | + // https://github.com/facebook/react-native/blob/0.60-stable/template/android/build.gradle#L16 | ||
| 13 | + classpath("com.android.tools.build:gradle:${safeExtGet('gradlePluginVersion', '3.4.1')}") | ||
| 14 | + } | ||
| 15 | +} | ||
| 16 | + | ||
| 17 | +apply plugin: 'com.android.library' | ||
| 18 | +apply plugin: 'maven' | ||
| 19 | + | ||
| 20 | +// Matches values in recent template from React Native 0.59 / 0.60 | ||
| 21 | +// https://github.com/facebook/react-native/blob/0.59-stable/template/android/build.gradle#L5-L9 | ||
| 22 | +// https://github.com/facebook/react-native/blob/0.60-stable/template/android/build.gradle#L5-L9 | ||
| 23 | +def DEFAULT_COMPILE_SDK_VERSION = 28 | ||
| 24 | +def DEFAULT_BUILD_TOOLS_VERSION = "28.0.3" | ||
| 25 | +def DEFAULT_MIN_SDK_VERSION = 16 | ||
| 26 | +def DEFAULT_TARGET_SDK_VERSION = 28 | ||
| 27 | + | ||
| 28 | +android { | ||
| 29 | + compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION) | ||
| 30 | + buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION) | ||
| 31 | + | ||
| 32 | + defaultConfig { | ||
| 33 | + minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION) | ||
| 34 | + targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION) | ||
| 35 | + versionCode 1 | ||
| 36 | + versionName "1.0" | ||
| 37 | + } | ||
| 38 | + lintOptions { | ||
| 39 | + abortOnError false | ||
| 40 | + } | ||
| 41 | +} | ||
| 42 | + | ||
| 43 | +repositories { | ||
| 44 | + maven { | ||
| 45 | + // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm | ||
| 46 | + // Matches recent template from React Native 0.59 / 0.60 | ||
| 47 | + // https://github.com/facebook/react-native/blob/0.59-stable/template/android/build.gradle#L30 | ||
| 48 | + // https://github.com/facebook/react-native/blob/0.60-stable/template/android/build.gradle#L28 | ||
| 49 | + url "$projectDir/../node_modules/react-native/android" | ||
| 50 | + } | ||
| 51 | + mavenCentral() | ||
| 52 | +} | ||
| 53 | + | ||
| 54 | +dependencies { | ||
| 55 | + implementation "com.facebook.react:react-native:${safeExtGet('reactnativeVersion', '+')}" | ||
| 56 | +} | ||
| 57 | + | ||
| 58 | +def configureReactNativePom(def pom) { | ||
| 59 | + def packageJson = new groovy.json.JsonSlurper().parseText(file('../package.json').text) | ||
| 60 | + | ||
| 61 | + pom.project { | ||
| 62 | + name packageJson.title | ||
| 63 | + artifactId packageJson.name | ||
| 64 | + version = packageJson.version | ||
| 65 | + group = "com.reactlibrary" | ||
| 66 | + description packageJson.description | ||
| 67 | + url packageJson.repository.baseUrl | ||
| 68 | + | ||
| 69 | + licenses { | ||
| 70 | + license { | ||
| 71 | + name packageJson.license | ||
| 72 | + url packageJson.repository.baseUrl + '/blob/master/' + packageJson.licenseFilename | ||
| 73 | + distribution 'repo' | ||
| 74 | + } | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + developers { | ||
| 78 | + developer { | ||
| 79 | + id packageJson.author.username | ||
| 80 | + name packageJson.author.name | ||
| 81 | + } | ||
| 82 | + } | ||
| 83 | + } | ||
| 84 | +} | ||
| 85 | + | ||
| 86 | +afterEvaluate { project -> | ||
| 87 | + | ||
| 88 | + task androidJavadoc(type: Javadoc) { | ||
| 89 | + source = android.sourceSets.main.java.srcDirs | ||
| 90 | + classpath += files(android.bootClasspath) | ||
| 91 | + classpath += files(project.getConfigurations().getByName('compile').asList()) | ||
| 92 | + include '**/*.java' | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) { | ||
| 96 | + classifier = 'javadoc' | ||
| 97 | + from androidJavadoc.destinationDir | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + task androidSourcesJar(type: Jar) { | ||
| 101 | + classifier = 'sources' | ||
| 102 | + from android.sourceSets.main.java.srcDirs | ||
| 103 | + include '**/*.java' | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + android.libraryVariants.all { variant -> | ||
| 107 | + def name = variant.name.capitalize() | ||
| 108 | + task "jar${name}"(type: Jar, dependsOn: variant.javaCompile) { | ||
| 109 | + from variant.javaCompile.destinationDir | ||
| 110 | + } | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + artifacts { | ||
| 114 | + archives androidSourcesJar | ||
| 115 | + archives androidJavadocJar | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + task installArchives(type: Upload) { | ||
| 119 | + configuration = configurations.archives | ||
| 120 | + repositories.mavenDeployer { | ||
| 121 | + // Deploy to react-native-event-bridge/maven, ready to publish to npm | ||
| 122 | + repository url: "file://${projectDir}/../android/maven" | ||
| 123 | + | ||
| 124 | + configureReactNativePom pom | ||
| 125 | + } | ||
| 126 | + } | ||
| 127 | +} |
android/gradle/wrapper/gradle-wrapper.jar
0 → 100644
不能预览此文件类型
android/gradlew
0 → 100644
| 1 | +#!/usr/bin/env sh | ||
| 2 | + | ||
| 3 | +############################################################################## | ||
| 4 | +## | ||
| 5 | +## Gradle start up script for UN*X | ||
| 6 | +## | ||
| 7 | +############################################################################## | ||
| 8 | + | ||
| 9 | +# Attempt to set APP_HOME | ||
| 10 | +# Resolve links: $0 may be a link | ||
| 11 | +PRG="$0" | ||
| 12 | +# Need this for relative symlinks. | ||
| 13 | +while [ -h "$PRG" ] ; do | ||
| 14 | + ls=`ls -ld "$PRG"` | ||
| 15 | + link=`expr "$ls" : '.*-> \(.*\)$'` | ||
| 16 | + if expr "$link" : '/.*' > /dev/null; then | ||
| 17 | + PRG="$link" | ||
| 18 | + else | ||
| 19 | + PRG=`dirname "$PRG"`"/$link" | ||
| 20 | + fi | ||
| 21 | +done | ||
| 22 | +SAVED="`pwd`" | ||
| 23 | +cd "`dirname \"$PRG\"`/" >/dev/null | ||
| 24 | +APP_HOME="`pwd -P`" | ||
| 25 | +cd "$SAVED" >/dev/null | ||
| 26 | + | ||
| 27 | +APP_NAME="Gradle" | ||
| 28 | +APP_BASE_NAME=`basename "$0"` | ||
| 29 | + | ||
| 30 | +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | ||
| 31 | +DEFAULT_JVM_OPTS="" | ||
| 32 | + | ||
| 33 | +# Use the maximum available, or set MAX_FD != -1 to use that value. | ||
| 34 | +MAX_FD="maximum" | ||
| 35 | + | ||
| 36 | +warn () { | ||
| 37 | + echo "$*" | ||
| 38 | +} | ||
| 39 | + | ||
| 40 | +die () { | ||
| 41 | + echo | ||
| 42 | + echo "$*" | ||
| 43 | + echo | ||
| 44 | + exit 1 | ||
| 45 | +} | ||
| 46 | + | ||
| 47 | +# OS specific support (must be 'true' or 'false'). | ||
| 48 | +cygwin=false | ||
| 49 | +msys=false | ||
| 50 | +darwin=false | ||
| 51 | +nonstop=false | ||
| 52 | +case "`uname`" in | ||
| 53 | + CYGWIN* ) | ||
| 54 | + cygwin=true | ||
| 55 | + ;; | ||
| 56 | + Darwin* ) | ||
| 57 | + darwin=true | ||
| 58 | + ;; | ||
| 59 | + MINGW* ) | ||
| 60 | + msys=true | ||
| 61 | + ;; | ||
| 62 | + NONSTOP* ) | ||
| 63 | + nonstop=true | ||
| 64 | + ;; | ||
| 65 | +esac | ||
| 66 | + | ||
| 67 | +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar | ||
| 68 | + | ||
| 69 | +# Determine the Java command to use to start the JVM. | ||
| 70 | +if [ -n "$JAVA_HOME" ] ; then | ||
| 71 | + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then | ||
| 72 | + # IBM's JDK on AIX uses strange locations for the executables | ||
| 73 | + JAVACMD="$JAVA_HOME/jre/sh/java" | ||
| 74 | + else | ||
| 75 | + JAVACMD="$JAVA_HOME/bin/java" | ||
| 76 | + fi | ||
| 77 | + if [ ! -x "$JAVACMD" ] ; then | ||
| 78 | + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME | ||
| 79 | + | ||
| 80 | +Please set the JAVA_HOME variable in your environment to match the | ||
| 81 | +location of your Java installation." | ||
| 82 | + fi | ||
| 83 | +else | ||
| 84 | + JAVACMD="java" | ||
| 85 | + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. | ||
| 86 | + | ||
| 87 | +Please set the JAVA_HOME variable in your environment to match the | ||
| 88 | +location of your Java installation." | ||
| 89 | +fi | ||
| 90 | + | ||
| 91 | +# Increase the maximum file descriptors if we can. | ||
| 92 | +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then | ||
| 93 | + MAX_FD_LIMIT=`ulimit -H -n` | ||
| 94 | + if [ $? -eq 0 ] ; then | ||
| 95 | + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then | ||
| 96 | + MAX_FD="$MAX_FD_LIMIT" | ||
| 97 | + fi | ||
| 98 | + ulimit -n $MAX_FD | ||
| 99 | + if [ $? -ne 0 ] ; then | ||
| 100 | + warn "Could not set maximum file descriptor limit: $MAX_FD" | ||
| 101 | + fi | ||
| 102 | + else | ||
| 103 | + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" | ||
| 104 | + fi | ||
| 105 | +fi | ||
| 106 | + | ||
| 107 | +# For Darwin, add options to specify how the application appears in the dock | ||
| 108 | +if $darwin; then | ||
| 109 | + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" | ||
| 110 | +fi | ||
| 111 | + | ||
| 112 | +# For Cygwin, switch paths to Windows format before running java | ||
| 113 | +if $cygwin ; then | ||
| 114 | + APP_HOME=`cygpath --path --mixed "$APP_HOME"` | ||
| 115 | + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` | ||
| 116 | + JAVACMD=`cygpath --unix "$JAVACMD"` | ||
| 117 | + | ||
| 118 | + # We build the pattern for arguments to be converted via cygpath | ||
| 119 | + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` | ||
| 120 | + SEP="" | ||
| 121 | + for dir in $ROOTDIRSRAW ; do | ||
| 122 | + ROOTDIRS="$ROOTDIRS$SEP$dir" | ||
| 123 | + SEP="|" | ||
| 124 | + done | ||
| 125 | + OURCYGPATTERN="(^($ROOTDIRS))" | ||
| 126 | + # Add a user-defined pattern to the cygpath arguments | ||
| 127 | + if [ "$GRADLE_CYGPATTERN" != "" ] ; then | ||
| 128 | + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" | ||
| 129 | + fi | ||
| 130 | + # Now convert the arguments - kludge to limit ourselves to /bin/sh | ||
| 131 | + i=0 | ||
| 132 | + for arg in "$@" ; do | ||
| 133 | + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` | ||
| 134 | + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option | ||
| 135 | + | ||
| 136 | + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition | ||
| 137 | + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` | ||
| 138 | + else | ||
| 139 | + eval `echo args$i`="\"$arg\"" | ||
| 140 | + fi | ||
| 141 | + i=$((i+1)) | ||
| 142 | + done | ||
| 143 | + case $i in | ||
| 144 | + (0) set -- ;; | ||
| 145 | + (1) set -- "$args0" ;; | ||
| 146 | + (2) set -- "$args0" "$args1" ;; | ||
| 147 | + (3) set -- "$args0" "$args1" "$args2" ;; | ||
| 148 | + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; | ||
| 149 | + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; | ||
| 150 | + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; | ||
| 151 | + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; | ||
| 152 | + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; | ||
| 153 | + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; | ||
| 154 | + esac | ||
| 155 | +fi | ||
| 156 | + | ||
| 157 | +# Escape application args | ||
| 158 | +save () { | ||
| 159 | + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done | ||
| 160 | + echo " " | ||
| 161 | +} | ||
| 162 | +APP_ARGS=$(save "$@") | ||
| 163 | + | ||
| 164 | +# Collect all arguments for the java command, following the shell quoting and substitution rules | ||
| 165 | +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" | ||
| 166 | + | ||
| 167 | +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong | ||
| 168 | +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then | ||
| 169 | + cd "$(dirname "$0")" | ||
| 170 | +fi | ||
| 171 | + | ||
| 172 | +exec "$JAVACMD" "$@" |
android/gradlew.bat
0 → 100644
| 1 | +@if "%DEBUG%" == "" @echo off | ||
| 2 | +@rem ########################################################################## | ||
| 3 | +@rem | ||
| 4 | +@rem Gradle startup script for Windows | ||
| 5 | +@rem | ||
| 6 | +@rem ########################################################################## | ||
| 7 | + | ||
| 8 | +@rem Set local scope for the variables with windows NT shell | ||
| 9 | +if "%OS%"=="Windows_NT" setlocal | ||
| 10 | + | ||
| 11 | +set DIRNAME=%~dp0 | ||
| 12 | +if "%DIRNAME%" == "" set DIRNAME=. | ||
| 13 | +set APP_BASE_NAME=%~n0 | ||
| 14 | +set APP_HOME=%DIRNAME% | ||
| 15 | + | ||
| 16 | +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | ||
| 17 | +set DEFAULT_JVM_OPTS= | ||
| 18 | + | ||
| 19 | +@rem Find java.exe | ||
| 20 | +if defined JAVA_HOME goto findJavaFromJavaHome | ||
| 21 | + | ||
| 22 | +set JAVA_EXE=java.exe | ||
| 23 | +%JAVA_EXE% -version >NUL 2>&1 | ||
| 24 | +if "%ERRORLEVEL%" == "0" goto init | ||
| 25 | + | ||
| 26 | +echo. | ||
| 27 | +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. | ||
| 28 | +echo. | ||
| 29 | +echo Please set the JAVA_HOME variable in your environment to match the | ||
| 30 | +echo location of your Java installation. | ||
| 31 | + | ||
| 32 | +goto fail | ||
| 33 | + | ||
| 34 | +:findJavaFromJavaHome | ||
| 35 | +set JAVA_HOME=%JAVA_HOME:"=% | ||
| 36 | +set JAVA_EXE=%JAVA_HOME%/bin/java.exe | ||
| 37 | + | ||
| 38 | +if exist "%JAVA_EXE%" goto init | ||
| 39 | + | ||
| 40 | +echo. | ||
| 41 | +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% | ||
| 42 | +echo. | ||
| 43 | +echo Please set the JAVA_HOME variable in your environment to match the | ||
| 44 | +echo location of your Java installation. | ||
| 45 | + | ||
| 46 | +goto fail | ||
| 47 | + | ||
| 48 | +:init | ||
| 49 | +@rem Get command-line arguments, handling Windows variants | ||
| 50 | + | ||
| 51 | +if not "%OS%" == "Windows_NT" goto win9xME_args | ||
| 52 | + | ||
| 53 | +:win9xME_args | ||
| 54 | +@rem Slurp the command line arguments. | ||
| 55 | +set CMD_LINE_ARGS= | ||
| 56 | +set _SKIP=2 | ||
| 57 | + | ||
| 58 | +:win9xME_args_slurp | ||
| 59 | +if "x%~1" == "x" goto execute | ||
| 60 | + | ||
| 61 | +set CMD_LINE_ARGS=%* | ||
| 62 | + | ||
| 63 | +:execute | ||
| 64 | +@rem Setup the command line | ||
| 65 | + | ||
| 66 | +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar | ||
| 67 | + | ||
| 68 | +@rem Execute Gradle | ||
| 69 | +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% | ||
| 70 | + | ||
| 71 | +:end | ||
| 72 | +@rem End local scope for the variables with windows NT shell | ||
| 73 | +if "%ERRORLEVEL%"=="0" goto mainEnd | ||
| 74 | + | ||
| 75 | +:fail | ||
| 76 | +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of | ||
| 77 | +rem the _cmd.exe /c_ return code! | ||
| 78 | +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 | ||
| 79 | +exit /b 1 | ||
| 80 | + | ||
| 81 | +:mainEnd | ||
| 82 | +if "%OS%"=="Windows_NT" endlocal | ||
| 83 | + | ||
| 84 | +:omega |
android/src/main/AndroidManifest.xml
0 → 100644
| 1 | +package com.customIcon; | ||
| 2 | + | ||
| 3 | +import com.facebook.react.bridge.ReactApplicationContext; | ||
| 4 | +import com.facebook.react.bridge.ReactContextBaseJavaModule; | ||
| 5 | +import com.facebook.react.bridge.ReactMethod; | ||
| 6 | +import com.facebook.react.bridge.Callback; | ||
| 7 | + | ||
| 8 | +public class CustomIconModule extends ReactContextBaseJavaModule { | ||
| 9 | + | ||
| 10 | + private final ReactApplicationContext reactContext; | ||
| 11 | + | ||
| 12 | + public CustomIconModule(ReactApplicationContext reactContext) { | ||
| 13 | + super(reactContext); | ||
| 14 | + this.reactContext = reactContext; | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + @Override | ||
| 18 | + public String getName() { | ||
| 19 | + return "CustomIcon"; | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + @ReactMethod | ||
| 23 | + public void sampleMethod(String stringArgument, int numberArgument, Callback callback) { | ||
| 24 | + // TODO: Implement some actually useful functionality | ||
| 25 | + callback.invoke("Received numberArgument: " + numberArgument + " stringArgument: " + stringArgument); | ||
| 26 | + } | ||
| 27 | +} |
| 1 | +package com.customIcon; | ||
| 2 | + | ||
| 3 | +import java.util.Arrays; | ||
| 4 | +import java.util.Collections; | ||
| 5 | +import java.util.List; | ||
| 6 | + | ||
| 7 | +import com.facebook.react.ReactPackage; | ||
| 8 | +import com.facebook.react.bridge.NativeModule; | ||
| 9 | +import com.facebook.react.bridge.ReactApplicationContext; | ||
| 10 | +import com.facebook.react.uimanager.ViewManager; | ||
| 11 | + | ||
| 12 | +public class CustomIconPackage implements ReactPackage { | ||
| 13 | + @Override | ||
| 14 | + public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) { | ||
| 15 | + return Arrays.<NativeModule>asList(new CustomIconModule(reactContext)); | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + @Override | ||
| 19 | + public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { | ||
| 20 | + return Collections.emptyList(); | ||
| 21 | + } | ||
| 22 | +} |
index.js
0 → 100644
| 1 | +import { NativeModules } from 'react-native'; | ||
| 2 | + | ||
| 3 | +const CustomIconModule = NativeModules.CustomIcon; | ||
| 4 | + | ||
| 5 | +export default class CustomIcon { | ||
| 6 | + // 更新图标 | ||
| 7 | + static changeIcon(iconName) { | ||
| 8 | + CustomIconModule.changeIcon(iconName); | ||
| 9 | + } | ||
| 10 | + // 恢复默认图标 | ||
| 11 | + static changeDefaultIcon() { | ||
| 12 | + CustomIconModule.changeDefaultIcon(); | ||
| 13 | + } | ||
| 14 | +}; |
ios/CustomIcon.h
0 → 100644
ios/CustomIcon.m
0 → 100644
| 1 | +#import "CustomIcon.h" | ||
| 2 | +#import <UIKit/UIKit.h> | ||
| 3 | + | ||
| 4 | + | ||
| 5 | +@implementation CustomIcon | ||
| 6 | + | ||
| 7 | +RCT_EXPORT_MODULE() | ||
| 8 | + | ||
| 9 | + | ||
| 10 | +RCT_EXPORT_METHOD(changeIcon:(NSString *)iconName) { | ||
| 11 | + UIApplication *app = [UIApplication sharedApplication]; | ||
| 12 | + dispatch_sync(dispatch_get_main_queue(), ^{ | ||
| 13 | + if (![[UIApplication sharedApplication] supportsAlternateIcons]) { | ||
| 14 | + return; | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + }); | ||
| 18 | + | ||
| 19 | + if ([iconName isEqualToString:@""]) { | ||
| 20 | + iconName = nil; | ||
| 21 | + } | ||
| 22 | + dispatch_sync(dispatch_get_main_queue(), ^{ | ||
| 23 | + [[UIApplication sharedApplication] setAlternateIconName:iconName completionHandler:^(NSError * _Nullable error) { | ||
| 24 | + if (error) { | ||
| 25 | + NSLog(@"更换app图标发生错误了 : %@",error); | ||
| 26 | + } | ||
| 27 | + }]; | ||
| 28 | + }); | ||
| 29 | +} | ||
| 30 | + | ||
| 31 | +// 恢复默认图标 | ||
| 32 | +RCT_EXPORT_METHOD(changeDefaultIcon) { | ||
| 33 | + UIApplication *app = [UIApplication sharedApplication]; | ||
| 34 | + dispatch_sync(dispatch_get_main_queue(), ^{ | ||
| 35 | + if (![[UIApplication sharedApplication] supportsAlternateIcons]) { | ||
| 36 | + return; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + }); | ||
| 40 | + | ||
| 41 | + dispatch_sync(dispatch_get_main_queue(), ^{ | ||
| 42 | + [[UIApplication sharedApplication] setAlternateIconName:nil completionHandler:^(NSError * _Nullable error) { | ||
| 43 | + if (error) { | ||
| 44 | + NSLog(@"更换app图标发生错误了 : %@",error); | ||
| 45 | + } | ||
| 46 | + }]; | ||
| 47 | + }); | ||
| 48 | +} | ||
| 49 | + | ||
| 50 | + | ||
| 51 | + | ||
| 52 | + | ||
| 53 | +@end |
ios/CustomIcon.xcodeproj/project.pbxproj
0 → 100644
| 1 | +// !$*UTF8*$! | ||
| 2 | +{ | ||
| 3 | + archiveVersion = 1; | ||
| 4 | + classes = { | ||
| 5 | + }; | ||
| 6 | + objectVersion = 46; | ||
| 7 | + objects = { | ||
| 8 | + | ||
| 9 | +/* Begin PBXBuildFile section */ | ||
| 10 | + B3E7B58A1CC2AC0600A0062D /* CustomIcon.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* CustomIcon.m */; }; | ||
| 11 | +/* End PBXBuildFile section */ | ||
| 12 | + | ||
| 13 | +/* Begin PBXCopyFilesBuildPhase section */ | ||
| 14 | + 58B511D91A9E6C8500147676 /* CopyFiles */ = { | ||
| 15 | + isa = PBXCopyFilesBuildPhase; | ||
| 16 | + buildActionMask = 2147483647; | ||
| 17 | + dstPath = "include/$(PRODUCT_NAME)"; | ||
| 18 | + dstSubfolderSpec = 16; | ||
| 19 | + files = ( | ||
| 20 | + ); | ||
| 21 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 22 | + }; | ||
| 23 | +/* End PBXCopyFilesBuildPhase section */ | ||
| 24 | + | ||
| 25 | +/* Begin PBXFileReference section */ | ||
| 26 | + 134814201AA4EA6300B7C361 /* libCustomIcon.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libCustomIcon.a; sourceTree = BUILT_PRODUCTS_DIR; }; | ||
| 27 | + B3E7B5881CC2AC0600A0062D /* CustomIcon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomIcon.h; sourceTree = "<group>"; }; | ||
| 28 | + B3E7B5891CC2AC0600A0062D /* CustomIcon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CustomIcon.m; sourceTree = "<group>"; }; | ||
| 29 | +/* End PBXFileReference section */ | ||
| 30 | + | ||
| 31 | +/* Begin PBXFrameworksBuildPhase section */ | ||
| 32 | + 58B511D81A9E6C8500147676 /* Frameworks */ = { | ||
| 33 | + isa = PBXFrameworksBuildPhase; | ||
| 34 | + buildActionMask = 2147483647; | ||
| 35 | + files = ( | ||
| 36 | + ); | ||
| 37 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 38 | + }; | ||
| 39 | +/* End PBXFrameworksBuildPhase section */ | ||
| 40 | + | ||
| 41 | +/* Begin PBXGroup section */ | ||
| 42 | + 134814211AA4EA7D00B7C361 /* Products */ = { | ||
| 43 | + isa = PBXGroup; | ||
| 44 | + children = ( | ||
| 45 | + 134814201AA4EA6300B7C361 /* libCustomIcon.a */, | ||
| 46 | + ); | ||
| 47 | + name = Products; | ||
| 48 | + sourceTree = "<group>"; | ||
| 49 | + }; | ||
| 50 | + 58B511D21A9E6C8500147676 = { | ||
| 51 | + isa = PBXGroup; | ||
| 52 | + children = ( | ||
| 53 | + B3E7B5881CC2AC0600A0062D /* CustomIcon.h */, | ||
| 54 | + B3E7B5891CC2AC0600A0062D /* CustomIcon.m */, | ||
| 55 | + 134814211AA4EA7D00B7C361 /* Products */, | ||
| 56 | + ); | ||
| 57 | + sourceTree = "<group>"; | ||
| 58 | + }; | ||
| 59 | +/* End PBXGroup section */ | ||
| 60 | + | ||
| 61 | +/* Begin PBXNativeTarget section */ | ||
| 62 | + 58B511DA1A9E6C8500147676 /* CustomIcon */ = { | ||
| 63 | + isa = PBXNativeTarget; | ||
| 64 | + buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "CustomIcon" */; | ||
| 65 | + buildPhases = ( | ||
| 66 | + 58B511D71A9E6C8500147676 /* Sources */, | ||
| 67 | + 58B511D81A9E6C8500147676 /* Frameworks */, | ||
| 68 | + 58B511D91A9E6C8500147676 /* CopyFiles */, | ||
| 69 | + ); | ||
| 70 | + buildRules = ( | ||
| 71 | + ); | ||
| 72 | + dependencies = ( | ||
| 73 | + ); | ||
| 74 | + name = CustomIcon; | ||
| 75 | + productName = RCTDataManager; | ||
| 76 | + productReference = 134814201AA4EA6300B7C361 /* libCustomIcon.a */; | ||
| 77 | + productType = "com.apple.product-type.library.static"; | ||
| 78 | + }; | ||
| 79 | +/* End PBXNativeTarget section */ | ||
| 80 | + | ||
| 81 | +/* Begin PBXProject section */ | ||
| 82 | + 58B511D31A9E6C8500147676 /* Project object */ = { | ||
| 83 | + isa = PBXProject; | ||
| 84 | + attributes = { | ||
| 85 | + LastUpgradeCheck = 0920; | ||
| 86 | + ORGANIZATIONNAME = Facebook; | ||
| 87 | + TargetAttributes = { | ||
| 88 | + 58B511DA1A9E6C8500147676 = { | ||
| 89 | + CreatedOnToolsVersion = 6.1.1; | ||
| 90 | + }; | ||
| 91 | + }; | ||
| 92 | + }; | ||
| 93 | + buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "CustomIcon" */; | ||
| 94 | + compatibilityVersion = "Xcode 3.2"; | ||
| 95 | + developmentRegion = English; | ||
| 96 | + hasScannedForEncodings = 0; | ||
| 97 | + knownRegions = ( | ||
| 98 | + en, | ||
| 99 | + ); | ||
| 100 | + mainGroup = 58B511D21A9E6C8500147676; | ||
| 101 | + productRefGroup = 58B511D21A9E6C8500147676; | ||
| 102 | + projectDirPath = ""; | ||
| 103 | + projectRoot = ""; | ||
| 104 | + targets = ( | ||
| 105 | + 58B511DA1A9E6C8500147676 /* CustomIcon */, | ||
| 106 | + ); | ||
| 107 | + }; | ||
| 108 | +/* End PBXProject section */ | ||
| 109 | + | ||
| 110 | +/* Begin PBXSourcesBuildPhase section */ | ||
| 111 | + 58B511D71A9E6C8500147676 /* Sources */ = { | ||
| 112 | + isa = PBXSourcesBuildPhase; | ||
| 113 | + buildActionMask = 2147483647; | ||
| 114 | + files = ( | ||
| 115 | + B3E7B58A1CC2AC0600A0062D /* CustomIcon.m in Sources */, | ||
| 116 | + ); | ||
| 117 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 118 | + }; | ||
| 119 | +/* End PBXSourcesBuildPhase section */ | ||
| 120 | + | ||
| 121 | +/* Begin XCBuildConfiguration section */ | ||
| 122 | + 58B511ED1A9E6C8500147676 /* Debug */ = { | ||
| 123 | + isa = XCBuildConfiguration; | ||
| 124 | + buildSettings = { | ||
| 125 | + ALWAYS_SEARCH_USER_PATHS = NO; | ||
| 126 | + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; | ||
| 127 | + CLANG_CXX_LIBRARY = "libc++"; | ||
| 128 | + CLANG_ENABLE_MODULES = YES; | ||
| 129 | + CLANG_ENABLE_OBJC_ARC = YES; | ||
| 130 | + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; | ||
| 131 | + CLANG_WARN_BOOL_CONVERSION = YES; | ||
| 132 | + CLANG_WARN_COMMA = YES; | ||
| 133 | + CLANG_WARN_CONSTANT_CONVERSION = YES; | ||
| 134 | + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | ||
| 135 | + CLANG_WARN_EMPTY_BODY = YES; | ||
| 136 | + CLANG_WARN_ENUM_CONVERSION = YES; | ||
| 137 | + CLANG_WARN_INFINITE_RECURSION = YES; | ||
| 138 | + CLANG_WARN_INT_CONVERSION = YES; | ||
| 139 | + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; | ||
| 140 | + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; | ||
| 141 | + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | ||
| 142 | + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; | ||
| 143 | + CLANG_WARN_STRICT_PROTOTYPES = YES; | ||
| 144 | + CLANG_WARN_SUSPICIOUS_MOVE = YES; | ||
| 145 | + CLANG_WARN_UNREACHABLE_CODE = YES; | ||
| 146 | + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; | ||
| 147 | + COPY_PHASE_STRIP = NO; | ||
| 148 | + ENABLE_STRICT_OBJC_MSGSEND = YES; | ||
| 149 | + ENABLE_TESTABILITY = YES; | ||
| 150 | + GCC_C_LANGUAGE_STANDARD = gnu99; | ||
| 151 | + GCC_DYNAMIC_NO_PIC = NO; | ||
| 152 | + GCC_NO_COMMON_BLOCKS = YES; | ||
| 153 | + GCC_OPTIMIZATION_LEVEL = 0; | ||
| 154 | + GCC_PREPROCESSOR_DEFINITIONS = ( | ||
| 155 | + "DEBUG=1", | ||
| 156 | + "$(inherited)", | ||
| 157 | + ); | ||
| 158 | + GCC_SYMBOLS_PRIVATE_EXTERN = NO; | ||
| 159 | + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | ||
| 160 | + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | ||
| 161 | + GCC_WARN_UNDECLARED_SELECTOR = YES; | ||
| 162 | + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | ||
| 163 | + GCC_WARN_UNUSED_FUNCTION = YES; | ||
| 164 | + GCC_WARN_UNUSED_VARIABLE = YES; | ||
| 165 | + IPHONEOS_DEPLOYMENT_TARGET = 8.0; | ||
| 166 | + MTL_ENABLE_DEBUG_INFO = YES; | ||
| 167 | + ONLY_ACTIVE_ARCH = YES; | ||
| 168 | + SDKROOT = iphoneos; | ||
| 169 | + }; | ||
| 170 | + name = Debug; | ||
| 171 | + }; | ||
| 172 | + 58B511EE1A9E6C8500147676 /* Release */ = { | ||
| 173 | + isa = XCBuildConfiguration; | ||
| 174 | + buildSettings = { | ||
| 175 | + ALWAYS_SEARCH_USER_PATHS = NO; | ||
| 176 | + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; | ||
| 177 | + CLANG_CXX_LIBRARY = "libc++"; | ||
| 178 | + CLANG_ENABLE_MODULES = YES; | ||
| 179 | + CLANG_ENABLE_OBJC_ARC = YES; | ||
| 180 | + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; | ||
| 181 | + CLANG_WARN_BOOL_CONVERSION = YES; | ||
| 182 | + CLANG_WARN_COMMA = YES; | ||
| 183 | + CLANG_WARN_CONSTANT_CONVERSION = YES; | ||
| 184 | + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | ||
| 185 | + CLANG_WARN_EMPTY_BODY = YES; | ||
| 186 | + CLANG_WARN_ENUM_CONVERSION = YES; | ||
| 187 | + CLANG_WARN_INFINITE_RECURSION = YES; | ||
| 188 | + CLANG_WARN_INT_CONVERSION = YES; | ||
| 189 | + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; | ||
| 190 | + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; | ||
| 191 | + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | ||
| 192 | + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; | ||
| 193 | + CLANG_WARN_STRICT_PROTOTYPES = YES; | ||
| 194 | + CLANG_WARN_SUSPICIOUS_MOVE = YES; | ||
| 195 | + CLANG_WARN_UNREACHABLE_CODE = YES; | ||
| 196 | + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; | ||
| 197 | + COPY_PHASE_STRIP = YES; | ||
| 198 | + ENABLE_NS_ASSERTIONS = NO; | ||
| 199 | + ENABLE_STRICT_OBJC_MSGSEND = YES; | ||
| 200 | + GCC_C_LANGUAGE_STANDARD = gnu99; | ||
| 201 | + GCC_NO_COMMON_BLOCKS = YES; | ||
| 202 | + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | ||
| 203 | + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | ||
| 204 | + GCC_WARN_UNDECLARED_SELECTOR = YES; | ||
| 205 | + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | ||
| 206 | + GCC_WARN_UNUSED_FUNCTION = YES; | ||
| 207 | + GCC_WARN_UNUSED_VARIABLE = YES; | ||
| 208 | + IPHONEOS_DEPLOYMENT_TARGET = 8.0; | ||
| 209 | + MTL_ENABLE_DEBUG_INFO = NO; | ||
| 210 | + SDKROOT = iphoneos; | ||
| 211 | + VALIDATE_PRODUCT = YES; | ||
| 212 | + }; | ||
| 213 | + name = Release; | ||
| 214 | + }; | ||
| 215 | + 58B511F01A9E6C8500147676 /* Debug */ = { | ||
| 216 | + isa = XCBuildConfiguration; | ||
| 217 | + buildSettings = { | ||
| 218 | + HEADER_SEARCH_PATHS = ( | ||
| 219 | + "$(inherited)", | ||
| 220 | + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, | ||
| 221 | + "$(SRCROOT)/../../../React/**", | ||
| 222 | + "$(SRCROOT)/../../react-native/React/**", | ||
| 223 | + ); | ||
| 224 | + LIBRARY_SEARCH_PATHS = "$(inherited)"; | ||
| 225 | + OTHER_LDFLAGS = "-ObjC"; | ||
| 226 | + PRODUCT_NAME = CustomIcon; | ||
| 227 | + SKIP_INSTALL = YES; | ||
| 228 | + }; | ||
| 229 | + name = Debug; | ||
| 230 | + }; | ||
| 231 | + 58B511F11A9E6C8500147676 /* Release */ = { | ||
| 232 | + isa = XCBuildConfiguration; | ||
| 233 | + buildSettings = { | ||
| 234 | + HEADER_SEARCH_PATHS = ( | ||
| 235 | + "$(inherited)", | ||
| 236 | + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, | ||
| 237 | + "$(SRCROOT)/../../../React/**", | ||
| 238 | + "$(SRCROOT)/../../react-native/React/**", | ||
| 239 | + ); | ||
| 240 | + LIBRARY_SEARCH_PATHS = "$(inherited)"; | ||
| 241 | + OTHER_LDFLAGS = "-ObjC"; | ||
| 242 | + PRODUCT_NAME = CustomIcon; | ||
| 243 | + SKIP_INSTALL = YES; | ||
| 244 | + }; | ||
| 245 | + name = Release; | ||
| 246 | + }; | ||
| 247 | +/* End XCBuildConfiguration section */ | ||
| 248 | + | ||
| 249 | +/* Begin XCConfigurationList section */ | ||
| 250 | + 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "CustomIcon" */ = { | ||
| 251 | + isa = XCConfigurationList; | ||
| 252 | + buildConfigurations = ( | ||
| 253 | + 58B511ED1A9E6C8500147676 /* Debug */, | ||
| 254 | + 58B511EE1A9E6C8500147676 /* Release */, | ||
| 255 | + ); | ||
| 256 | + defaultConfigurationIsVisible = 0; | ||
| 257 | + defaultConfigurationName = Release; | ||
| 258 | + }; | ||
| 259 | + 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "CustomIcon" */ = { | ||
| 260 | + isa = XCConfigurationList; | ||
| 261 | + buildConfigurations = ( | ||
| 262 | + 58B511F01A9E6C8500147676 /* Debug */, | ||
| 263 | + 58B511F11A9E6C8500147676 /* Release */, | ||
| 264 | + ); | ||
| 265 | + defaultConfigurationIsVisible = 0; | ||
| 266 | + defaultConfigurationName = Release; | ||
| 267 | + }; | ||
| 268 | +/* End XCConfigurationList section */ | ||
| 269 | + }; | ||
| 270 | + rootObject = 58B511D31A9E6C8500147676 /* Project object */; | ||
| 271 | +} |
package.json
0 → 100644
| 1 | +{ | ||
| 2 | + "name": "react-native-custom-icon", | ||
| 3 | + "title": "React Native Custom Icon", | ||
| 4 | + "version": "1.0.0", | ||
| 5 | + "description": "TODO", | ||
| 6 | + "main": "index.js", | ||
| 7 | + "scripts": { | ||
| 8 | + "test": "echo \"Error: no test specified\" && exit 1" | ||
| 9 | + }, | ||
| 10 | + "repository": { | ||
| 11 | + "type": "git", | ||
| 12 | + "url": "git+https://github.com/github_account/react-native-custom-icon.git", | ||
| 13 | + "baseUrl": "https://github.com/github_account/react-native-custom-icon" | ||
| 14 | + }, | ||
| 15 | + "keywords": [ | ||
| 16 | + "react-native" | ||
| 17 | + ], | ||
| 18 | + "author": { | ||
| 19 | + "name": "Your Name", | ||
| 20 | + "email": "yourname@email.com" | ||
| 21 | + }, | ||
| 22 | + "license": "MIT", | ||
| 23 | + "licenseFilename": "LICENSE", | ||
| 24 | + "readmeFilename": "README.md", | ||
| 25 | + "peerDependencies": { | ||
| 26 | + "react": "^16.8.1", | ||
| 27 | + "react-native": ">=0.59.0-rc.0 <1.0.x" | ||
| 28 | + }, | ||
| 29 | + "devDependencies": { | ||
| 30 | + "react": "^16.8.3", | ||
| 31 | + "react-native": "^0.59.10" | ||
| 32 | + } | ||
| 33 | +} |
react-native-custom-icon.podspec
0 → 100644
| 1 | +require "json" | ||
| 2 | + | ||
| 3 | +package = JSON.parse(File.read(File.join(__dir__, "package.json"))) | ||
| 4 | + | ||
| 5 | +Pod::Spec.new do |s| | ||
| 6 | + s.name = "react-native-custom-icon" | ||
| 7 | + s.version = package["version"] | ||
| 8 | + s.summary = package["description"] | ||
| 9 | + s.description = <<-DESC | ||
| 10 | + react-native-custom-icon | ||
| 11 | + DESC | ||
| 12 | + s.homepage = "https://github.com/github_account/react-native-custom-icon" | ||
| 13 | + s.license = "MIT" | ||
| 14 | + # s.license = { :type => "MIT", :file => "FILE_LICENSE" } | ||
| 15 | + s.authors = { "Your Name" => "yourname@email.com" } | ||
| 16 | + s.platforms = { :ios => "9.0", :tvos => "10.0" } | ||
| 17 | + s.source = { :git => "https://github.com/github_account/react-native-custom-icon.git", :tag => "#{s.version}" } | ||
| 18 | + | ||
| 19 | + s.source_files = "ios/**/*.{h,m,swift}" | ||
| 20 | + s.requires_arc = true | ||
| 21 | + | ||
| 22 | + s.dependency "React" | ||
| 23 | + | ||
| 24 | + # s.dependency "..." | ||
| 25 | +end | ||
| 26 | + |
-
请 注册 或 登录 后发表评论