├── .gitignore ├── .npmignore ├── Example ├── .babelrc ├── .buckconfig ├── .flowconfig ├── .gitattributes ├── .gitignore ├── .watchmanconfig ├── __tests__ │ ├── index.android.js │ └── index.ios.js ├── android │ ├── app │ │ ├── BUCK │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ ├── MainActivity.java │ │ │ │ └── MainApplication.java │ │ │ └── res │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── keystores │ │ ├── BUCK │ │ └── debug.keystore.properties │ └── settings.gradle ├── app.json ├── index.android.js ├── index.ios.js ├── ios │ ├── Example-tvOS │ │ └── Info.plist │ ├── Example-tvOSTests │ │ └── Info.plist │ ├── Example.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── Example-tvOS.xcscheme │ │ │ └── Example.xcscheme │ ├── Example │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Base.lproj │ │ │ └── LaunchScreen.xib │ │ ├── Images.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── Info.plist │ │ └── main.m │ └── ExampleTests │ │ ├── ExampleTests.m │ │ └── Info.plist └── package.json ├── LICENSE ├── README.md ├── android ├── .gitignore ├── .idea │ ├── .name │ ├── compiler.xml │ ├── copyright │ │ └── profiles_settings.xml │ ├── encodings.xml │ ├── gradle.xml │ ├── modules.xml │ └── runConfigurations.xml ├── ReactImageManager.java ├── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── react │ │ └── rnspinkit │ │ ├── RNSpinkit.java │ │ ├── RNSpinkitPackage.java │ │ └── RNSpinkitView.java │ └── res │ └── values │ └── strings.xml ├── index.d.ts ├── index.js ├── ios ├── Libraries │ └── SpinKit │ │ ├── Animations │ │ ├── RTSpinKit9CubeGridAnimation.h │ │ ├── RTSpinKit9CubeGridAnimation.m │ │ ├── RTSpinKitArcAltAnimation.h │ │ ├── RTSpinKitArcAltAnimation.m │ │ ├── RTSpinKitArcAnimation.h │ │ ├── RTSpinKitArcAnimation.m │ │ ├── RTSpinKitBounceAnimation.h │ │ ├── RTSpinKitBounceAnimation.m │ │ ├── RTSpinKitChasingDotsAnimation.h │ │ ├── RTSpinKitChasingDotsAnimation.m │ │ ├── RTSpinKitCircleAnimation.h │ │ ├── RTSpinKitCircleAnimation.m │ │ ├── RTSpinKitCircleFlipAnimation.h │ │ ├── RTSpinKitCircleFlipAnimation.m │ │ ├── RTSpinKitFadingCircleAltAnimation.h │ │ ├── RTSpinKitFadingCircleAltAnimation.m │ │ ├── RTSpinKitFadingCircleAnimation.h │ │ ├── RTSpinKitFadingCircleAnimation.m │ │ ├── RTSpinKitPlaneAnimation.h │ │ ├── RTSpinKitPlaneAnimation.m │ │ ├── RTSpinKitPulseAnimation.h │ │ ├── RTSpinKitPulseAnimation.m │ │ ├── RTSpinKitThreeBounceAnimation.h │ │ ├── RTSpinKitThreeBounceAnimation.m │ │ ├── RTSpinKitWanderingCubesAnimation.h │ │ ├── RTSpinKitWanderingCubesAnimation.m │ │ ├── RTSpinKitWaveAnimation.h │ │ ├── RTSpinKitWaveAnimation.m │ │ ├── RTSpinKitWordPressAnimation.h │ │ └── RTSpinKitWordPressAnimation.m │ │ ├── RTSpinKitAnimating.h │ │ ├── RTSpinKitUtils.h │ │ ├── RTSpinKitUtils.m │ │ ├── RTSpinKitView.h │ │ └── RTSpinKitView.m ├── RNSpinkit.h ├── RNSpinkit.m ├── RNSpinkit.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── react-native-recorder.xccheckout │ │ └── xcuserdata │ │ │ └── blackdivine.xcuserdatad │ │ │ ├── UserInterfaceState.xcuserstate │ │ │ └── WorkspaceSettings.xcsettings │ └── xcuserdata │ │ ├── blackdivine.xcuserdatad │ │ └── xcschemes │ │ │ ├── react-native-recorder.xcscheme │ │ │ └── xcschememanagement.plist │ │ └── maxs15.xcuserdatad │ │ └── xcschemes │ │ ├── RNRecorder.xcscheme │ │ └── xcschememanagement.plist ├── RNSpinkitManager.h └── RNSpinkitManager.m ├── package.json ├── react-native-spinkit.podspec ├── react-native.config.js └── scripts └── rnpm-prelink.js /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | project.xcworkspace 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | 33 | # node.js 34 | # 35 | node_modules/ 36 | npm-debug.log 37 | .npmrc 38 | 39 | # BUCK 40 | buck-out/ 41 | \.buckd/ 42 | android/app/libs 43 | *.keystore 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/Preview.html 54 | fastlane/screenshots 55 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | Example 2 | .npmignore 3 | .npmrc 4 | .DS_Store -------------------------------------------------------------------------------- /Example/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["react-native"] 3 | } 4 | -------------------------------------------------------------------------------- /Example/.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /Example/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | ; We fork some components by platform 3 | .*/*[.]android.js 4 | 5 | ; Ignore "BUCK" generated dirs 6 | /\.buckd/ 7 | 8 | ; Ignore unexpected extra "@providesModule" 9 | .*/node_modules/.*/node_modules/fbjs/.* 10 | 11 | ; Ignore duplicate module providers 12 | ; For RN Apps installed via npm, "Libraries" folder is inside 13 | ; "node_modules/react-native" but in the source repo it is in the root 14 | .*/Libraries/react-native/React.js 15 | .*/Libraries/react-native/ReactNative.js 16 | 17 | [include] 18 | 19 | [libs] 20 | node_modules/react-native/Libraries/react-native/react-native-interface.js 21 | node_modules/react-native/flow 22 | flow/ 23 | 24 | [options] 25 | emoji=true 26 | 27 | module.system=haste 28 | 29 | experimental.strict_type_args=true 30 | 31 | munge_underscores=true 32 | 33 | module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' 34 | 35 | suppress_type=$FlowIssue 36 | suppress_type=$FlowFixMe 37 | suppress_type=$FixMe 38 | 39 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(4[0-5]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) 40 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(4[0-5]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ 41 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy 42 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError 43 | 44 | unsafe.enable_getters_and_setters=true 45 | 46 | [version] 47 | ^0.45.0 48 | -------------------------------------------------------------------------------- /Example/.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /Example/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | project.xcworkspace 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | 33 | # node.js 34 | # 35 | node_modules/ 36 | npm-debug.log 37 | yarn-error.log 38 | 39 | # BUCK 40 | buck-out/ 41 | \.buckd/ 42 | *.keystore 43 | 44 | # fastlane 45 | # 46 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 47 | # screenshots whenever they are needed. 48 | # For more information about the recommended setup visit: 49 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 50 | 51 | fastlane/report.xml 52 | fastlane/Preview.html 53 | fastlane/screenshots 54 | -------------------------------------------------------------------------------- /Example/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /Example/__tests__/index.android.js: -------------------------------------------------------------------------------- 1 | import 'react-native'; 2 | import React from 'react'; 3 | import Index from '../index.android.js'; 4 | 5 | // Note: test renderer must be required after react-native. 6 | import renderer from 'react-test-renderer'; 7 | 8 | it('renders correctly', () => { 9 | const tree = renderer.create( 10 | 11 | ); 12 | }); 13 | -------------------------------------------------------------------------------- /Example/__tests__/index.ios.js: -------------------------------------------------------------------------------- 1 | import 'react-native'; 2 | import React from 'react'; 3 | import Index from '../index.ios.js'; 4 | 5 | // Note: test renderer must be required after react-native. 6 | import renderer from 'react-test-renderer'; 7 | 8 | it('renders correctly', () => { 9 | const tree = renderer.create( 10 | 11 | ); 12 | }); 13 | -------------------------------------------------------------------------------- /Example/android/app/BUCK: -------------------------------------------------------------------------------- 1 | # To learn about Buck see [Docs](https://buckbuild.com/). 2 | # To run your application with Buck: 3 | # - install Buck 4 | # - `npm start` - to start the packager 5 | # - `cd android` 6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 8 | # - `buck install -r android/app` - compile, install and run application 9 | # 10 | 11 | lib_deps = [] 12 | 13 | for jarfile in glob(['libs/*.jar']): 14 | name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')] 15 | lib_deps.append(':' + name) 16 | prebuilt_jar( 17 | name = name, 18 | binary_jar = jarfile, 19 | ) 20 | 21 | for aarfile in glob(['libs/*.aar']): 22 | name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')] 23 | lib_deps.append(':' + name) 24 | android_prebuilt_aar( 25 | name = name, 26 | aar = aarfile, 27 | ) 28 | 29 | android_library( 30 | name = "all-libs", 31 | exported_deps = lib_deps, 32 | ) 33 | 34 | android_library( 35 | name = "app-code", 36 | srcs = glob([ 37 | "src/main/java/**/*.java", 38 | ]), 39 | deps = [ 40 | ":all-libs", 41 | ":build_config", 42 | ":res", 43 | ], 44 | ) 45 | 46 | android_build_config( 47 | name = "build_config", 48 | package = "com.example", 49 | ) 50 | 51 | android_resource( 52 | name = "res", 53 | package = "com.example", 54 | res = "src/main/res", 55 | ) 56 | 57 | android_binary( 58 | name = "app", 59 | keystore = "//android/keystores:debug", 60 | manifest = "src/main/AndroidManifest.xml", 61 | package_type = "debug", 62 | deps = [ 63 | ":app-code", 64 | ], 65 | ) 66 | -------------------------------------------------------------------------------- /Example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | 3 | import com.android.build.OutputFile 4 | 5 | /** 6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets 7 | * and bundleReleaseJsAndAssets). 8 | * These basically call `react-native bundle` with the correct arguments during the Android build 9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the 10 | * bundle directly from the development server. Below you can see all the possible configurations 11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the 12 | * `apply from: "../../node_modules/react-native/react.gradle"` line. 13 | * 14 | * project.ext.react = [ 15 | * // the name of the generated asset file containing your JS bundle 16 | * bundleAssetName: "index.android.bundle", 17 | * 18 | * // the entry file for bundle generation 19 | * entryFile: "index.android.js", 20 | * 21 | * // whether to bundle JS and assets in debug mode 22 | * bundleInDebug: false, 23 | * 24 | * // whether to bundle JS and assets in release mode 25 | * bundleInRelease: true, 26 | * 27 | * // whether to bundle JS and assets in another build variant (if configured). 28 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants 29 | * // The configuration property can be in the following formats 30 | * // 'bundleIn${productFlavor}${buildType}' 31 | * // 'bundleIn${buildType}' 32 | * // bundleInFreeDebug: true, 33 | * // bundleInPaidRelease: true, 34 | * // bundleInBeta: true, 35 | * 36 | * // whether to disable dev mode in custom build variants (by default only disabled in release) 37 | * // for example: to disable dev mode in the staging build type (if configured) 38 | * devDisabledInStaging: true, 39 | * // The configuration property can be in the following formats 40 | * // 'devDisabledIn${productFlavor}${buildType}' 41 | * // 'devDisabledIn${buildType}' 42 | * 43 | * // the root of your project, i.e. where "package.json" lives 44 | * root: "../../", 45 | * 46 | * // where to put the JS bundle asset in debug mode 47 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 48 | * 49 | * // where to put the JS bundle asset in release mode 50 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 51 | * 52 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 53 | * // require('./image.png')), in debug mode 54 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 55 | * 56 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 57 | * // require('./image.png')), in release mode 58 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 59 | * 60 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 61 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 62 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 63 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 64 | * // for example, you might want to remove it from here. 65 | * inputExcludes: ["android/**", "ios/**"], 66 | * 67 | * // override which node gets called and with what additional arguments 68 | * nodeExecutableAndArgs: ["node"], 69 | * 70 | * // supply additional arguments to the packager 71 | * extraPackagerArgs: [] 72 | * ] 73 | */ 74 | 75 | apply from: "../../node_modules/react-native/react.gradle" 76 | 77 | /** 78 | * Set this to true to create two separate APKs instead of one: 79 | * - An APK that only works on ARM devices 80 | * - An APK that only works on x86 devices 81 | * The advantage is the size of the APK is reduced by about 4MB. 82 | * Upload all the APKs to the Play Store and people will download 83 | * the correct one based on the CPU architecture of their device. 84 | */ 85 | def enableSeparateBuildPerCPUArchitecture = false 86 | 87 | /** 88 | * Run Proguard to shrink the Java bytecode in release builds. 89 | */ 90 | def enableProguardInReleaseBuilds = false 91 | 92 | android { 93 | compileSdkVersion rootProject.ext.compileSdkVersion 94 | buildToolsVersion rootProject.ext.buildToolsVersion 95 | 96 | defaultConfig { 97 | applicationId "com.example" 98 | minSdkVersion rootProject.ext.minSdkVersion 99 | targetSdkVersion rootProject.ext.targetSdkVersion 100 | versionCode 1 101 | versionName "1.0" 102 | ndk { 103 | abiFilters "armeabi-v7a", "x86" 104 | } 105 | } 106 | splits { 107 | abi { 108 | reset() 109 | enable enableSeparateBuildPerCPUArchitecture 110 | universalApk false // If true, also generate a universal APK 111 | include "armeabi-v7a", "x86" 112 | } 113 | } 114 | buildTypes { 115 | release { 116 | minifyEnabled enableProguardInReleaseBuilds 117 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 118 | } 119 | } 120 | // applicationVariants are e.g. debug, release 121 | applicationVariants.all { variant -> 122 | variant.outputs.each { output -> 123 | // For each separate APK per architecture, set a unique version code as described here: 124 | // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits 125 | def versionCodes = ["armeabi-v7a":1, "x86":2] 126 | def abi = output.getFilter(OutputFile.ABI) 127 | if (abi != null) { // null for the universal-debug, universal-release variants 128 | output.versionCodeOverride = 129 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode 130 | } 131 | } 132 | } 133 | } 134 | 135 | dependencies { 136 | compile project(':react-native-spinkit') 137 | compile fileTree(dir: "libs", include: ["*.jar"]) 138 | compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" 139 | compile "com.facebook.react:react-native:+" // From node_modules 140 | } 141 | 142 | // Run this once to be able to run the application with BUCK 143 | // puts all compile dependencies into folder libs for BUCK to use 144 | task copyDownloadableDepsToLibs(type: Copy) { 145 | from configurations.compile 146 | into 'libs' 147 | } 148 | -------------------------------------------------------------------------------- /Example/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Disabling obfuscation is useful if you collect stack traces from production crashes 20 | # (unless you are using a system that supports de-obfuscate the stack traces). 21 | -dontobfuscate 22 | 23 | # React Native 24 | 25 | # Keep our interfaces so they can be used by other ProGuard rules. 26 | # See http://sourceforge.net/p/proguard/bugs/466/ 27 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip 28 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters 29 | -keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip 30 | 31 | # Do not strip any method/class that is annotated with @DoNotStrip 32 | -keep @com.facebook.proguard.annotations.DoNotStrip class * 33 | -keep @com.facebook.common.internal.DoNotStrip class * 34 | -keepclassmembers class * { 35 | @com.facebook.proguard.annotations.DoNotStrip *; 36 | @com.facebook.common.internal.DoNotStrip *; 37 | } 38 | 39 | -keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * { 40 | void set*(***); 41 | *** get*(); 42 | } 43 | 44 | -keep class * extends com.facebook.react.bridge.JavaScriptModule { *; } 45 | -keep class * extends com.facebook.react.bridge.NativeModule { *; } 46 | -keepclassmembers,includedescriptorclasses class * { native ; } 47 | -keepclassmembers class * { @com.facebook.react.uimanager.UIProp ; } 48 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp ; } 49 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup ; } 50 | 51 | -dontwarn com.facebook.react.** 52 | 53 | # TextLayoutBuilder uses a non-public Android constructor within StaticLayout. 54 | # See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details. 55 | -dontwarn android.text.StaticLayout 56 | 57 | # okhttp 58 | 59 | -keepattributes Signature 60 | -keepattributes *Annotation* 61 | -keep class okhttp3.** { *; } 62 | -keep interface okhttp3.** { *; } 63 | -dontwarn okhttp3.** 64 | 65 | # okio 66 | 67 | -keep class sun.misc.Unsafe { *; } 68 | -dontwarn java.nio.file.* 69 | -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement 70 | -dontwarn okio.** 71 | -------------------------------------------------------------------------------- /Example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 12 | 13 | 19 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Example/android/app/src/main/java/com/example/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import com.facebook.react.ReactActivity; 4 | import com.react.rnspinkit.RNSpinkitPackage; 5 | 6 | public class MainActivity extends ReactActivity { 7 | 8 | /** 9 | * Returns the name of the main component registered from JavaScript. 10 | * This is used to schedule rendering of the component. 11 | */ 12 | @Override 13 | protected String getMainComponentName() { 14 | return "Example"; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Example/android/app/src/main/java/com/example/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import android.app.Application; 4 | 5 | import com.facebook.react.ReactApplication; 6 | import com.facebook.react.ReactNativeHost; 7 | import com.facebook.react.ReactPackage; 8 | import com.facebook.react.shell.MainReactPackage; 9 | import com.facebook.soloader.SoLoader; 10 | 11 | import com.react.rnspinkit.RNSpinkitPackage; 12 | 13 | import java.util.Arrays; 14 | import java.util.List; 15 | 16 | public class MainApplication extends Application implements ReactApplication { 17 | 18 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 19 | @Override 20 | public boolean getUseDeveloperSupport() { 21 | return BuildConfig.DEBUG; 22 | } 23 | 24 | @Override 25 | protected List getPackages() { 26 | return Arrays.asList( 27 | new MainReactPackage(), 28 | new RNSpinkitPackage() 29 | ); 30 | } 31 | }; 32 | 33 | @Override 34 | public ReactNativeHost getReactNativeHost() { 35 | return mReactNativeHost; 36 | } 37 | 38 | @Override 39 | public void onCreate() { 40 | super.onCreate(); 41 | SoLoader.init(this, /* native exopackage */ false); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxs15/react-native-spinkit/0abe3d523df94480ae4fddb5a41f133219d9b985/Example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxs15/react-native-spinkit/0abe3d523df94480ae4fddb5a41f133219d9b985/Example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxs15/react-native-spinkit/0abe3d523df94480ae4fddb5a41f133219d9b985/Example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxs15/react-native-spinkit/0abe3d523df94480ae4fddb5a41f133219d9b985/Example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Example 4 | 5 | -------------------------------------------------------------------------------- /Example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext { 5 | buildToolsVersion = "28.0.3" 6 | minSdkVersion = 16 7 | compileSdkVersion = 28 8 | targetSdkVersion = 27 9 | supportLibVersion = "28.0.0" 10 | } 11 | repositories { 12 | jcenter() 13 | maven { 14 | url 'https://maven.google.com/' 15 | name 'Google' 16 | } 17 | } 18 | dependencies { 19 | classpath 'com.android.tools.build:gradle:2.2.3' 20 | 21 | // NOTE: Do not place your application dependencies here; they belong 22 | // in the individual module build.gradle files 23 | } 24 | } 25 | 26 | allprojects { 27 | repositories { 28 | // Add jitpack repository (added by react-native-spinkit) 29 | maven { url "https://jitpack.io" } 30 | mavenLocal() 31 | jcenter() 32 | maven { 33 | url 'https://maven.google.com/' 34 | name 'Google' 35 | } 36 | maven { 37 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 38 | url "$rootDir/../node_modules/react-native/android" 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | android.useDeprecatedNdk=true 21 | -------------------------------------------------------------------------------- /Example/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxs15/react-native-spinkit/0abe3d523df94480ae4fddb5a41f133219d9b985/Example/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /Example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip 6 | -------------------------------------------------------------------------------- /Example/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 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 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /Example/android/gradlew.bat: -------------------------------------------------------------------------------- 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 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 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 Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /Example/android/keystores/BUCK: -------------------------------------------------------------------------------- 1 | keystore( 2 | name = "debug", 3 | properties = "debug.keystore.properties", 4 | store = "debug.keystore", 5 | visibility = [ 6 | "PUBLIC", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /Example/android/keystores/debug.keystore.properties: -------------------------------------------------------------------------------- 1 | key.store=debug.keystore 2 | key.alias=androiddebugkey 3 | key.store.password=android 4 | key.alias.password=android 5 | -------------------------------------------------------------------------------- /Example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'Example' 2 | 3 | include ':app' 4 | include ':react-native-spinkit' 5 | project(':react-native-spinkit').projectDir = new File(rootProject.projectDir, '../../android') 6 | -------------------------------------------------------------------------------- /Example/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Example", 3 | "displayName": "Example" 4 | } -------------------------------------------------------------------------------- /Example/index.android.js: -------------------------------------------------------------------------------- 1 | require('./index.ios.js'); 2 | -------------------------------------------------------------------------------- /Example/index.ios.js: -------------------------------------------------------------------------------- 1 | var React = require('react'); 2 | var ReactNative = require('react-native'); 3 | 4 | var { 5 | AppRegistry, 6 | StyleSheet, 7 | View, 8 | TouchableOpacity, 9 | Text 10 | } = ReactNative; 11 | 12 | var Spinner = require('react-native-spinkit'); 13 | 14 | var Example = React.createClass({ 15 | 16 | getInitialState() { 17 | return { 18 | index: 0, 19 | types: ['CircleFlip', 'Bounce', 'Wave', 'WanderingCubes', 'Pulse', 'ChasingDots', 'ThreeBounce', 'Circle', '9CubeGrid', 'WordPress', 'FadingCircle', 'FadingCircleAlt', 'Arc', 'ArcAlt'], 20 | size: 100, 21 | color: "#FFFFFF", 22 | isVisible: true 23 | } 24 | }, 25 | 26 | next() { 27 | if (this.state.index++ >= this.state.types.length) 28 | this.setState({index: 0}) 29 | else 30 | this.setState({index: this.state.index++}) 31 | }, 32 | 33 | increaseSize() { 34 | this.setState({size: this.state.size + 10}); 35 | }, 36 | 37 | changeColor() { 38 | this.setState({color: '#'+Math.floor(Math.random()*16777215).toString(16)}); 39 | }, 40 | 41 | changeVisibility() { 42 | this.setState({isVisible: !this.state.isVisible}); 43 | }, 44 | 45 | render() { 46 | var type = this.state.types[this.state.index]; 47 | 48 | return ( 49 | 50 | 51 | 52 | Type: {type} 53 | 54 | 55 | Next 56 | 57 | 58 | 59 | Increase size 60 | 61 | 62 | 63 | Change color 64 | 65 | 66 | 67 | Change visibility 68 | 69 | 70 | ); 71 | } 72 | 73 | }); 74 | 75 | var styles = StyleSheet.create({ 76 | container: { 77 | flex: 1, 78 | justifyContent: 'center', 79 | alignItems: 'center', 80 | backgroundColor: '#d35400', 81 | }, 82 | 83 | spinner: { 84 | marginBottom: 50 85 | }, 86 | 87 | btn: { 88 | marginTop: 20 89 | }, 90 | 91 | text: { 92 | color: "white" 93 | } 94 | }); 95 | 96 | AppRegistry.registerComponent('Example', () => Example); 97 | -------------------------------------------------------------------------------- /Example/ios/Example-tvOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UIViewControllerBasedStatusBarAppearance 38 | 39 | NSLocationWhenInUseUsageDescription 40 | 41 | NSAppTransportSecurity 42 | 43 | 44 | NSExceptionDomains 45 | 46 | localhost 47 | 48 | NSExceptionAllowsInsecureHTTPLoads 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /Example/ios/Example-tvOSTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/ios/Example.xcodeproj/xcshareddata/xcschemes/Example-tvOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 43 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 61 | 67 | 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 92 | 94 | 100 | 101 | 102 | 103 | 104 | 105 | 111 | 113 | 119 | 120 | 121 | 122 | 124 | 125 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /Example/ios/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 43 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 61 | 67 | 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 92 | 94 | 100 | 101 | 102 | 103 | 104 | 105 | 111 | 113 | 119 | 120 | 121 | 122 | 124 | 125 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /Example/ios/Example/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (nonatomic, strong) UIWindow *window; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Example/ios/Example/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "AppDelegate.h" 11 | 12 | #import 13 | #import 14 | 15 | @implementation AppDelegate 16 | 17 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 18 | { 19 | NSURL *jsCodeLocation; 20 | 21 | jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil]; 22 | 23 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 24 | moduleName:@"Example" 25 | initialProperties:nil 26 | launchOptions:launchOptions]; 27 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 28 | 29 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 30 | UIViewController *rootViewController = [UIViewController new]; 31 | rootViewController.view = rootView; 32 | self.window.rootViewController = rootViewController; 33 | [self.window makeKeyAndVisible]; 34 | return YES; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /Example/ios/Example/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /Example/ios/Example/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /Example/ios/Example/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | Example 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UIViewControllerBasedStatusBarAppearance 40 | 41 | NSLocationWhenInUseUsageDescription 42 | 43 | NSAppTransportSecurity 44 | 45 | 46 | NSExceptionDomains 47 | 48 | localhost 49 | 50 | NSExceptionAllowsInsecureHTTPLoads 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /Example/ios/Example/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "AppDelegate.h" 13 | 14 | int main(int argc, char * argv[]) { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Example/ios/ExampleTests/ExampleTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import 12 | 13 | #import 14 | #import 15 | 16 | #define TIMEOUT_SECONDS 600 17 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" 18 | 19 | @interface ExampleTests : XCTestCase 20 | 21 | @end 22 | 23 | @implementation ExampleTests 24 | 25 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 26 | { 27 | if (test(view)) { 28 | return YES; 29 | } 30 | for (UIView *subview in [view subviews]) { 31 | if ([self findSubviewInView:subview matching:test]) { 32 | return YES; 33 | } 34 | } 35 | return NO; 36 | } 37 | 38 | - (void)testRendersWelcomeScreen 39 | { 40 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; 41 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 42 | BOOL foundElement = NO; 43 | 44 | __block NSString *redboxError = nil; 45 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 46 | if (level >= RCTLogLevelError) { 47 | redboxError = message; 48 | } 49 | }); 50 | 51 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 52 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 53 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 54 | 55 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 56 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 57 | return YES; 58 | } 59 | return NO; 60 | }]; 61 | } 62 | 63 | RCTSetLogFunction(RCTDefaultLogFunction); 64 | 65 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 66 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 67 | } 68 | 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /Example/ios/ExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Example", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node node_modules/react-native/local-cli/cli.js start", 7 | "test": "jest" 8 | }, 9 | "dependencies": { 10 | "react": "16.0.0-alpha.12", 11 | "react-native": "0.45.1", 12 | "react-native-spinkit": "1.5.1" 13 | }, 14 | "devDependencies": { 15 | "babel-jest": "20.0.3", 16 | "babel-preset-react-native": "1.9.2", 17 | "jest": "20.0.4", 18 | "react-test-renderer": "16.0.0-alpha.12" 19 | }, 20 | "jest": { 21 | "preset": "react-native" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Max 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. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # react-native-spinkit 2 | 3 | [![npm](https://img.shields.io/npm/dm/react-native-spinkit.svg?maxAge=2592000)]() 4 | [![npm](https://img.shields.io/npm/dt/react-native-spinkit.svg?maxAge=2592000)]() 5 | 6 | A collection of animated loading indicators 7 | React native port of [SpinKit](http://tobiasahlin.com/spinkit/). 8 | 9 | ## Use your beautiful spinner to sell in-app purchases 👇 10 | 11 | IAPHUB 12 | 13 |
14 | 15 | ## Preview 16 | ![](http://i.imgur.com/AwJsakU.gif) 17 | 18 | ## Getting started 19 | 20 | `npm install react-native-spinkit@latest --save` 21 | For RN < 0.40 support, use react-native-spinkit@0.1.5 22 | 23 | ##### Automatically link the library 24 | `react-native link` 25 | 26 | > For RN projects < 0.29 link the library automatically using [RNPM](https://github.com/rnpm/rnpm) 27 | `rnpm link react-native-spinkit` 28 | 29 | ##### Manual linking - IOS 30 | Follow the wiki available [here](https://github.com/maxs15/react-native-spinkit/wiki/Manual-linking---IOS) 31 | 32 | ##### Manual linking - Android 33 | Follow the wiki available [here](https://github.com/maxs15/react-native-spinkit/wiki/Manual-linking---Android) 34 | 35 | ## Example 36 | Check [index.ios.js](https://github.com/maxs15/react-native-spinkit/blob/master/Example/index.ios.js) in the Example folder. 37 | 38 | ## Properties 39 | 40 | | Prop | Default | Type | Description | 41 | | :------------ |:---------------:| :---------------:| :-----| 42 | | isVisible | `true` | `boolean` | Visibility of the spinner | 43 | | color | #000000 | `string` | Color of the spinner | 44 | | size | 37 | `number` | Size of the spinner | 45 | | type | Plane | `string` | Style type of the spinner | 46 | 47 | ### List of available types 48 | 49 | - CircleFlip 50 | - Bounce 51 | - Wave 52 | - WanderingCubes 53 | - Pulse 54 | - ChasingDots 55 | - ThreeBounce 56 | - Circle 57 | - 9CubeGrid 58 | - WordPress (IOS only) 59 | - FadingCircle 60 | - FadingCircleAlt 61 | - Arc (IOS only) 62 | - ArcAlt (IOS only) 63 | 64 | ## Acknowledgements 65 | 66 | IOS library: [SpinKit-ObjC](https://github.com/raymondjavaxx/SpinKit-ObjC) 67 | Android library: [Android-SpinKit](https://github.com/ybq/Android-SpinKit) 68 | 69 | ## License 70 | 71 | (c) 2016 Max, [MIT license](/LICENSE). 72 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | 16 | # Gradle files 17 | .gradle/ 18 | build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # Android Studio Navigation editor temp files 30 | .navigation/ 31 | 32 | # Android Studio captures folder 33 | captures/ 34 | 35 | # Intellij 36 | *.iml 37 | 38 | # Keystore files 39 | *.jks 40 | 41 | # Eclipse Metadata 42 | .metadata/ 43 | # 44 | # Mac OS X clutter 45 | *.DS_Store 46 | # 47 | # Windows clutter 48 | Thumbs.db 49 | # 50 | # # Intellij IDEA (see https://intellij-support.jetbrains.com/entries/23393067) 51 | *.iws 52 | .idea/libraries 53 | .idea/tasks.xml 54 | .idea/vcs.xml 55 | .idea/workspace.xml 56 | .idea/misc.xml 57 | -------------------------------------------------------------------------------- /android/.idea/.name: -------------------------------------------------------------------------------- 1 | android -------------------------------------------------------------------------------- /android/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /android/.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /android/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /android/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 21 | -------------------------------------------------------------------------------- /android/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /android/ReactImageManager.java: -------------------------------------------------------------------------------- 1 | public class ReactImageManager extends SimpleViewManager -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 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 | //noinspection GradleDependency 12 | classpath("com.android.tools.build:gradle:${safeExtGet('gradlePluginVersion', '3.4.1')}") 13 | } 14 | } 15 | 16 | apply plugin: 'com.android.library' 17 | 18 | android { 19 | compileSdkVersion safeExtGet('compileSdkVersion', 28) 20 | //noinspection GradleDependency 21 | buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3') 22 | 23 | defaultConfig { 24 | minSdkVersion safeExtGet('minSdkVersion', 16) 25 | //noinspection OldTargetApi 26 | targetSdkVersion safeExtGet('targetSdkVersion', 28) 27 | } 28 | lintOptions { 29 | abortOnError false 30 | } 31 | } 32 | 33 | repositories { 34 | mavenLocal() 35 | google() 36 | jcenter() 37 | maven { 38 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 39 | url "$rootDir/../node_modules/react-native/android" 40 | } 41 | maven { 42 | url "https://jitpack.io" 43 | } 44 | } 45 | 46 | dependencies { 47 | //noinspection GradleDynamicVersion 48 | implementation "com.facebook.react:react-native:${safeExtGet('reactnativeVersion', '+')}" 49 | implementation 'com.github.ybq:Android-SpinKit:1.4.0' 50 | } -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxs15/react-native-spinkit/0abe3d523df94480ae4fddb5a41f133219d9b985/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed May 11 13:21:41 CST 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip 7 | -------------------------------------------------------------------------------- /android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 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 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 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 Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /android/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/xeiyan/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /android/src/main/java/com/react/rnspinkit/RNSpinkit.java: -------------------------------------------------------------------------------- 1 | package com.react.rnspinkit; 2 | 3 | 4 | import android.graphics.Color; 5 | import androidx.annotation.Nullable; 6 | import android.util.Log; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.RelativeLayout; 10 | 11 | import com.facebook.react.bridge.ReactApplicationContext; 12 | import com.facebook.react.uimanager.SimpleViewManager; 13 | import com.facebook.react.uimanager.ThemedReactContext; 14 | import com.facebook.react.uimanager.annotations.ReactProp; 15 | import com.github.ybq.android.spinkit.SpinKitView; 16 | import com.github.ybq.android.spinkit.sprite.Sprite; 17 | import com.github.ybq.android.spinkit.style.ChasingDots; 18 | import com.github.ybq.android.spinkit.style.Circle; 19 | import com.github.ybq.android.spinkit.style.CubeGrid; 20 | import com.github.ybq.android.spinkit.style.DoubleBounce; 21 | import com.github.ybq.android.spinkit.style.FadingCircle; 22 | import com.github.ybq.android.spinkit.style.FoldingCube; 23 | import com.github.ybq.android.spinkit.style.Pulse; 24 | import com.github.ybq.android.spinkit.style.RotatingPlane; 25 | import com.github.ybq.android.spinkit.style.ThreeBounce; 26 | import com.github.ybq.android.spinkit.style.WanderingCubes; 27 | import com.github.ybq.android.spinkit.style.Wave; 28 | 29 | import java.util.HashMap; 30 | import java.util.Map; 31 | import java.util.UUID; 32 | 33 | /** 34 | * Created by suzuri04x2 on 2016/5/10. 35 | */ 36 | public class RNSpinkit extends SimpleViewManager { 37 | 38 | ReactApplicationContext mContext; 39 | 40 | double mSize = 48; 41 | 42 | public RNSpinkit(ReactApplicationContext reactContext) { 43 | mContext = reactContext; 44 | } 45 | 46 | @Override 47 | public String getName() { 48 | return "RNSpinkit"; 49 | } 50 | 51 | @Override 52 | protected RNSpinkitView createViewInstance(ThemedReactContext reactContext) { 53 | return new RNSpinkitView(reactContext); 54 | } 55 | 56 | @ReactProp(name = "isVisible") 57 | public void setIsVisible(RNSpinkitView view, @Nullable Boolean visible) { 58 | if(visible) 59 | view.setVisibility(View.VISIBLE); 60 | else 61 | view.setVisibility(View.INVISIBLE); 62 | } 63 | 64 | @ReactProp(name = "color") 65 | public void setColor(RNSpinkitView view, @Nullable int color) { 66 | view.setSpriteColor(color); 67 | } 68 | 69 | @ReactProp(name = "size") 70 | public void setSize(RNSpinkitView view, @Nullable double size) { 71 | view.setSpriteSize(size); 72 | } 73 | 74 | @ReactProp(name = "type") 75 | public void setType(RNSpinkitView view, @Nullable String spinnerType) { 76 | view.setSpriteType(spinnerType); 77 | 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /android/src/main/java/com/react/rnspinkit/RNSpinkitPackage.java: -------------------------------------------------------------------------------- 1 | package com.react.rnspinkit; 2 | 3 | import com.facebook.react.ReactPackage; 4 | import com.facebook.react.bridge.JavaScriptModule; 5 | import com.facebook.react.bridge.NativeModule; 6 | import com.facebook.react.bridge.ReactApplicationContext; 7 | import com.facebook.react.uimanager.ViewManager; 8 | 9 | import java.lang.reflect.Array; 10 | import java.util.ArrayList; 11 | import java.util.Collections; 12 | import java.util.List; 13 | 14 | /** 15 | * Created by suzuri04x2 on 2016/5/10. 16 | */ 17 | public class RNSpinkitPackage implements ReactPackage{ 18 | @Override 19 | public List createNativeModules(ReactApplicationContext reactContext) { 20 | return Collections.emptyList(); 21 | } 22 | 23 | public List> createJSModules() { 24 | return Collections.emptyList(); 25 | } 26 | 27 | @Override 28 | public List createViewManagers(ReactApplicationContext reactContext) { 29 | List list = new ArrayList<>(); 30 | list.add(new RNSpinkit(reactContext)); 31 | return list; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /android/src/main/java/com/react/rnspinkit/RNSpinkitView.java: -------------------------------------------------------------------------------- 1 | package com.react.rnspinkit; 2 | 3 | import android.content.Context; 4 | import android.graphics.Color; 5 | import android.util.Log; 6 | import android.view.ViewGroup; 7 | import android.widget.RelativeLayout; 8 | 9 | import com.github.ybq.android.spinkit.SpinKitView; 10 | import com.github.ybq.android.spinkit.sprite.Sprite; 11 | import com.github.ybq.android.spinkit.style.ChasingDots; 12 | import com.github.ybq.android.spinkit.style.Circle; 13 | import com.github.ybq.android.spinkit.style.CubeGrid; 14 | import com.github.ybq.android.spinkit.style.DoubleBounce; 15 | import com.github.ybq.android.spinkit.style.FadingCircle; 16 | import com.github.ybq.android.spinkit.style.FoldingCube; 17 | import com.github.ybq.android.spinkit.style.Pulse; 18 | import com.github.ybq.android.spinkit.style.RotatingPlane; 19 | import com.github.ybq.android.spinkit.style.ThreeBounce; 20 | import com.github.ybq.android.spinkit.style.WanderingCubes; 21 | import com.github.ybq.android.spinkit.style.Wave; 22 | 23 | /** 24 | * Created by wkh237 on 2016/11/6. 25 | */ 26 | 27 | public class RNSpinkitView extends SpinKitView{ 28 | 29 | private int mColor; 30 | private Sprite mSprite = getSprite(""); 31 | private String mType; 32 | private double mSize; 33 | 34 | public RNSpinkitView(Context context) { 35 | super(context); 36 | } 37 | 38 | public void setSpriteColor(int color) { 39 | try { 40 | mColor = color; 41 | this.mSprite.setColor(mColor); 42 | this.setIndeterminateDrawable(mSprite); 43 | } catch(Exception err) { 44 | Log.e("RNSpinkit-Err", err.toString() + "when set prop color to " + color); 45 | } 46 | } 47 | 48 | public void setSpriteType(String type){ 49 | mType = type; 50 | mSprite = this.getSprite(type); 51 | mSprite.setColor(mColor); 52 | RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); 53 | this.setLayoutParams(params); 54 | this.setIndeterminateDrawable(mSprite); 55 | } 56 | 57 | private Sprite getSprite(String spinnerType) { 58 | switch (spinnerType) { 59 | case "Bounce" : 60 | return new DoubleBounce(); 61 | case "Wave" : 62 | return new Wave(); 63 | case "RotatingPlane" : 64 | return new RotatingPlane(); 65 | case "WanderingCubes": 66 | return new WanderingCubes(); 67 | case "9CubeGrid": 68 | return new CubeGrid(); 69 | case "FadingCircleAlt" : 70 | return new FadingCircle(); 71 | case "Pulse" : 72 | return new Pulse(); 73 | case "ChasingDots": 74 | // Add scale factor to prevent clipping 75 | Sprite d = new ChasingDots(); 76 | d.setScale(0.85f); 77 | return d; 78 | case "ThreeBounce": 79 | return new ThreeBounce(); 80 | case "Circle": 81 | return new Circle(); 82 | case "FoldingCube": 83 | // Add scale factor to prevent clipping 84 | Sprite sprite = new FoldingCube(); 85 | sprite.setScale(0.70f); 86 | return sprite; 87 | default : 88 | break; 89 | } 90 | return new RotatingPlane(); 91 | } 92 | 93 | 94 | public void setSpriteSize(double size) { 95 | mSize = size; 96 | RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); 97 | this.setLayoutParams(params); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /android/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | RNSpinkit 3 | 4 | -------------------------------------------------------------------------------- /index.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'react-native-spinkit' { 2 | import React from 'react'; 3 | import { StyleProp, ViewStyle } from "react-native"; 4 | 5 | export type SpinnerType = 6 | | 'CircleFlip' 7 | | 'Bounce' 8 | | 'Wave' 9 | | 'WanderingCubes' 10 | | 'Pulse' 11 | | 'ChasingDots' 12 | | 'ThreeBounce' 13 | | 'Circle' 14 | | '9CubeGrid' 15 | | 'WordPress' 16 | | 'FadingCircle' 17 | | 'FadingCircleAlt' 18 | | 'Arc' 19 | | 'ArcAlt' 20 | | 'Plane'; 21 | 22 | export type SpinnerProps = { 23 | isVisible?: boolean; 24 | color?: string; 25 | size?: number; 26 | type?: SpinnerType; 27 | style?: StyleProp; 28 | }; 29 | 30 | const Spinner: React.ComponentType; 31 | export default Spinner; 32 | } -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import ReactNative from 'react-native' 3 | import PropTypes from 'prop-types'; 4 | 5 | var { 6 | NativeModules, 7 | processColor, 8 | requireNativeComponent, 9 | View 10 | } = ReactNative; 11 | 12 | var RNSpinkit = null; 13 | 14 | class Spinkit extends React.Component { 15 | 16 | static propTypes = { 17 | type: PropTypes.string, 18 | /** 19 | * @prop color 20 | * @NOTE This is typically passed as a string, but technically can also be 21 | * a number (see https://facebook.github.io/react/docs/typechecking-with-proptypes.html). 22 | * In addition, allowing a number prop type eliminates the PropType warning 23 | * React Native will throw if passing a string into this component but a 24 | * different type (number) down to the native module. 25 | */ 26 | color: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), 27 | size: PropTypes.number, 28 | isVisible: PropTypes.bool, 29 | testID: PropTypes.string, 30 | accessibilityComponentType: PropTypes.string, 31 | accessibilityLabel: PropTypes.string, 32 | accessibilityLiveRegion: PropTypes.string, 33 | renderToHardwareTextureAndroid: PropTypes.bool, 34 | importantForAccessibility: PropTypes.string, 35 | onLayout: PropTypes.func, 36 | style: PropTypes.object, 37 | }; 38 | 39 | static defaultProps = { 40 | size: 37, 41 | color: "#000000", 42 | isVisible: true 43 | }; 44 | 45 | render() { 46 | if (!this.props.isVisible) return ; 47 | 48 | var size = {height: this.props.size, width: this.props.size}; 49 | 50 | // In order to handle all the color specifications allowed in React Native 51 | // as a whole, we need to call processColor here, and can pass in the 52 | // resulting number directly. RCTConvert will be called on iOS to parse 53 | // into #AARRGGBB form; on Android, this int can be used directly for 54 | // setting the color. 55 | var colorNumber = processColor(this.props.color); 56 | 57 | return ( 58 | 63 | ); 64 | } 65 | 66 | } 67 | 68 | // Since RNPM does not recognize `requireNativeComponent`, so we have to 69 | // add this line, and RNPM will link native modules automatically 70 | NativeModules.RNSpinkit; 71 | 72 | // Native component 73 | RNSpinkit = requireNativeComponent( 74 | 'RNSpinkit', 75 | Spinkit, 76 | { 77 | nativeOnly: { 78 | 'nativeID': true 79 | } 80 | } 81 | ); 82 | 83 | 84 | module.exports = Spinkit; 85 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/Animations/RTSpinKit9CubeGridAnimation.h: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKit9CubeGridAnimation.h 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import 26 | #import "RTSpinKitAnimating.h" 27 | 28 | @interface RTSpinKit9CubeGridAnimation : NSObject 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/Animations/RTSpinKit9CubeGridAnimation.m: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKit9CubeGridAnimation.m 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import "RTSpinKit9CubeGridAnimation.h" 26 | 27 | @implementation RTSpinKit9CubeGridAnimation 28 | 29 | -(void)setupSpinKitAnimationInLayer:(CALayer*)layer withSize:(CGSize)size color:(UIColor*)color 30 | { 31 | NSTimeInterval beginTime = CACurrentMediaTime(); 32 | 33 | CGFloat squareSize = size.width / 3; 34 | 35 | for (NSInteger sum = 0; sum < 5; sum++) 36 | { 37 | for (NSInteger x = 0; x < 3; x++) 38 | { 39 | for (NSInteger y = 0; y < 3; y++) 40 | { 41 | if (x + y == sum) 42 | { 43 | CALayer *square = [CALayer layer]; 44 | square.frame = CGRectMake(x * squareSize, y * squareSize, squareSize, squareSize); 45 | square.backgroundColor = color.CGColor; 46 | square.transform = CATransform3DMakeScale(0.0, 0.0, 0.0); 47 | 48 | CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"transform"]; 49 | anim.removedOnCompletion = NO; 50 | anim.repeatCount = HUGE_VALF; 51 | anim.duration = 1.5; 52 | anim.beginTime = beginTime + (0.1 * sum); 53 | anim.keyTimes = @[@(0.0), @(0.4), @(0.6), @(1.0)]; 54 | 55 | anim.timingFunctions = @[ 56 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], 57 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], 58 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], 59 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut] 60 | ]; 61 | 62 | anim.values = @[ 63 | [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.0, 0.0, 0.0)], 64 | [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0, 1.0, 0.0)], 65 | [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0, 1.0, 0.0)], 66 | [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.0, 0.0, 0.0)] 67 | ]; 68 | 69 | [layer addSublayer:square]; 70 | [square addAnimation:anim forKey:@"spinkit-anim"]; 71 | } 72 | } 73 | } 74 | } 75 | } 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/Animations/RTSpinKitArcAltAnimation.h: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitArcAltAnimation.h 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import 26 | #import "RTSpinKitAnimating.h" 27 | 28 | @interface RTSpinKitArcAltAnimation : NSObject 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/Animations/RTSpinKitArcAltAnimation.m: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitArcAltAnimation.m 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import "RTSpinKitArcAltAnimation.h" 26 | 27 | @implementation RTSpinKitArcAltAnimation 28 | 29 | -(void)setupSpinKitAnimationInLayer:(CALayer *)layer withSize:(CGSize)size color:(UIColor *)color 30 | { 31 | NSTimeInterval beginTime = CACurrentMediaTime(); 32 | 33 | CGRect frame = CGRectInset(CGRectMake(0.0, 0.0, size.width, size.height), 2.0, 2.0); 34 | CGFloat radius = CGRectGetWidth(frame) / 2.0; 35 | CGPoint center = CGPointMake(CGRectGetMidX(frame), CGRectGetMidY(frame)); 36 | 37 | CALayer *arc = [CALayer layer]; 38 | arc.frame = CGRectMake(0.0, 0.0, size.width, size.height); 39 | arc.backgroundColor = color.CGColor; 40 | arc.anchorPoint = CGPointMake(0.5, 0.5); 41 | arc.cornerRadius = CGRectGetWidth(arc.frame) / 2.0; 42 | 43 | CGMutablePathRef path = CGPathCreateMutable(); 44 | CGPathAddArc(path, NULL, center.x, center.y, radius, 0.0, M_PI * 2.0, NO); 45 | 46 | CAShapeLayer *mask = [CAShapeLayer layer]; 47 | mask.frame = CGRectMake(0.0, 0.0, size.width, size.height); 48 | mask.path = path; 49 | mask.strokeColor = [[UIColor blackColor] CGColor]; 50 | mask.fillColor = [[UIColor clearColor] CGColor]; 51 | mask.lineWidth = 2.0; 52 | mask.cornerRadius = frame.size.width / 2.0; 53 | mask.anchorPoint = CGPointMake(0.5, 0.5); 54 | 55 | arc.mask = mask; 56 | 57 | CGPathRelease(path); 58 | 59 | CGFloat duration = 1.2; 60 | 61 | CAKeyframeAnimation *strokeEndAnim = [CAKeyframeAnimation animationWithKeyPath:@"strokeEnd"]; 62 | strokeEndAnim.removedOnCompletion = NO; 63 | strokeEndAnim.repeatCount = HUGE_VALF; 64 | strokeEndAnim.duration = duration; 65 | strokeEndAnim.beginTime = beginTime; 66 | strokeEndAnim.keyTimes = @[@(0.0), @(0.4), @(1.0)]; 67 | strokeEndAnim.values = @[@(0.0), @(1.0), @(1.0)]; 68 | strokeEndAnim.timingFunctions = @[ 69 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut], 70 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut], 71 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut], 72 | ]; 73 | 74 | CAKeyframeAnimation *strokeStartAnim = [CAKeyframeAnimation animationWithKeyPath:@"strokeStart"]; 75 | strokeStartAnim.removedOnCompletion = NO; 76 | strokeStartAnim.repeatCount = HUGE_VALF; 77 | strokeStartAnim.duration = duration; 78 | strokeStartAnim.beginTime = beginTime; 79 | strokeStartAnim.keyTimes = @[@(0.0), @(0.6), @(1.0)]; 80 | strokeStartAnim.values = @[@(0.0), @(0.0), @(1.0)]; 81 | strokeStartAnim.timingFunctions = @[ 82 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], 83 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], 84 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], 85 | ]; 86 | 87 | [layer addSublayer:arc]; 88 | [mask addAnimation:strokeStartAnim forKey:@"spinkit-anim.start"]; 89 | [mask addAnimation:strokeEndAnim forKey:@"spinkit-anim.end"]; 90 | } 91 | 92 | @end 93 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/Animations/RTSpinKitArcAnimation.h: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitArcAnimation.h 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import 26 | #import "RTSpinKitAnimating.h" 27 | 28 | @interface RTSpinKitArcAnimation : NSObject 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/Animations/RTSpinKitArcAnimation.m: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitArcAnimation.m 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import "RTSpinKitArcAnimation.h" 26 | 27 | @implementation RTSpinKitArcAnimation 28 | 29 | -(void)setupSpinKitAnimationInLayer:(CALayer *)layer withSize:(CGSize)size color:(UIColor *)color 30 | { 31 | NSTimeInterval beginTime = CACurrentMediaTime(); 32 | 33 | CGRect frame = CGRectInset(CGRectMake(0.0, 0.0, size.width, size.height), 2.0, 2.0); 34 | CGFloat radius = CGRectGetWidth(frame) / 2.0; 35 | CGPoint center = CGPointMake(CGRectGetMidX(frame), CGRectGetMidY(frame)); 36 | 37 | CALayer *arc = [CALayer layer]; 38 | arc.frame = CGRectMake(0.0, 0.0, size.width, size.height); 39 | arc.backgroundColor = color.CGColor; 40 | arc.anchorPoint = CGPointMake(0.5, 0.5); 41 | arc.cornerRadius = CGRectGetWidth(arc.frame) / 2.0; 42 | 43 | CGMutablePathRef path = CGPathCreateMutable(); 44 | CGPathAddArc(path, NULL, center.x, center.y, radius, 0.0, ((M_PI * 2.0) / 360.0) * 300.0, NO); 45 | 46 | CAShapeLayer *mask = [CAShapeLayer layer]; 47 | mask.frame = CGRectMake(0.0, 0.0, size.width, size.height); 48 | mask.path = path; 49 | mask.strokeColor = [[UIColor blackColor] CGColor]; 50 | mask.fillColor = [[UIColor clearColor] CGColor]; 51 | mask.lineWidth = 2.0; 52 | mask.cornerRadius = frame.size.width / 2.0; 53 | mask.anchorPoint = CGPointMake(0.5, 0.5); 54 | 55 | arc.mask = mask; 56 | 57 | CGPathRelease(path); 58 | 59 | CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.z"]; 60 | anim.removedOnCompletion = NO; 61 | anim.repeatCount = HUGE_VALF; 62 | anim.duration = 0.8; 63 | anim.beginTime = beginTime; 64 | anim.keyTimes = @[@(0.0), @(0.5), @(1.0)]; 65 | 66 | anim.values = @[ 67 | [NSNumber numberWithDouble:0.0], 68 | [NSNumber numberWithDouble:M_PI], 69 | [NSNumber numberWithDouble:M_PI * 2.0] 70 | ]; 71 | 72 | [layer addSublayer:arc]; 73 | [arc addAnimation:anim forKey:@"spinkit-anim"]; 74 | } 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/Animations/RTSpinKitBounceAnimation.h: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitBounceAnimation.h 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import 26 | #import "RTSpinKitAnimating.h" 27 | 28 | @interface RTSpinKitBounceAnimation : NSObject 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/Animations/RTSpinKitBounceAnimation.m: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitBounceAnimation.m 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import "RTSpinKitBounceAnimation.h" 26 | 27 | @implementation RTSpinKitBounceAnimation 28 | 29 | -(void)setupSpinKitAnimationInLayer:(CALayer*)layer withSize:(CGSize)size color:(UIColor*)color 30 | { 31 | NSTimeInterval beginTime = CACurrentMediaTime(); 32 | 33 | for (NSInteger i=0; i < 2; i+=1) { 34 | CALayer *circle = [CALayer layer]; 35 | circle.frame = CGRectInset(CGRectMake(0.0, 0.0, size.width, size.height), 2.0, 2.0); 36 | circle.backgroundColor = color.CGColor; 37 | circle.anchorPoint = CGPointMake(0.5, 0.5); 38 | circle.opacity = 0.6; 39 | circle.cornerRadius = CGRectGetHeight(circle.bounds) * 0.5; 40 | circle.transform = CATransform3DMakeScale(0.0, 0.0, 0.0); 41 | 42 | CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"transform"]; 43 | anim.removedOnCompletion = NO; 44 | anim.repeatCount = HUGE_VALF; 45 | anim.duration = 2.0; 46 | anim.beginTime = beginTime - (1.0 * i); 47 | anim.keyTimes = @[@(0.0), @(0.5), @(1.0)]; 48 | 49 | anim.timingFunctions = @[ 50 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], 51 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], 52 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut] 53 | ]; 54 | 55 | anim.values = @[ 56 | [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.0, 0.0, 0.0)], 57 | [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0, 1.0, 0.0)], 58 | [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.0, 0.0, 0.0)] 59 | ]; 60 | 61 | [layer addSublayer:circle]; 62 | [circle addAnimation:anim forKey:@"spinkit-anim"]; 63 | } 64 | } 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/Animations/RTSpinKitChasingDotsAnimation.h: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitChasingDotsAnimation.h 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import 26 | #import "RTSpinKitAnimating.h" 27 | 28 | @interface RTSpinKitChasingDotsAnimation : NSObject 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/Animations/RTSpinKitChasingDotsAnimation.m: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitChasingDotsAnimation.m 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import "RTSpinKitChasingDotsAnimation.h" 26 | 27 | @implementation RTSpinKitChasingDotsAnimation 28 | 29 | -(void)setupSpinKitAnimationInLayer:(CALayer*)layer withSize:(CGSize)size color:(UIColor*)color 30 | { 31 | NSTimeInterval beginTime = CACurrentMediaTime(); 32 | 33 | CALayer *spinner = [CALayer layer]; 34 | spinner.frame = CGRectMake(0.0, 0.0, size.width, size.height); 35 | spinner.anchorPoint = CGPointMake(0.5, 0.5); 36 | spinner.transform = CATransform3DIdentity; 37 | spinner.shouldRasterize = YES; 38 | spinner.rasterizationScale = [[UIScreen mainScreen] scale]; 39 | [layer addSublayer:spinner]; 40 | 41 | CAKeyframeAnimation *spinnerAnim = [CAKeyframeAnimation animationWithKeyPath:@"transform"]; 42 | spinnerAnim.removedOnCompletion = NO; 43 | spinnerAnim.repeatCount = HUGE_VALF; 44 | spinnerAnim.duration = 2.0; 45 | spinnerAnim.beginTime = beginTime; 46 | spinnerAnim.keyTimes = @[@(0.0), @(0.25), @(0.5), @(0.75), @(1.0)]; 47 | 48 | spinnerAnim.timingFunctions = @[ 49 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear], 50 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear], 51 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear], 52 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear], 53 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear] 54 | ]; 55 | 56 | spinnerAnim.values = @[ 57 | [NSValue valueWithCATransform3D:CATransform3DMakeRotation(0, 0, 0, 1.0)], 58 | [NSValue valueWithCATransform3D:CATransform3DMakeRotation(M_PI_2, 0, 0, 1.0)], 59 | [NSValue valueWithCATransform3D:CATransform3DMakeRotation(M_PI, 0, 0, 1.0)], 60 | [NSValue valueWithCATransform3D:CATransform3DMakeRotation(3 * M_PI_2, 0, 0, 1.0)], 61 | [NSValue valueWithCATransform3D:CATransform3DMakeRotation(2 * M_PI, 0, 0, 1.0)] 62 | ]; 63 | 64 | [spinner addAnimation:spinnerAnim forKey:@"spinner-anim"]; 65 | 66 | for (NSInteger i=0; i < 2; i+=1) { 67 | CALayer *circle = [CALayer layer]; 68 | CGFloat offset = size.width * 0.3 * i; 69 | circle.frame = CGRectOffset(CGRectApplyAffineTransform(CGRectMake(0.0, 0.0, size.width, size.height), CGAffineTransformMakeScale(0.6, 0.6)), offset, offset); 70 | circle.backgroundColor = color.CGColor; 71 | circle.anchorPoint = CGPointMake(0.5, 0.5); 72 | circle.cornerRadius = CGRectGetHeight(circle.bounds) * 0.5; 73 | circle.transform = CATransform3DMakeScale(0.0, 0.0, 0.0); 74 | 75 | CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"transform"]; 76 | anim.removedOnCompletion = NO; 77 | anim.repeatCount = HUGE_VALF; 78 | anim.duration = 2.0; 79 | anim.beginTime = beginTime - (1.0 * i); 80 | anim.keyTimes = @[@(0.0), @(0.5), @(1.0)]; 81 | 82 | anim.timingFunctions = @[ 83 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], 84 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], 85 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut] 86 | ]; 87 | 88 | anim.values = @[ 89 | [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.0, 0.0, 0.0)], 90 | [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0, 1.0, 0.0)], 91 | [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.0, 0.0, 0.0)] 92 | ]; 93 | 94 | [spinner addSublayer:circle]; 95 | [circle addAnimation:anim forKey:@"spinkit-anim"]; 96 | } 97 | } 98 | 99 | @end 100 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/Animations/RTSpinKitCircleAnimation.h: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitCircleAnimation.h 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import 26 | #import "RTSpinKitAnimating.h" 27 | 28 | @interface RTSpinKitCircleAnimation : NSObject 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/Animations/RTSpinKitCircleAnimation.m: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitCircleAnimation.m 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import "RTSpinKitCircleAnimation.h" 26 | #include 27 | 28 | @implementation RTSpinKitCircleAnimation 29 | 30 | -(void)setupSpinKitAnimationInLayer:(CALayer*)layer withSize:(CGSize)size color:(UIColor*)color 31 | { 32 | NSTimeInterval beginTime = CACurrentMediaTime(); 33 | 34 | CGFloat radius = size.width / 2; 35 | CGFloat circleSize = size.width / 4; 36 | 37 | for (NSInteger i=0; i < 8; i+=1) { 38 | CALayer *circle = [CALayer layer]; 39 | 40 | CGFloat angle = i * M_PI_4; 41 | CGFloat x = radius + sinf(angle) * radius; 42 | CGFloat y = radius - cosf(angle) * radius; 43 | circle.frame = CGRectMake(x, y, circleSize, circleSize); 44 | circle.backgroundColor = color.CGColor; 45 | circle.anchorPoint = CGPointMake(0.5, 0.5); 46 | circle.cornerRadius = CGRectGetHeight(circle.bounds) * 0.5; 47 | circle.transform = CATransform3DMakeScale(0.0, 0.0, 0.0); 48 | 49 | CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"transform"]; 50 | anim.removedOnCompletion = NO; 51 | anim.repeatCount = HUGE_VALF; 52 | anim.duration = 1.0; 53 | anim.beginTime = beginTime + (0.125 * i); 54 | anim.keyTimes = @[@(0.0), @(0.5), @(1.0)]; 55 | 56 | anim.timingFunctions = @[ 57 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], 58 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], 59 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut] 60 | ]; 61 | 62 | anim.values = @[ 63 | [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.0, 0.0, 0.0)], 64 | [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0, 1.0, 0.0)], 65 | [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.0, 0.0, 0.0)] 66 | ]; 67 | 68 | [layer addSublayer:circle]; 69 | [circle addAnimation:anim forKey:@"spinkit-anim"]; 70 | } 71 | } 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/Animations/RTSpinKitCircleFlipAnimation.h: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitCircleFlipAnimation.h 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import 26 | #import "RTSpinKitAnimating.h" 27 | 28 | @interface RTSpinKitCircleFlipAnimation : NSObject 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/Animations/RTSpinKitCircleFlipAnimation.m: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitCircleFlipAnimation.m 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import "RTSpinKitCircleFlipAnimation.h" 26 | #import "RTSpinKitUtils.h" 27 | 28 | @implementation RTSpinKitCircleFlipAnimation 29 | 30 | -(void)setupSpinKitAnimationInLayer:(CALayer*)layer withSize:(CGSize)size color:(UIColor*)color 31 | { 32 | CALayer *circle = [CALayer layer]; 33 | circle.frame = CGRectInset(CGRectMake(0.0, 0.0, size.width, size.height), 2.0, 2.0); 34 | circle.backgroundColor = color.CGColor; 35 | circle.cornerRadius = CGRectGetHeight(circle.bounds) * 0.5; 36 | circle.anchorPoint = CGPointMake(0.5, 0.5); 37 | circle.anchorPointZ = 0.5; 38 | circle.shouldRasterize = YES; 39 | circle.rasterizationScale = [[UIScreen mainScreen] scale]; 40 | [layer addSublayer:circle]; 41 | 42 | CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"transform"]; 43 | anim.removedOnCompletion = NO; 44 | anim.repeatCount = HUGE_VALF; 45 | anim.duration = 1.2; 46 | anim.keyTimes = @[@(0.0), @(0.5), @(1.0)]; 47 | 48 | anim.timingFunctions = @[ 49 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], 50 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], 51 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut] 52 | ]; 53 | 54 | anim.values = @[ 55 | [NSValue valueWithCATransform3D:RTSpinKit3DRotationWithPerspective(1.0/120.0, 0, 0, 0, 0)], 56 | [NSValue valueWithCATransform3D:RTSpinKit3DRotationWithPerspective(1.0/120.0, M_PI, 0.0, 1.0, 0.0)], 57 | [NSValue valueWithCATransform3D:RTSpinKit3DRotationWithPerspective(1.0/120.0, M_PI, 0.0, 0.0, 1.0)] 58 | ]; 59 | 60 | [circle addAnimation:anim forKey:@"spinkit-anim"]; 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/Animations/RTSpinKitFadingCircleAltAnimation.h: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitFadingCircleAltAnimation.h 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import 26 | #import "RTSpinKitAnimating.h" 27 | 28 | @interface RTSpinKitFadingCircleAltAnimation : NSObject 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/Animations/RTSpinKitFadingCircleAltAnimation.m: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitFadingCircleAltAnimation.m 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import "RTSpinKitFadingCircleAltAnimation.h" 26 | #include 27 | 28 | static const CGFloat kRTSpinKitDegToRad = 0.0174532925; 29 | 30 | @implementation RTSpinKitFadingCircleAltAnimation 31 | 32 | -(void)setupSpinKitAnimationInLayer:(CALayer*)layer withSize:(CGSize)size color:(UIColor*)color { 33 | NSTimeInterval beginTime = CACurrentMediaTime() ; 34 | 35 | CGFloat radius = size.width / 2; 36 | 37 | for (NSInteger i=0; i < 12; i+=1) { 38 | CALayer *circle = [CALayer layer]; 39 | circle.backgroundColor = color.CGColor; 40 | circle.anchorPoint = CGPointMake(0.5, 0.5); 41 | circle.frame = CGRectMake(radius + cosf(kRTSpinKitDegToRad * (30.0 * i)) * radius , radius + sinf(kRTSpinKitDegToRad * (30.0 * i)) * radius, radius / 2, radius / 2); 42 | circle.shouldRasterize = YES; 43 | circle.rasterizationScale = [[UIScreen mainScreen] scale]; 44 | circle.cornerRadius = CGRectGetHeight(circle.bounds) * 0.5; 45 | 46 | CAKeyframeAnimation* transformAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform"]; 47 | 48 | transformAnimation.values = @[ 49 | [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0, 1.0, 0.0)], 50 | [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.0, 0.0, 0.0)] 51 | ]; 52 | 53 | CAKeyframeAnimation* opacityAnimation = [CAKeyframeAnimation animationWithKeyPath:@"opacity"]; 54 | 55 | opacityAnimation.values = @[ 56 | @(1.0), 57 | @(0.0) 58 | ]; 59 | 60 | CAAnimationGroup* animationGroup = [[CAAnimationGroup alloc] init]; 61 | animationGroup.removedOnCompletion = NO; 62 | animationGroup.repeatCount = HUGE_VALF; 63 | animationGroup.duration = 1.2; 64 | animationGroup.beginTime = beginTime - (1.2 - (0.1 * i)); 65 | animationGroup.animations = @[transformAnimation, opacityAnimation]; 66 | [circle addAnimation:animationGroup forKey:@"spinkit-anim"]; 67 | [layer addSublayer:circle]; 68 | } 69 | } 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/Animations/RTSpinKitFadingCircleAnimation.h: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitFadingCircleAnimation.h 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import 26 | #import "RTSpinKitAnimating.h" 27 | 28 | @interface RTSpinKitFadingCircleAnimation : NSObject 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/Animations/RTSpinKitFadingCircleAnimation.m: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitFadingCircleAnimation.m 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import "RTSpinKitFadingCircleAnimation.h" 26 | #include 27 | 28 | @implementation RTSpinKitFadingCircleAnimation 29 | 30 | -(void)setupSpinKitAnimationInLayer:(CALayer*)layer withSize:(CGSize)size color:(UIColor*)color 31 | { 32 | NSTimeInterval beginTime = CACurrentMediaTime(); 33 | 34 | CGFloat radius = size.width / 2; 35 | CGFloat squareSize = size.width / 6; 36 | 37 | for (NSInteger i=0; i < 12; i+=1) { 38 | CALayer *square = [CALayer layer]; 39 | 40 | CGFloat angle = i * (M_PI_2/3.0); 41 | CGFloat x = radius + sinf(angle) * radius; 42 | CGFloat y = radius - cosf(angle) * radius; 43 | square.frame = CGRectMake(x, y, squareSize, squareSize); 44 | square.backgroundColor = color.CGColor; 45 | square.anchorPoint = CGPointMake(0.5, 0.5); 46 | square.opacity = 0.0; 47 | 48 | CATransform3D transform = CATransform3DIdentity; 49 | transform = CATransform3DRotate(transform, angle, 0, 0, 1.0); 50 | square.transform = transform; 51 | 52 | CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"opacity"]; 53 | anim.removedOnCompletion = NO; 54 | anim.repeatCount = HUGE_VALF; 55 | anim.duration = 1.0; 56 | anim.beginTime = beginTime + (0.084 * i); 57 | anim.keyTimes = @[@(0.0), @(0.5), @(1.0)]; 58 | 59 | anim.timingFunctions = @[ 60 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], 61 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut] 62 | ]; 63 | 64 | anim.values = @[@(1.0), @(0.0), @(0.0)]; 65 | 66 | [layer addSublayer:square]; 67 | [square addAnimation:anim forKey:@"spinkit-anim"]; 68 | } 69 | } 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/Animations/RTSpinKitPlaneAnimation.h: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitPlaneAnimation.h 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import 26 | #import "RTSpinKitAnimating.h" 27 | 28 | @interface RTSpinKitPlaneAnimation : NSObject 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/Animations/RTSpinKitPlaneAnimation.m: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitPlaneAnimation.m 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import "RTSpinKitPlaneAnimation.h" 26 | #import "RTSpinKitUtils.h" 27 | 28 | @implementation RTSpinKitPlaneAnimation 29 | 30 | -(void)setupSpinKitAnimationInLayer:(CALayer*)layer withSize:(CGSize)size color:(UIColor*)color 31 | { 32 | CALayer *plane = [CALayer layer]; 33 | plane.frame = CGRectInset(CGRectMake(0.0, 0.0, size.width, size.height), 2.0, 2.0); 34 | plane.backgroundColor = color.CGColor; 35 | plane.anchorPoint = CGPointMake(0.5, 0.5); 36 | plane.anchorPointZ = 0.5; 37 | plane.shouldRasterize = YES; 38 | plane.rasterizationScale = [[UIScreen mainScreen] scale]; 39 | [layer addSublayer:plane]; 40 | 41 | CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"transform"]; 42 | anim.removedOnCompletion = NO; 43 | anim.repeatCount = HUGE_VALF; 44 | anim.duration = 1.2; 45 | anim.keyTimes = @[@(0.0), @(0.5), @(1.0)]; 46 | 47 | anim.timingFunctions = @[ 48 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], 49 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], 50 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut] 51 | ]; 52 | 53 | anim.values = @[ 54 | [NSValue valueWithCATransform3D:RTSpinKit3DRotationWithPerspective(1.0/120.0, 0, 0, 0, 0)], 55 | [NSValue valueWithCATransform3D:RTSpinKit3DRotationWithPerspective(1.0/120.0, M_PI, 0.0, 1.0,0.0)], 56 | [NSValue valueWithCATransform3D:RTSpinKit3DRotationWithPerspective(1.0/120.0, M_PI, 0.0, 0.0,1.0)] 57 | ]; 58 | 59 | [plane addAnimation:anim forKey:@"spinkit-anim"]; 60 | } 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/Animations/RTSpinKitPulseAnimation.h: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitPulseAnimation.h 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import 26 | #import "RTSpinKitAnimating.h" 27 | 28 | @interface RTSpinKitPulseAnimation : NSObject 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/Animations/RTSpinKitPulseAnimation.m: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitPulseAnimation.m 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import "RTSpinKitPulseAnimation.h" 26 | 27 | @implementation RTSpinKitPulseAnimation 28 | 29 | -(void)setupSpinKitAnimationInLayer:(CALayer*)layer withSize:(CGSize)size color:(UIColor*)color 30 | { 31 | NSTimeInterval beginTime = CACurrentMediaTime(); 32 | 33 | CALayer *circle = [CALayer layer]; 34 | circle.frame = CGRectInset(CGRectMake(0.0, 0.0, size.width, size.height), 2.0, 2.0); 35 | circle.backgroundColor = color.CGColor; 36 | circle.anchorPoint = CGPointMake(0.5, 0.5); 37 | circle.opacity = 1.0; 38 | circle.cornerRadius = CGRectGetHeight(circle.bounds) * 0.5; 39 | circle.transform = CATransform3DMakeScale(0.0, 0.0, 0.0); 40 | 41 | CAKeyframeAnimation *scaleAnim = [CAKeyframeAnimation animationWithKeyPath:@"transform"]; 42 | scaleAnim.values = @[ 43 | [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.0, 0.0, 0.0)], 44 | [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0, 1.0, 0.0)] 45 | ]; 46 | 47 | CAKeyframeAnimation *opacityAnim = [CAKeyframeAnimation animationWithKeyPath:@"opacity"]; 48 | opacityAnim.values = @[@(1.0), @(0.0)]; 49 | 50 | CAAnimationGroup *animGroup = [CAAnimationGroup animation]; 51 | animGroup.removedOnCompletion = NO; 52 | animGroup.beginTime = beginTime; 53 | animGroup.repeatCount = HUGE_VALF; 54 | animGroup.duration = 1.0; 55 | animGroup.animations = @[scaleAnim, opacityAnim]; 56 | animGroup.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 57 | 58 | [layer addSublayer:circle]; 59 | [circle addAnimation:animGroup forKey:@"spinkit-anim"]; 60 | } 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/Animations/RTSpinKitThreeBounceAnimation.h: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitThreeBounceAnimation.h 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import 26 | #import "RTSpinKitAnimating.h" 27 | 28 | @interface RTSpinKitThreeBounceAnimation : NSObject 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/Animations/RTSpinKitThreeBounceAnimation.m: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitThreeBounceAnimation.m 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import "RTSpinKitThreeBounceAnimation.h" 26 | 27 | @implementation RTSpinKitThreeBounceAnimation 28 | 29 | -(void)setupSpinKitAnimationInLayer:(CALayer*)layer withSize:(CGSize)size color:(UIColor*)color 30 | { 31 | NSTimeInterval beginTime = CACurrentMediaTime(); 32 | 33 | CGFloat offset = size.width / 8; 34 | CGFloat circleSize = offset * 2; 35 | 36 | for (NSInteger i=0; i < 3; i+=1) { 37 | CALayer *circle = [CALayer layer]; 38 | circle.frame = CGRectMake(i * 3 * offset, size.height / 2, circleSize, circleSize); 39 | circle.backgroundColor = color.CGColor; 40 | circle.anchorPoint = CGPointMake(0.5, 0.5); 41 | circle.cornerRadius = CGRectGetHeight(circle.bounds) * 0.5; 42 | circle.transform = CATransform3DMakeScale(0.0, 0.0, 0.0); 43 | 44 | CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"transform"]; 45 | anim.removedOnCompletion = NO; 46 | anim.repeatCount = HUGE_VALF; 47 | anim.duration = 1.5; 48 | anim.beginTime = beginTime + (0.25 * i); 49 | anim.keyTimes = @[@(0.0), @(0.5), @(1.0)]; 50 | 51 | anim.timingFunctions = @[ 52 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], 53 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], 54 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut] 55 | ]; 56 | 57 | anim.values = @[ 58 | [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.0, 0.0, 0.0)], 59 | [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0, 1.0, 0.0)], 60 | [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.0, 0.0, 0.0)] 61 | ]; 62 | 63 | [layer addSublayer:circle]; 64 | [circle addAnimation:anim forKey:@"spinkit-anim"]; 65 | } 66 | } 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/Animations/RTSpinKitWanderingCubesAnimation.h: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitWanderingCubesAnimation.h 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import 26 | #import "RTSpinKitAnimating.h" 27 | 28 | @interface RTSpinKitWanderingCubesAnimation : NSObject 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/Animations/RTSpinKitWanderingCubesAnimation.m: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitWanderingCubesAnimation.m 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import "RTSpinKitWanderingCubesAnimation.h" 26 | #include 27 | 28 | static const CGFloat kRTSpinKitDegToRad = 0.0174532925; 29 | 30 | @implementation RTSpinKitWanderingCubesAnimation 31 | 32 | -(void)setupSpinKitAnimationInLayer:(CALayer*)layer withSize:(CGSize)size color:(UIColor*)color 33 | { 34 | NSTimeInterval beginTime = CACurrentMediaTime(); 35 | CGFloat cubeSize = floor(size.width / 3.0); 36 | CGFloat widthMinusCubeSize = size.width - cubeSize; 37 | 38 | for (NSInteger i=0; i<2; i+=1) { 39 | CALayer *cube = [CALayer layer]; 40 | cube.backgroundColor = color.CGColor; 41 | cube.frame = CGRectMake(0.0, 0.0, cubeSize, cubeSize); 42 | cube.anchorPoint = CGPointMake(0.5, 0.5); 43 | cube.shouldRasterize = YES; 44 | cube.rasterizationScale = [[UIScreen mainScreen] scale]; 45 | 46 | CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"transform"]; 47 | anim.removedOnCompletion = NO; 48 | anim.beginTime = beginTime - (i * 0.9); 49 | anim.duration = 1.8; 50 | anim.repeatCount = HUGE_VALF; 51 | 52 | anim.keyTimes = @[@(0.0), @(0.25), @(0.50), @(0.75), @(1.0)]; 53 | 54 | anim.timingFunctions = @[ 55 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], 56 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], 57 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], 58 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], 59 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut] 60 | ]; 61 | 62 | CATransform3D t0 = CATransform3DIdentity; 63 | 64 | CATransform3D t1 = CATransform3DMakeTranslation(widthMinusCubeSize, 0.0, 0.0); 65 | t1 = CATransform3DRotate(t1, -90.0 * kRTSpinKitDegToRad, 0.0, 0.0, 1.0); 66 | t1 = CATransform3DScale(t1, 0.5, 0.5, 1.0); 67 | 68 | CATransform3D t2 = CATransform3DMakeTranslation(widthMinusCubeSize, widthMinusCubeSize, 0.0); 69 | t2 = CATransform3DRotate(t2, -180.0 * kRTSpinKitDegToRad, 0.0, 0.0, 1.0); 70 | t2 = CATransform3DScale(t2, 1.0, 1.0, 1.0); 71 | 72 | CATransform3D t3 = CATransform3DMakeTranslation(0.0, widthMinusCubeSize, 0.0); 73 | t3 = CATransform3DRotate(t3, -270.0 * kRTSpinKitDegToRad, 0.0, 0.0, 1.0); 74 | t3 = CATransform3DScale(t3, 0.5, 0.5, 1.0); 75 | 76 | CATransform3D t4 = CATransform3DMakeTranslation(0.0, 0.0, 0.0); 77 | t4 = CATransform3DRotate(t4, -360.0 * kRTSpinKitDegToRad, 0.0, 0.0, 1.0); 78 | t4 = CATransform3DScale(t4, 1.0, 1.0, 1.0); 79 | 80 | anim.values = @[[NSValue valueWithCATransform3D:t0], 81 | [NSValue valueWithCATransform3D:t1], 82 | [NSValue valueWithCATransform3D:t2], 83 | [NSValue valueWithCATransform3D:t3], 84 | [NSValue valueWithCATransform3D:t4]]; 85 | 86 | [layer addSublayer:cube]; 87 | [cube addAnimation:anim forKey:@"spinkit-anim"]; 88 | } 89 | } 90 | 91 | @end 92 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/Animations/RTSpinKitWaveAnimation.h: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitWaveAnimation.h 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import 26 | #import "RTSpinKitAnimating.h" 27 | 28 | @interface RTSpinKitWaveAnimation : NSObject 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/Animations/RTSpinKitWaveAnimation.m: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitWaveAnimation.m 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import "RTSpinKitWaveAnimation.h" 26 | 27 | @implementation RTSpinKitWaveAnimation 28 | 29 | -(void)setupSpinKitAnimationInLayer:(CALayer*)layer withSize:(CGSize)size color:(UIColor*)color 30 | { 31 | NSTimeInterval beginTime = CACurrentMediaTime() + 1.2; 32 | CGFloat barWidth = size.width / 5.0; 33 | 34 | for (NSInteger i=0; i < 5; i+=1) { 35 | CALayer *bar = [CALayer layer]; 36 | bar.backgroundColor = color.CGColor; 37 | bar.frame = CGRectMake(barWidth * i, 0.0, barWidth - 3.0, size.height); 38 | bar.transform = CATransform3DMakeScale(1.0, 0.3, 0.0); 39 | 40 | CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"transform"]; 41 | anim.removedOnCompletion = NO; 42 | anim.beginTime = beginTime - (1.2 - (0.1 * i)); 43 | anim.duration = 1.2; 44 | anim.repeatCount = HUGE_VALF; 45 | 46 | anim.keyTimes = @[@(0.0), @(0.2), @(0.4), @(1.0)]; 47 | 48 | anim.timingFunctions = @[ 49 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], 50 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], 51 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], 52 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut] 53 | ]; 54 | 55 | anim.values = @[ 56 | [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0, 0.4, 0.0)], 57 | [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0, 1.0, 0.0)], 58 | [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0, 0.4, 0.0)], 59 | [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0, 0.4, 0.0)] 60 | ]; 61 | 62 | [bar addAnimation:anim forKey:@"spinkit-anim"]; 63 | 64 | [layer addSublayer:bar]; 65 | } 66 | } 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/Animations/RTSpinKitWordPressAnimation.h: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitWordPressAnimation.h 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import 26 | #import "RTSpinKitAnimating.h" 27 | 28 | @interface RTSpinKitWordPressAnimation : NSObject 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/Animations/RTSpinKitWordPressAnimation.m: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitWordPressAnimation.m 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import "RTSpinKitWordPressAnimation.h" 26 | 27 | @implementation RTSpinKitWordPressAnimation 28 | 29 | -(void)setupSpinKitAnimationInLayer:(CALayer*)layer withSize:(CGSize)size color:(UIColor*)color 30 | { 31 | NSTimeInterval beginTime = CACurrentMediaTime(); 32 | 33 | CALayer *spinner = [CALayer layer]; 34 | spinner.frame = CGRectMake(0.0, 0.0, size.width, size.height); 35 | spinner.anchorPoint = CGPointMake(0.5, 0.5); 36 | spinner.transform = CATransform3DIdentity; 37 | spinner.backgroundColor = color.CGColor; 38 | spinner.shouldRasterize = YES; 39 | spinner.rasterizationScale = [[UIScreen mainScreen] scale]; 40 | [layer addSublayer:spinner]; 41 | 42 | CAKeyframeAnimation *spinnerAnim = [CAKeyframeAnimation animationWithKeyPath:@"transform"]; 43 | spinnerAnim.removedOnCompletion = NO; 44 | spinnerAnim.repeatCount = HUGE_VALF; 45 | spinnerAnim.duration = 1.0; 46 | spinnerAnim.beginTime = beginTime; 47 | spinnerAnim.keyTimes = @[@(0.0), @(0.25), @(0.5), @(0.75), @(1.0)]; 48 | 49 | spinnerAnim.timingFunctions = @[ 50 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear], 51 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear], 52 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear], 53 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear], 54 | [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear] 55 | ]; 56 | 57 | spinnerAnim.values = @[ 58 | [NSValue valueWithCATransform3D:CATransform3DMakeRotation(0, 0, 0, 1.0)], 59 | [NSValue valueWithCATransform3D:CATransform3DMakeRotation(M_PI_2, 0, 0, 1.0)], 60 | [NSValue valueWithCATransform3D:CATransform3DMakeRotation(M_PI, 0, 0, 1.0)], 61 | [NSValue valueWithCATransform3D:CATransform3DMakeRotation(3 * M_PI_2, 0, 0, 1.0)], 62 | [NSValue valueWithCATransform3D:CATransform3DMakeRotation(2 * M_PI, 0, 0, 1.0)] 63 | ]; 64 | 65 | [spinner addAnimation:spinnerAnim forKey:@"spinkit-anim"]; 66 | 67 | CAShapeLayer *circleMask = [CAShapeLayer layer]; 68 | circleMask.frame = spinner.bounds; 69 | circleMask.fillColor = [UIColor blackColor].CGColor; 70 | circleMask.anchorPoint = CGPointMake(0.5, 0.5); 71 | 72 | CGMutablePathRef path = CGPathCreateMutable(); 73 | CGPathAddEllipseInRect(path, nil, spinner.frame); 74 | 75 | CGFloat circleSize = size.width * 0.25; 76 | CGPathAddEllipseInRect(path, nil, CGRectMake(CGRectGetMidX(spinner.frame) - circleSize/2, 3.0, circleSize, circleSize)); 77 | CGPathCloseSubpath(path); 78 | circleMask.path = path; 79 | circleMask.fillRule = kCAFillRuleEvenOdd; 80 | CGPathRelease(path); 81 | 82 | spinner.mask = circleMask; 83 | } 84 | 85 | @end 86 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/RTSpinKitAnimating.h: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitAnimating.h 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import 26 | #import 27 | 28 | @protocol RTSpinKitAnimating 29 | -(void)setupSpinKitAnimationInLayer:(CALayer*)layer withSize:(CGSize)size color:(UIColor*)color; 30 | @end -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/RTSpinKitUtils.h: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitUtils.h 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import 26 | #import "RTSpinKitView.h" 27 | #import "RTSpinKitAnimating.h" 28 | 29 | CATransform3D RTSpinKit3DRotationWithPerspective(CGFloat perspective, CGFloat angle, CGFloat x, CGFloat y, CGFloat z); 30 | NSObject* RTSpinKitAnimationFromStyle(RTSpinKitViewStyle style); 31 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/RTSpinKitUtils.m: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitUtils.m 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import "RTSpinKitUtils.h" 26 | 27 | // Animations 28 | #import "RTSpinKit9CubeGridAnimation.h" 29 | #import "RTSpinKitBounceAnimation.h" 30 | #import "RTSpinKitChasingDotsAnimation.h" 31 | #import "RTSpinKitCircleAnimation.h" 32 | #import "RTSpinKitCircleFlipAnimation.h" 33 | #import "RTSpinKitFadingCircleAltAnimation.h" 34 | #import "RTSpinKitFadingCircleAnimation.h" 35 | #import "RTSpinKitPlaneAnimation.h" 36 | #import "RTSpinKitPulseAnimation.h" 37 | #import "RTSpinKitThreeBounceAnimation.h" 38 | #import "RTSpinKitWanderingCubesAnimation.h" 39 | #import "RTSpinKitWaveAnimation.h" 40 | #import "RTSpinKitWordPressAnimation.h" 41 | #import "RTSpinKitArcAnimation.h" 42 | #import "RTSpinKitArcAltAnimation.h" 43 | 44 | CATransform3D RTSpinKit3DRotationWithPerspective(CGFloat perspective, 45 | CGFloat angle, 46 | CGFloat x, 47 | CGFloat y, 48 | CGFloat z) 49 | { 50 | CATransform3D transform = CATransform3DIdentity; 51 | transform.m34 = perspective; 52 | return CATransform3DRotate(transform, angle, x, y, z); 53 | } 54 | 55 | NSObject* RTSpinKitAnimationFromStyle(RTSpinKitViewStyle style) 56 | { 57 | switch (style) { 58 | case RTSpinKitViewStylePlane: 59 | return [[RTSpinKitPlaneAnimation alloc] init]; 60 | 61 | case RTSpinKitViewStyleCircleFlip: 62 | return [[RTSpinKitCircleFlipAnimation alloc] init]; 63 | 64 | case RTSpinKitViewStyleBounce: 65 | return [[RTSpinKitBounceAnimation alloc] init]; 66 | 67 | case RTSpinKitViewStyleWave: 68 | return [[RTSpinKitWaveAnimation alloc] init]; 69 | 70 | case RTSpinKitViewStyleWanderingCubes: 71 | return [[RTSpinKitWanderingCubesAnimation alloc] init]; 72 | 73 | case RTSpinKitViewStylePulse: 74 | return [[RTSpinKitPulseAnimation alloc] init]; 75 | 76 | case RTSpinKitViewStyleChasingDots: 77 | return [[RTSpinKitChasingDotsAnimation alloc] init]; 78 | 79 | case RTSpinKitViewStyleThreeBounce: 80 | return [[RTSpinKitThreeBounceAnimation alloc] init]; 81 | 82 | case RTSpinKitViewStyleCircle: 83 | return [[RTSpinKitCircleAnimation alloc] init]; 84 | 85 | case RTSpinKitViewStyle9CubeGrid: 86 | return [[RTSpinKit9CubeGridAnimation alloc] init]; 87 | 88 | case RTSpinKitViewStyleWordPress: 89 | return [[RTSpinKitWordPressAnimation alloc] init]; 90 | 91 | case RTSpinKitViewStyleFadingCircle: 92 | return [[RTSpinKitFadingCircleAnimation alloc] init]; 93 | 94 | case RTSpinKitViewStyleFadingCircleAlt: 95 | return [[RTSpinKitFadingCircleAltAnimation alloc] init]; 96 | 97 | case RTSpinKitViewStyleArc: 98 | return [[RTSpinKitArcAnimation alloc] init]; 99 | 100 | case RTSpinKitViewStyleArcAlt: 101 | return [[RTSpinKitArcAltAnimation alloc] init]; 102 | 103 | default: 104 | NSCAssert(NO, @"Unicorns exist"); 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/RTSpinKitView.h: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitView.h 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import 26 | 27 | typedef NS_ENUM(NSInteger, RTSpinKitViewStyle) { 28 | RTSpinKitViewStylePlane, 29 | RTSpinKitViewStyleCircleFlip, 30 | RTSpinKitViewStyleBounce, 31 | RTSpinKitViewStyleWave, 32 | RTSpinKitViewStyleWanderingCubes, 33 | RTSpinKitViewStylePulse, 34 | RTSpinKitViewStyleChasingDots, 35 | RTSpinKitViewStyleThreeBounce, 36 | RTSpinKitViewStyleCircle, 37 | RTSpinKitViewStyle9CubeGrid, 38 | RTSpinKitViewStyleWordPress, 39 | RTSpinKitViewStyleFadingCircle, 40 | RTSpinKitViewStyleFadingCircleAlt, 41 | RTSpinKitViewStyleArc, 42 | RTSpinKitViewStyleArcAlt 43 | }; 44 | 45 | /** 46 | The `RTSpinKitView` defines an activity indicator view. It's interface is very similar 47 | to `UIActivityIndicatorView`. 48 | */ 49 | @interface RTSpinKitView : UIView 50 | 51 | /** 52 | The color of the activity indicator. 53 | */ 54 | @property (nonatomic, strong) UIColor *color; 55 | 56 | /** 57 | Whether or not the receiver should be hidden when not animating. 58 | */ 59 | @property (nonatomic, assign) BOOL hidesWhenStopped; 60 | 61 | /** 62 | The style for the activity indicator. 63 | 64 | @see RTSpinKitViewStyle 65 | */ 66 | @property (nonatomic, assign) RTSpinKitViewStyle style; 67 | 68 | /** 69 | The size of the spinner. The view will be automatically resized to fit the activity indicator. 70 | */ 71 | @property (nonatomic, assign) CGFloat spinnerSize; 72 | 73 | @property (nonatomic, assign, getter = isStopped) BOOL stopped; 74 | 75 | /** 76 | Initializes and returns an activity indicator object. 77 | 78 | @param style The style of the activity indicator. 79 | 80 | @return The newly-initialized SpinKit view. 81 | */ 82 | -(instancetype)initWithStyle:(RTSpinKitViewStyle)style; 83 | 84 | /** 85 | Initializes and returns an activity indicator object. 86 | 87 | @param style The style of the activity indicator. 88 | @param color The color of the activity indicator. 89 | 90 | @return The newly-initialized SpinKit view. 91 | */ 92 | -(instancetype)initWithStyle:(RTSpinKitViewStyle)style color:(UIColor*)color; 93 | 94 | /** 95 | Initializes and returns an activity indicator object. 96 | 97 | Designated initializer. 98 | 99 | @param style The style of the activity indicator. 100 | @param color The color of the activity indicator. 101 | @param spinnerSize The size of the spinner. 102 | 103 | @return The newly-initialized SpinKit view. 104 | */ 105 | -(instancetype)initWithStyle:(RTSpinKitViewStyle)style 106 | color:(UIColor*)color 107 | spinnerSize:(CGFloat)spinnerSize; 108 | 109 | /** 110 | Starts the animation of the activity indicator. 111 | */ 112 | -(void)startAnimating; 113 | 114 | /** 115 | Stops the animation of the activity indicator. 116 | */ 117 | -(void)stopAnimating; 118 | 119 | /** 120 | Returns whether the receiver is animating. 121 | 122 | @return `YES` if the receiver is animating, otherwise `NO`. 123 | */ 124 | -(BOOL)isAnimating; 125 | 126 | /** 127 | Sets the color of the spinner. 128 | 129 | @param color The desired color for the spinner. 130 | @param animated Whether or not to animate. 131 | */ 132 | -(void)setColor:(UIColor *)color animated:(BOOL)animated; 133 | 134 | @end 135 | -------------------------------------------------------------------------------- /ios/Libraries/SpinKit/RTSpinKitView.m: -------------------------------------------------------------------------------- 1 | // 2 | // RTSpinKitView.m 3 | // SpinKit 4 | // 5 | // Copyright (c) 2014 Ramon Torres 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 8 | // this software and associated documentation files (the "Software"), to deal in 9 | // the Software without restriction, including without limitation the rights to 10 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 11 | // the Software, and to permit persons to whom the Software is furnished to do so, 12 | // subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in all 15 | // copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 19 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 20 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | // 24 | 25 | #import "RTSpinKitView.h" 26 | #import "RTSpinKitUtils.h" 27 | 28 | #include 29 | 30 | static const CGFloat kRTSpinKitViewDefaultSpinnerSize = 37.0; 31 | 32 | @interface RTSpinKitView () 33 | @end 34 | 35 | @implementation RTSpinKitView 36 | 37 | -(id)initWithCoder:(NSCoder *)aDecoder { 38 | self = [super initWithCoder:aDecoder]; 39 | if (self) { 40 | [self applyAnimation]; 41 | } 42 | 43 | return self; 44 | } 45 | 46 | -(id)initWithFrame:(CGRect)frame { 47 | self = [self initWithStyle:RTSpinKitViewStylePlane]; 48 | if (self) { 49 | self.frame = frame; 50 | } 51 | return self; 52 | } 53 | 54 | -(instancetype)initWithStyle:(RTSpinKitViewStyle)style { 55 | return [self initWithStyle:style color:[UIColor grayColor]]; 56 | } 57 | 58 | -(instancetype)initWithStyle:(RTSpinKitViewStyle)style color:(UIColor *)color { 59 | return [self initWithStyle:style color:color spinnerSize:kRTSpinKitViewDefaultSpinnerSize]; 60 | } 61 | 62 | -(instancetype)initWithStyle:(RTSpinKitViewStyle)style color:(UIColor*)color spinnerSize:(CGFloat)spinnerSize { 63 | self = [super initWithFrame:CGRectMake(0.0, 0.0, spinnerSize, spinnerSize)]; 64 | if (self) { 65 | _style = style; 66 | _color = color; 67 | _spinnerSize = spinnerSize; 68 | _hidesWhenStopped = YES; 69 | [self applyAnimation]; 70 | [self sizeToFit]; 71 | } 72 | return self; 73 | } 74 | 75 | -(void)setStyle:(RTSpinKitViewStyle)style { 76 | _style = style; 77 | [self applyAnimation]; 78 | } 79 | 80 | -(void)setSpinnerSize:(CGFloat)spinnerSize { 81 | _spinnerSize = spinnerSize; 82 | [self applyAnimation]; 83 | [self invalidateIntrinsicContentSize]; 84 | } 85 | 86 | #pragma mark - Animation 87 | 88 | -(void)applyAnimation { 89 | // Remove any sublayer. 90 | self.layer.sublayers = nil; 91 | 92 | CGSize size = CGSizeMake(self.spinnerSize, self.spinnerSize); 93 | NSObject *animation = RTSpinKitAnimationFromStyle(self.style); 94 | [animation setupSpinKitAnimationInLayer:self.layer withSize:size color:self.color]; 95 | } 96 | 97 | #pragma mark - Hooks 98 | 99 | -(void)applicationWillEnterForeground { 100 | if (self.stopped) { 101 | [self pauseLayers]; 102 | } else { 103 | [self resumeLayers]; 104 | } 105 | } 106 | 107 | -(void)applicationDidEnterBackground { 108 | [self pauseLayers]; 109 | } 110 | 111 | -(BOOL)isAnimating { 112 | return !self.isStopped; 113 | } 114 | 115 | -(void)startAnimating { 116 | if (self.isStopped) { 117 | self.hidden = NO; 118 | self.stopped = NO; 119 | [self resumeLayers]; 120 | } 121 | } 122 | 123 | -(void)stopAnimating { 124 | if ([self isAnimating]) { 125 | if (self.hidesWhenStopped) { 126 | self.hidden = YES; 127 | } 128 | 129 | self.stopped = YES; 130 | [self pauseLayers]; 131 | } 132 | } 133 | 134 | -(void)pauseLayers { 135 | CFTimeInterval pausedTime = [self.layer convertTime:CACurrentMediaTime() fromLayer:nil]; 136 | self.layer.speed = 0.0; 137 | self.layer.timeOffset = pausedTime; 138 | } 139 | 140 | -(void)resumeLayers { 141 | CFTimeInterval pausedTime = [self.layer timeOffset]; 142 | self.layer.speed = 1.0; 143 | self.layer.timeOffset = 0.0; 144 | self.layer.beginTime = 0.0; 145 | CFTimeInterval timeSincePause = [self.layer convertTime:CACurrentMediaTime() fromLayer:nil] - pausedTime; 146 | self.layer.beginTime = timeSincePause; 147 | } 148 | 149 | -(CGSize)sizeThatFits:(CGSize)size { 150 | return CGSizeMake(self.spinnerSize, self.spinnerSize); 151 | } 152 | 153 | -(CGSize)intrinsicContentSize { 154 | return CGSizeMake(self.spinnerSize, self.spinnerSize); 155 | } 156 | 157 | -(void)setColor:(UIColor *)color { 158 | [self setColor:color animated:NO]; 159 | } 160 | 161 | -(void)setColor:(UIColor *)color animated:(BOOL)animated { 162 | UIColor *previousColor = _color; 163 | 164 | _color = color; 165 | 166 | if (animated) { 167 | CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"backgroundColor"]; 168 | animation.fromValue = (id)previousColor.CGColor; 169 | animation.toValue = (id)color.CGColor; 170 | animation.duration = 0.5; 171 | animation.removedOnCompletion = YES; 172 | 173 | for (CALayer *l in self.layer.sublayers) { 174 | l.backgroundColor = color.CGColor; 175 | [l addAnimation:animation forKey:@"change-color"]; 176 | } 177 | } else { 178 | for (CALayer *l in self.layer.sublayers) { 179 | l.backgroundColor = color.CGColor; 180 | } 181 | } 182 | } 183 | 184 | -(void)dealloc { 185 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 186 | } 187 | 188 | @end 189 | -------------------------------------------------------------------------------- /ios/RNSpinkit.h: -------------------------------------------------------------------------------- 1 | #import "RTSpinKitView.h" 2 | 3 | @interface RNSpinkit : UIView 4 | 5 | @end -------------------------------------------------------------------------------- /ios/RNSpinkit.m: -------------------------------------------------------------------------------- 1 | #import "RNSpinkit.h" 2 | #import 3 | #import 4 | #import 5 | 6 | @implementation RNSpinkit 7 | { 8 | RTSpinKitView *_spinner; 9 | NSString *_type; 10 | UIColor *_color; 11 | NSNumber *_size; 12 | } 13 | 14 | #pragma mark - Setter 15 | 16 | - (void)setSize:(NSNumber*)size { 17 | _size = size; 18 | if (_spinner) { 19 | _spinner.spinnerSize = [size floatValue]; 20 | } 21 | } 22 | 23 | - (NSNumber*)size { 24 | return _size; 25 | } 26 | 27 | - (void)setType:(NSString*)type 28 | { 29 | _type = type; 30 | if (_spinner) { 31 | RTSpinKitViewStyle style = [self getStyleFromString:_type]; 32 | [_spinner setStyle:style]; 33 | } 34 | } 35 | 36 | - (NSString*)type { 37 | return _type; 38 | } 39 | 40 | - (void)setColor:(NSNumber*)color 41 | { 42 | _color = [RCTConvert UIColor:color]; 43 | if (_spinner) { 44 | [_spinner setColor:_color]; 45 | } 46 | } 47 | 48 | - (UIColor*)color { 49 | return _color; 50 | } 51 | 52 | #pragma mark - Utility 53 | 54 | - (RTSpinKitViewStyle)getStyleFromString:(NSString*)type 55 | { 56 | RTSpinKitViewStyle style = RTSpinKitViewStylePlane; 57 | 58 | if ([type isEqual:@"CircleFlip"]) 59 | style = RTSpinKitViewStyleCircleFlip; 60 | else if ([type isEqual:@"Bounce"]) 61 | style = RTSpinKitViewStyleBounce; 62 | else if ([type isEqual:@"Wave"]) 63 | style = RTSpinKitViewStyleWave; 64 | else if ([type isEqual:@"WanderingCubes"]) 65 | style = RTSpinKitViewStyleWanderingCubes; 66 | else if ([type isEqual:@"Pulse"]) 67 | style = RTSpinKitViewStylePulse; 68 | else if ([type isEqual:@"ChasingDots"]) 69 | style = RTSpinKitViewStyleChasingDots; 70 | else if ([type isEqual:@"ThreeBounce"]) 71 | style = RTSpinKitViewStyleThreeBounce; 72 | else if ([type isEqual:@"Circle"]) 73 | style = RTSpinKitViewStyleCircle; 74 | else if ([type isEqual:@"9CubeGrid"]) 75 | style = RTSpinKitViewStyle9CubeGrid; 76 | else if ([type isEqual:@"WordPress"]) 77 | style = RTSpinKitViewStyleWordPress; 78 | else if ([type isEqual:@"FadingCircle"]) 79 | style = RTSpinKitViewStyleFadingCircle; 80 | else if ([type isEqual:@"FadingCircleAlt"]) 81 | style = RTSpinKitViewStyleFadingCircleAlt; 82 | else if ([type isEqual:@"Arc"]) 83 | style = RTSpinKitViewStyleArc; 84 | else if ([type isEqual:@"ArcAlt"]) 85 | style = RTSpinKitViewStyleArcAlt; 86 | return style; 87 | } 88 | 89 | #pragma mark - React View Management 90 | 91 | - (void)layoutSubviews 92 | { 93 | [super layoutSubviews]; 94 | if (_spinner == nil) { 95 | RTSpinKitViewStyle style = [self getStyleFromString:_type]; 96 | _spinner = [[RTSpinKitView alloc] initWithStyle:style color:_color spinnerSize:[_size floatValue]]; 97 | [self insertSubview:_spinner atIndex:0]; 98 | } 99 | } 100 | 101 | - (void)insertReactSubview:(UIView *)view atIndex:(NSInteger)atIndex 102 | { 103 | [self addSubview:view]; 104 | } 105 | 106 | - (void)removeReactSubview:(UIView *)subview 107 | { 108 | [subview removeFromSuperview]; 109 | } 110 | 111 | - (void)removeFromSuperview 112 | { 113 | [super removeFromSuperview]; 114 | } 115 | 116 | @end 117 | -------------------------------------------------------------------------------- /ios/RNSpinkit.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/RNSpinkit.xcodeproj/project.xcworkspace/xcshareddata/react-native-recorder.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 573765AC-1B6E-46F6-82DC-8636C15D502A 9 | IDESourceControlProjectOriginsDictionary 10 | 11 | 26D894C87E8DCD553D75B4D2D14369ECA0967C2A 12 | https://github.com/rFlex/SCRecorder.git 13 | 14 | IDESourceControlProjectRelativeInstallPathDictionary 15 | 16 | 26D894C87E8DCD553D75B4D2D14369ECA0967C2A 17 | SCRecorder/ 18 | 19 | IDESourceControlProjectURL 20 | https://github.com/rFlex/SCRecorder.git 21 | IDESourceControlProjectVersion 22 | 111 23 | IDESourceControlProjectWCCIdentifier 24 | 26D894C87E8DCD553D75B4D2D14369ECA0967C2A 25 | IDESourceControlProjectWCConfigurations 26 | 27 | 28 | IDESourceControlRepositoryExtensionIdentifierKey 29 | public.vcs.git 30 | IDESourceControlWCCIdentifierKey 31 | 26D894C87E8DCD553D75B4D2D14369ECA0967C2A 32 | IDESourceControlWCCName 33 | SCRecorder 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ios/RNSpinkit.xcodeproj/project.xcworkspace/xcuserdata/blackdivine.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxs15/react-native-spinkit/0abe3d523df94480ae4fddb5a41f133219d9b985/ios/RNSpinkit.xcodeproj/project.xcworkspace/xcuserdata/blackdivine.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /ios/RNSpinkit.xcodeproj/project.xcworkspace/xcuserdata/blackdivine.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges 6 | 7 | SnapshotAutomaticallyBeforeSignificantChanges 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ios/RNSpinkit.xcodeproj/xcuserdata/blackdivine.xcuserdatad/xcschemes/react-native-recorder.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 94 | 100 | 101 | 102 | 103 | 105 | 106 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /ios/RNSpinkit.xcodeproj/xcuserdata/blackdivine.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | react-native-recorder.xcscheme 8 | 9 | orderHint 10 | 1 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | D42CB3501B2538DE00FD0AE2 16 | 17 | primary 18 | 19 | 20 | D42CB35B1B2538DE00FD0AE2 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /ios/RNSpinkit.xcodeproj/xcuserdata/maxs15.xcuserdatad/xcschemes/RNRecorder.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 94 | 100 | 101 | 102 | 103 | 105 | 106 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /ios/RNSpinkit.xcodeproj/xcuserdata/maxs15.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | RNRecorder.xcscheme 8 | 9 | orderHint 10 | 5 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | D42CB3501B2538DE00FD0AE2 16 | 17 | primary 18 | 19 | 20 | D42CB35B1B2538DE00FD0AE2 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /ios/RNSpinkitManager.h: -------------------------------------------------------------------------------- 1 | #ifndef RNSpinkit_RCTViewManager_h 2 | #define RNSpinkit_RCTViewManager_h 3 | 4 | #import 5 | 6 | @interface RNSpinkitManager : RCTViewManager 7 | 8 | @end 9 | 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /ios/RNSpinkitManager.m: -------------------------------------------------------------------------------- 1 | #import "RNSpinkitManager.h" 2 | #import "RNSpinkit.h" 3 | #import 4 | 5 | @implementation RNSpinkitManager 6 | 7 | RCT_EXPORT_MODULE(); 8 | 9 | - (dispatch_queue_t)methodQueue 10 | { 11 | return dispatch_get_main_queue(); 12 | } 13 | 14 | - (UIView *)view 15 | { 16 | return [[RNSpinkit alloc] init]; 17 | } 18 | 19 | RCT_EXPORT_VIEW_PROPERTY(type, NSString); 20 | RCT_EXPORT_VIEW_PROPERTY(size, NSNumber); 21 | RCT_EXPORT_VIEW_PROPERTY(color, NSNumber); 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-spinkit", 3 | "version": "1.5.1", 4 | "description": "A collection of animated loading indicators for React Native", 5 | "main": "index.js", 6 | "keywords": [ 7 | "react-component", 8 | "react-native", 9 | "ios", 10 | "android", 11 | "spinkit", 12 | "spinner", 13 | "loader", 14 | "indicator" 15 | ], 16 | "repository": { 17 | "type": "git", 18 | "url": "git://github.com/maxs15/react-native-spinkit.git" 19 | }, 20 | "author": { 21 | "name": "Max", 22 | "url": "https://github.com/maxs15" 23 | }, 24 | "dependencies": { 25 | "prop-types": "^15.5.8" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /react-native-spinkit.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "react-native-spinkit" 3 | s.version = "1.4.1" 4 | s.license = "MIT" 5 | s.homepage = "https://github.com/maxs15/react-native-spinkit" 6 | s.authors = { 'Max' => '' } 7 | s.summary = "A collection of animated loading indicators. React native port of SpinKit." 8 | s.source = { :git => "https://github.com/maxs15/react-native-spinkit" } 9 | s.source_files = "ios/**/*.{h,m}" 10 | 11 | s.platform = :ios, "7.0" 12 | s.dependency 'React' 13 | end 14 | -------------------------------------------------------------------------------- /react-native.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | commands: [ 3 | { 4 | name: 'prelink', 5 | func: () => { 6 | exec("node ./node_modules/react-native-spinkit/scripts/rnpm-prelink.js"); 7 | }, 8 | }, 9 | ], 10 | }; 11 | -------------------------------------------------------------------------------- /scripts/rnpm-prelink.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | var path = require('path'); 3 | var GRADLE_SCRIPT_PATH = path.join(process.cwd(), 'android', 'build.gradle'); 4 | 5 | // load build.gradle content 6 | try { 7 | var cfg = fs.readFileSync(GRADLE_SCRIPT_PATH); 8 | } catch(err) { 9 | console.log(err.stack); 10 | console.log('Failed to load `android/build.gradle` when linking react-native-spinkit'); 11 | } 12 | 13 | var depStr = String(cfg).match(/allprojects(.|[\r\n])+/); 14 | 15 | if(depStr === null) { 16 | console.log('Could not find `allprojects { }` block in build.gradle'); 17 | } 18 | 19 | // search fro allprojects {...} block 20 | var bracketCount = 0; 21 | var str = depStr[0]; 22 | var replacePos = 0; 23 | for(var i in str) { 24 | if(str[i] === '{') 25 | bracketCount ++; 26 | else if(str[i] === '}'){ 27 | bracketCount --; 28 | // block found 29 | if(bracketCount === 0) { 30 | replacePos = i; 31 | break; 32 | } 33 | } 34 | } 35 | 36 | 37 | // add jitpack repo to `repositories` block 38 | var dep = str.substr(0, replacePos); 39 | 40 | // Chech if the repository already exists 41 | if (String(dep).match(/url[^h]*https\:\/\/jitpack\.io/) === null) { 42 | 43 | dep = String(dep).replace(/repositories[^\{]*\{/, 'repositories {\r\n\t\t\t\t// Add jitpack repository (added by react-native-spinkit)\r\n\t\t\t\tmaven { url "https://jitpack.io" }'); 44 | str = dep + str.substr(replacePos, str.length - replacePos); 45 | 46 | // replace original build script 47 | depStr = String(cfg).replace(/allprojects(.|[\r\n])+/, str); 48 | fs.writeFileSync(GRADLE_SCRIPT_PATH, depStr); 49 | } 50 | --------------------------------------------------------------------------------