diff --git a/.gitignore b/.gitignore index 28ec8f2..b6f03c7 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ gradlew.bat gradle/ *.properties *.iml +npm-debug.log diff --git a/Examples/AnimatedGradient/.flowconfig b/Examples/AnimatedGradient/.flowconfig new file mode 100644 index 0000000..8eadd33 --- /dev/null +++ b/Examples/AnimatedGradient/.flowconfig @@ -0,0 +1,63 @@ +[ignore] + +# We fork some components by platform. +.*/*.web.js +.*/*.android.js + +# Some modules have their own node_modules with overlap +.*/node_modules/node-haste/.* + +# Ugh +.*/node_modules/babel.* +.*/node_modules/babylon.* +.*/node_modules/invariant.* + +# Ignore react and fbjs where there are overlaps, but don't ignore +# anything that react-native relies on +.*/node_modules/fbjs-haste/.*/__tests__/.* +.*/node_modules/fbjs-haste/__forks__/Map.js +.*/node_modules/fbjs-haste/__forks__/Promise.js +.*/node_modules/fbjs-haste/__forks__/fetch.js +.*/node_modules/fbjs-haste/core/ExecutionEnvironment.js +.*/node_modules/fbjs-haste/core/isEmpty.js +.*/node_modules/fbjs-haste/crypto/crc32.js +.*/node_modules/fbjs-haste/stubs/ErrorUtils.js +.*/node_modules/react-haste/React.js +.*/node_modules/react-haste/renderers/dom/ReactDOM.js +.*/node_modules/react-haste/renderers/shared/event/eventPlugins/ResponderEventPlugin.js + +# Ignore commoner tests +.*/node_modules/commoner/test/.* + +# See https://github.com/facebook/flow/issues/442 +.*/react-tools/node_modules/commoner/lib/reader.js + +# Ignore jest +.*/node_modules/jest-cli/.* + +# Ignore Website +.*/website/.* + +[include] + +[libs] +node_modules/react-native/Libraries/react-native/react-native-interface.js + +[options] +module.system=haste + +munge_underscores=true + +module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub' +module.name_mapper='^[./a-zA-Z0-9$_-]+\.png$' -> 'RelativeImageStub' + +suppress_type=$FlowIssue +suppress_type=$FlowFixMe +suppress_type=$FixMe + +suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(1[0-8]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) +suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(1[0-8]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)? #[0-9]+ +suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy + +[version] +0.18.1 diff --git a/Examples/AnimatedGradient/.watchmanconfig b/Examples/AnimatedGradient/.watchmanconfig new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/Examples/AnimatedGradient/.watchmanconfig @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/Examples/AnimatedGradient/AnimatedGradient.xcodeproj/project.pbxproj b/Examples/AnimatedGradient/AnimatedGradient.xcodeproj/project.pbxproj index 12ddd43..49a2a23 100644 --- a/Examples/AnimatedGradient/AnimatedGradient.xcodeproj/project.pbxproj +++ b/Examples/AnimatedGradient/AnimatedGradient.xcodeproj/project.pbxproj @@ -7,8 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 00481BE81AC0C86700671115 /* libRCTWebSocketDebugger.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00481BE61AC0C7FA00671115 /* libRCTWebSocketDebugger.a */; }; - 00481BEA1AC0C89D00671115 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 00481BE91AC0C89D00671115 /* libicucore.dylib */; }; 008F07F31AC5B25A0029DE68 /* main.jsbundle in Resources */ = {isa = PBXBuildFile; fileRef = 008F07F21AC5B25A0029DE68 /* main.jsbundle */; }; 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; }; 00C302E61ABCBA2D00DB3ED1 /* libRCTAdSupport.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302B41ABCB8E700DB3ED1 /* libRCTAdSupport.a */; }; @@ -22,17 +20,11 @@ 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; + 84B328261C16040D00DE4E08 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 84B328251C1603EE00DE4E08 /* libRCTWebSocket.a */; }; BB6109EF1AD326EA00563A76 /* libBVLinearGradient.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BB6109EE1AD326E400563A76 /* libBVLinearGradient.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - 00481BE51AC0C7FA00671115 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00481BDB1AC0C7FA00671115 /* RCTWebSocketDebugger.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 832C81801AAF6DEF007FA2F7; - remoteInfo = RCTWebSocketDebugger; - }; 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; @@ -89,6 +81,13 @@ remoteGlobalIDString = 58B5119B1A9E6C1200147676; remoteInfo = RCTText; }; + 84B328241C1603EE00DE4E08 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 84B328201C1603ED00DE4E08 /* RCTWebSocket.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 3C86DF461ADF2C930047B81A; + remoteInfo = RCTWebSocket; + }; BB6109ED1AD326E400563A76 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = BB6109E91AD326E400563A76 /* BVLinearGradient.xcodeproj */; @@ -99,8 +98,6 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 00481BDB1AC0C7FA00671115 /* RCTWebSocketDebugger.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocketDebugger.xcodeproj; path = "node_modules/react-native/Libraries/RCTWebSocketDebugger/RCTWebSocketDebugger.xcodeproj"; sourceTree = ""; }; - 00481BE91AC0C89D00671115 /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = usr/lib/libicucore.dylib; sourceTree = SDKROOT; }; 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = main.jsbundle; path = iOS/main.jsbundle; sourceTree = ""; }; 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = "node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj"; sourceTree = ""; }; 00C302AF1ABCB8E700DB3ED1 /* RCTAdSupport.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAdSupport.xcodeproj; path = "node_modules/react-native/Libraries/AdSupport/RCTAdSupport.xcodeproj"; sourceTree = ""; }; @@ -117,6 +114,7 @@ 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = iOS/main.m; sourceTree = ""; }; 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "node_modules/react-native/React/React.xcodeproj"; sourceTree = ""; }; 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = ""; }; + 84B328201C1603ED00DE4E08 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = ""; }; BB6109E91AD326E400563A76 /* BVLinearGradient.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = BVLinearGradient.xcodeproj; path = "node_modules/react-native-linear-gradient/BVLinearGradient.xcodeproj"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -125,9 +123,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 00481BEA1AC0C89D00671115 /* libicucore.dylib in Frameworks */, + 84B328261C16040D00DE4E08 /* libRCTWebSocket.a in Frameworks */, 146834051AC3E58100842450 /* libReact.a in Frameworks */, - 00481BE81AC0C86700671115 /* libRCTWebSocketDebugger.a in Frameworks */, 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */, 00C302E61ABCBA2D00DB3ED1 /* libRCTAdSupport.a in Frameworks */, 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */, @@ -142,14 +139,6 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 00481BDC1AC0C7FA00671115 /* Products */ = { - isa = PBXGroup; - children = ( - 00481BE61AC0C7FA00671115 /* libRCTWebSocketDebugger.a */, - ); - name = Products; - sourceTree = ""; - }; 00C302A81ABCB8CE00DB3ED1 /* Products */ = { isa = PBXGroup; children = ( @@ -223,6 +212,7 @@ 832341AE1AAA6A7D00B99B32 /* Libraries */ = { isa = PBXGroup; children = ( + 84B328201C1603ED00DE4E08 /* RCTWebSocket.xcodeproj */, BB6109E91AD326E400563A76 /* BVLinearGradient.xcodeproj */, 146833FF1AC3E56700842450 /* React.xcodeproj */, 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */, @@ -232,8 +222,6 @@ 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */, 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */, 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, - 00481BDB1AC0C7FA00671115 /* RCTWebSocketDebugger.xcodeproj */, - 00481BE91AC0C89D00671115 /* libicucore.dylib */, ); name = Libraries; sourceTree = ""; @@ -265,6 +253,14 @@ name = Products; sourceTree = ""; }; + 84B328211C1603ED00DE4E08 /* Products */ = { + isa = PBXGroup; + children = ( + 84B328251C1603EE00DE4E08 /* libRCTWebSocket.a */, + ); + name = Products; + sourceTree = ""; + }; BB6109EA1AD326E400563A76 /* Products */ = { isa = PBXGroup; children = ( @@ -347,8 +343,8 @@ ProjectRef = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; }, { - ProductGroup = 00481BDC1AC0C7FA00671115 /* Products */; - ProjectRef = 00481BDB1AC0C7FA00671115 /* RCTWebSocketDebugger.xcodeproj */; + ProductGroup = 84B328211C1603ED00DE4E08 /* Products */; + ProjectRef = 84B328201C1603ED00DE4E08 /* RCTWebSocket.xcodeproj */; }, { ProductGroup = 146834001AC3E56700842450 /* Products */; @@ -363,13 +359,6 @@ /* End PBXProject section */ /* Begin PBXReferenceProxy section */ - 00481BE61AC0C7FA00671115 /* libRCTWebSocketDebugger.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTWebSocketDebugger.a; - remoteRef = 00481BE51AC0C7FA00671115 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; @@ -426,6 +415,13 @@ remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + 84B328251C1603EE00DE4E08 /* libRCTWebSocket.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libRCTWebSocket.a; + remoteRef = 84B328241C1603EE00DE4E08 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; BB6109EE1AD326E400563A76 /* libBVLinearGradient.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; diff --git a/Examples/AnimatedGradient/AnimatedGradient.xcodeproj/project.xcworkspace/xcshareddata/AnimatedGradient.xcscmblueprint b/Examples/AnimatedGradient/AnimatedGradient.xcodeproj/project.xcworkspace/xcshareddata/AnimatedGradient.xcscmblueprint new file mode 100644 index 0000000..29931f9 --- /dev/null +++ b/Examples/AnimatedGradient/AnimatedGradient.xcodeproj/project.xcworkspace/xcshareddata/AnimatedGradient.xcscmblueprint @@ -0,0 +1,30 @@ +{ + "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "C854EADF02A501C352F1C31CE594A07F661B2A78", + "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { + + }, + "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { + "16CE14A2D81CCE323D476004724594AEF6B38C0A" : 0, + "C854EADF02A501C352F1C31CE594A07F661B2A78" : 0 + }, + "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "439833FD-A58F-4243-8AD6-E877313B0F6A", + "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { + "16CE14A2D81CCE323D476004724594AEF6B38C0A" : "", + "C854EADF02A501C352F1C31CE594A07F661B2A78" : "react-native-linear-gradient" + }, + "DVTSourceControlWorkspaceBlueprintNameKey" : "AnimatedGradient", + "DVTSourceControlWorkspaceBlueprintVersion" : 204, + "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "Examples\/AnimatedGradient\/AnimatedGradient.xcodeproj", + "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ + { + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:exponentjs\/react-native.git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "16CE14A2D81CCE323D476004724594AEF6B38C0A" + }, + { + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:brentvatne\/react-native-linear-gradient.git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", + "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "C854EADF02A501C352F1C31CE594A07F661B2A78" + } + ] +} \ No newline at end of file diff --git a/Examples/AnimatedGradient/AnimatedGradient.xcodeproj/project.xcworkspace/xcuserdata/brent.xcuserdatad/UserInterfaceState.xcuserstate b/Examples/AnimatedGradient/AnimatedGradient.xcodeproj/project.xcworkspace/xcuserdata/brent.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..ffc02fe Binary files /dev/null and b/Examples/AnimatedGradient/AnimatedGradient.xcodeproj/project.xcworkspace/xcuserdata/brent.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Examples/AnimatedGradient/AnimatedGradient.xcodeproj/xcuserdata/brent.xcuserdatad/xcschemes/xcschememanagement.plist b/Examples/AnimatedGradient/AnimatedGradient.xcodeproj/xcuserdata/brent.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..c69a54d --- /dev/null +++ b/Examples/AnimatedGradient/AnimatedGradient.xcodeproj/xcuserdata/brent.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + AnimatedGradient.xcscheme_^#shared#^_ + + orderHint + 0 + + + SuppressBuildableAutocreation + + 13B07F861A680F5B00A75B9A + + primary + + + + + diff --git a/Examples/AnimatedGradient/android/app/build.gradle b/Examples/AnimatedGradient/android/app/build.gradle new file mode 100644 index 0000000..0ca9bf4 --- /dev/null +++ b/Examples/AnimatedGradient/android/app/build.gradle @@ -0,0 +1,79 @@ +apply plugin: "com.android.application" + +/** + * The react.gradle file registers two tasks: bundleDebugJsAndAssets and bundleReleaseJsAndAssets. + * These basically call `react-native bundle` with the correct arguments during the Android build + * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the + * bundle directly from the development server. Below you can see all the possible configurations + * and their defaults. If you decide to add a configuration block, make sure to add it before the + * `apply from: "react.gradle"` line. + * + * project.ext.react = [ + * // the name of the generated asset file containing your JS bundle + * bundleAssetName: "index.android.bundle", + * + * // the entry file for bundle generation + * entryFile: "index.android.js", + * + * // whether to bundle JS and assets in debug mode + * bundleInDebug: false, + * + * // whether to bundle JS and assets in release mode + * bundleInRelease: true, + * + * // the root of your project, i.e. where "package.json" lives + * root: "../../", + * + * // where to put the JS bundle asset in debug mode + * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", + * + * // where to put the JS bundle asset in release mode + * jsBundleDirRelease: "$buildDir/intermediates/assets/release", + * + * // where to put drawable resources / React Native assets, e.g. the ones you use via + * // require('./image.png')), in debug mode + * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", + * + * // where to put drawable resources / React Native assets, e.g. the ones you use via + * // require('./image.png')), in release mode + * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", + * + * // by default the gradle tasks are skipped if none of the JS files or assets change; this means + * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to + * // date; if you have any other folders that you want to ignore for performance reasons (gradle + * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ + * // for example, you might want to remove it from here. + * inputExcludes: ["android/**", "ios/**"] + * ] + */ + +apply from: "react.gradle" + +android { + compileSdkVersion 23 + buildToolsVersion "23.0.1" + + defaultConfig { + applicationId "com.animatedgradient" + minSdkVersion 16 + targetSdkVersion 22 + versionCode 1 + versionName "1.0" + ndk { + abiFilters "armeabi-v7a", "x86" + } + } + buildTypes { + release { + minifyEnabled false // Set this to true to enable Proguard + proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" + } + } +} + +dependencies { + compile fileTree(dir: "libs", include: ["*.jar"]) + compile "com.android.support:appcompat-v7:23.0.1" + compile "com.facebook.react:react-native:0.16.+" + compile project(':react-native-linear-gradient') +} diff --git a/Examples/AnimatedGradient/android/app/proguard-rules.pro b/Examples/AnimatedGradient/android/app/proguard-rules.pro new file mode 100644 index 0000000..ffa8c9f --- /dev/null +++ b/Examples/AnimatedGradient/android/app/proguard-rules.pro @@ -0,0 +1,60 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Disabling obfuscation is useful if you collect stack traces from production crashes +# (unless you are using a system that supports de-obfuscate the stack traces). +-dontobfuscate + +# React Native + +# Keep our interfaces so they can be used by other ProGuard rules. +# See http://sourceforge.net/p/proguard/bugs/466/ +-keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip +-keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters + +# Do not strip any method/class that is annotated with @DoNotStrip +-keep @com.facebook.proguard.annotations.DoNotStrip class * +-keepclassmembers class * { + @com.facebook.proguard.annotations.DoNotStrip *; +} + +-keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * { + void set*(***); + *** get*(); +} + +-keep class * extends com.facebook.react.bridge.JavaScriptModule { *; } +-keep class * extends com.facebook.react.bridge.NativeModule { *; } +-keepclassmembers class * { @com.facebook.react.uimanager.UIProp ; } +-keepclassmembers class * { @com.facebook.react.uimanager.ReactProp ; } +-keepclassmembers class * { @com.facebook.react.uimanager.ReactPropGroup ; } + +# okhttp + +-keepattributes Signature +-keepattributes *Annotation* +-keep class com.squareup.okhttp.** { *; } +-keep interface com.squareup.okhttp.** { *; } +-dontwarn com.squareup.okhttp.** + +# okio + +-keep class sun.misc.Unsafe { *; } +-dontwarn java.nio.file.* +-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement +-dontwarn okio.** diff --git a/Examples/AnimatedGradient/android/app/react.gradle b/Examples/AnimatedGradient/android/app/react.gradle new file mode 100644 index 0000000..1e08b00 --- /dev/null +++ b/Examples/AnimatedGradient/android/app/react.gradle @@ -0,0 +1,87 @@ +import org.apache.tools.ant.taskdefs.condition.Os + +def config = project.hasProperty("react") ? project.react : []; + +def bundleAssetName = config.bundleAssetName ?: "index.android.bundle" +def entryFile = config.entryFile ?: "index.android.js" + +// because elvis operator +def elvisFile(thing) { + return thing ? file(thing) : null; +} + +def reactRoot = elvisFile(config.root) ?: file("../../") +def jsBundleDirDebug = elvisFile(config.jsBundleDirDebug) ?: + file("$buildDir/intermediates/assets/debug") +def jsBundleDirRelease = elvisFile(config.jsBundleDirRelease) ?: + file("$buildDir/intermediates/assets/release") +def resourcesDirDebug = elvisFile(config.resourcesDirDebug) ?: + file("$buildDir/intermediates/res/merged/debug") +def resourcesDirRelease = elvisFile(config.resourcesDirRelease) ?: + file("$buildDir/intermediates/res/merged/release") +def inputExcludes = config.inputExcludes ?: ["android/**", "ios/**"] + +def jsBundleFileDebug = file("$jsBundleDirDebug/$bundleAssetName") +def jsBundleFileRelease = file("$jsBundleDirRelease/$bundleAssetName") + +task bundleDebugJsAndAssets(type: Exec) { + // create dirs if they are not there (e.g. the "clean" task just ran) + doFirst { + jsBundleDirDebug.mkdirs() + resourcesDirDebug.mkdirs() + } + + // set up inputs and outputs so gradle can cache the result + inputs.files fileTree(dir: reactRoot, excludes: inputExcludes) + outputs.dir jsBundleDirDebug + outputs.dir resourcesDirDebug + + // set up the call to the react-native cli + workingDir reactRoot + if (Os.isFamily(Os.FAMILY_WINDOWS)) { + commandLine "cmd", "/c", "react-native", "bundle", "--platform", "android", "--dev", "true", "--entry-file", + entryFile, "--bundle-output", jsBundleFileDebug, "--assets-dest", resourcesDirDebug + } else { + commandLine "react-native", "bundle", "--platform", "android", "--dev", "true", "--entry-file", + entryFile, "--bundle-output", jsBundleFileDebug, "--assets-dest", resourcesDirDebug + } + + enabled config.bundleInDebug ?: false +} + +task bundleReleaseJsAndAssets(type: Exec) { + // create dirs if they are not there (e.g. the "clean" task just ran) + doFirst { + jsBundleDirRelease.mkdirs() + resourcesDirRelease.mkdirs() + } + + // set up inputs and outputs so gradle can cache the result + inputs.files fileTree(dir: reactRoot, excludes: inputExcludes) + outputs.dir jsBundleDirRelease + outputs.dir resourcesDirRelease + + // set up the call to the react-native cli + workingDir reactRoot + if (Os.isFamily(Os.FAMILY_WINDOWS)) { + commandLine "cmd","/c", "react-native", "bundle", "--platform", "android", "--dev", "false", "--entry-file", + entryFile, "--bundle-output", jsBundleFileRelease, "--assets-dest", resourcesDirRelease + } else { + commandLine "react-native", "bundle", "--platform", "android", "--dev", "false", "--entry-file", + entryFile, "--bundle-output", jsBundleFileRelease, "--assets-dest", resourcesDirRelease + } + + enabled config.bundleInRelease ?: true +} + +gradle.projectsEvaluated { + // hook bundleDebugJsAndAssets into the android build process + bundleDebugJsAndAssets.dependsOn mergeDebugResources + bundleDebugJsAndAssets.dependsOn mergeDebugAssets + processDebugResources.dependsOn bundleDebugJsAndAssets + + // hook bundleReleaseJsAndAssets into the android build process + bundleReleaseJsAndAssets.dependsOn mergeReleaseResources + bundleReleaseJsAndAssets.dependsOn mergeReleaseAssets + processReleaseResources.dependsOn bundleReleaseJsAndAssets +} diff --git a/Examples/AnimatedGradient/android/app/src/main/AndroidManifest.xml b/Examples/AnimatedGradient/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..645a381 --- /dev/null +++ b/Examples/AnimatedGradient/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + diff --git a/Examples/AnimatedGradient/android/app/src/main/java/com/animatedgradient/MainActivity.java b/Examples/AnimatedGradient/android/app/src/main/java/com/animatedgradient/MainActivity.java new file mode 100644 index 0000000..757ec2e --- /dev/null +++ b/Examples/AnimatedGradient/android/app/src/main/java/com/animatedgradient/MainActivity.java @@ -0,0 +1,81 @@ +package com.animatedgradient; + +import android.app.Activity; +import android.os.Bundle; +import android.view.KeyEvent; + +import com.BV.LinearGradient.LinearGradientPackage; + +import com.facebook.react.LifecycleState; +import com.facebook.react.ReactInstanceManager; +import com.facebook.react.ReactRootView; +import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler; +import com.facebook.react.shell.MainReactPackage; +import com.facebook.soloader.SoLoader; + +public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler { + + private ReactInstanceManager mReactInstanceManager; + private ReactRootView mReactRootView; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + mReactRootView = new ReactRootView(this); + + mReactInstanceManager = ReactInstanceManager.builder() + .setApplication(getApplication()) + .setBundleAssetName("index.android.bundle") + .setJSMainModuleName("index.android") + .addPackage(new MainReactPackage()) + .addPackage(new LinearGradientPackage()) + .setUseDeveloperSupport(BuildConfig.DEBUG) + .setInitialLifecycleState(LifecycleState.RESUMED) + .build(); + + mReactRootView.startReactApplication(mReactInstanceManager, "AnimatedGradient", null); + + setContentView(mReactRootView); + } + + @Override + public boolean onKeyUp(int keyCode, KeyEvent event) { + if (keyCode == KeyEvent.KEYCODE_MENU && mReactInstanceManager != null) { + mReactInstanceManager.showDevOptionsDialog(); + return true; + } + return super.onKeyUp(keyCode, event); + } + + @Override + public void onBackPressed() { + if (mReactInstanceManager != null) { + mReactInstanceManager.onBackPressed(); + } else { + super.onBackPressed(); + } + } + + @Override + public void invokeDefaultOnBackPressed() { + super.onBackPressed(); + } + + @Override + protected void onPause() { + super.onPause(); + + if (mReactInstanceManager != null) { + mReactInstanceManager.onPause(); + } + } + + @Override + protected void onResume() { + super.onResume(); + + if (mReactInstanceManager != null) { + mReactInstanceManager.onResume(this, this); + } + } +} diff --git a/Examples/AnimatedGradient/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/Examples/AnimatedGradient/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..cde69bc Binary files /dev/null and b/Examples/AnimatedGradient/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/Examples/AnimatedGradient/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/Examples/AnimatedGradient/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..c133a0c Binary files /dev/null and b/Examples/AnimatedGradient/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/Examples/AnimatedGradient/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/Examples/AnimatedGradient/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..bfa42f0 Binary files /dev/null and b/Examples/AnimatedGradient/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/Examples/AnimatedGradient/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/Examples/AnimatedGradient/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..324e72c Binary files /dev/null and b/Examples/AnimatedGradient/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/Examples/AnimatedGradient/android/app/src/main/res/values/strings.xml b/Examples/AnimatedGradient/android/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..b092214 --- /dev/null +++ b/Examples/AnimatedGradient/android/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + AnimatedGradient + diff --git a/Examples/AnimatedGradient/android/app/src/main/res/values/styles.xml b/Examples/AnimatedGradient/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..319eb0c --- /dev/null +++ b/Examples/AnimatedGradient/android/app/src/main/res/values/styles.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/Examples/AnimatedGradient/android/build.gradle b/Examples/AnimatedGradient/android/build.gradle new file mode 100644 index 0000000..bdb0fcc --- /dev/null +++ b/Examples/AnimatedGradient/android/build.gradle @@ -0,0 +1,23 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.3.1' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + mavenLocal() + jcenter() + jcenter { + url "http://dl.bintray.com/mkonicek/maven" + } + } +} diff --git a/Examples/AnimatedGradient/android/settings.gradle b/Examples/AnimatedGradient/android/settings.gradle new file mode 100644 index 0000000..bb0ddd2 --- /dev/null +++ b/Examples/AnimatedGradient/android/settings.gradle @@ -0,0 +1,6 @@ +rootProject.name = 'AnimatedGradient' + +include ':app' + +include ':app', ':react-native-linear-gradient' +project(':react-native-linear-gradient').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-linear-gradient/android') diff --git a/Examples/AnimatedGradient/iOS/AppDelegate.m b/Examples/AnimatedGradient/iOS/AppDelegate.m index 03b5ba3..c4e15da 100644 --- a/Examples/AnimatedGradient/iOS/AppDelegate.m +++ b/Examples/AnimatedGradient/iOS/AppDelegate.m @@ -26,7 +26,7 @@ // // To run on device, change `localhost` to the IP address of your computer, and make sure your computer and // iOS device are on the same Wi-Fi network. - jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle"]; + jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"]; // OPTION 2 // Load from pre-bundled file on disk. To re-generate the static bundle, run @@ -38,6 +38,7 @@ RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation moduleName:@"AnimatedGradient" + initialProperties:nil launchOptions:launchOptions]; self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; diff --git a/Examples/AnimatedGradient/iOS/Info.plist b/Examples/AnimatedGradient/iOS/Info.plist index c6d2494..dcc5a33 100644 --- a/Examples/AnimatedGradient/iOS/Info.plist +++ b/Examples/AnimatedGradient/iOS/Info.plist @@ -22,6 +22,11 @@ 1 LSRequiresIPhoneOS + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + UILaunchStoryboardName LaunchScreen UIRequiredDeviceCapabilities diff --git a/Examples/AnimatedGradient/index.android.js b/Examples/AnimatedGradient/index.android.js new file mode 100644 index 0000000..6b0cc50 --- /dev/null +++ b/Examples/AnimatedGradient/index.android.js @@ -0,0 +1,63 @@ +'use strict'; + +var React = require('react-native'); +var { + AppRegistry, + StyleSheet, + Text, + View, +} = React; + +var TimerMixin = require('react-timer-mixin'); +var LinearGradient = require('react-native-linear-gradient'); +var incrementColor = require('./incrementColor'); + +var AnimatedGradient = React.createClass({ + mixins: [TimerMixin], + + getInitialState: function() { + return { + count: 0, + colorTop: '#000000', + colorBottom: '#cccccc', + } + }, + + componentDidMount: function() { + this.setInterval(() => { + this.setState({ + count: this.state.count + 1, + colorTop: incrementColor(this.state.colorTop, 1), + colorBottom: incrementColor(this.state.colorBottom, -1), + }); + }, 20); + }, + + render: function() { + return ( + + + + {this.state.colorTop} + {this.state.colorBottom} + + ); + } +}); + +var styles = StyleSheet.create({ + container: { + flex: 1, + justifyContent: 'center', + alignItems: 'center', + backgroundColor: '#F5FCFF', + }, + gradient: { + width: 200, + height: 200, + }, +}); + +AppRegistry.registerComponent('AnimatedGradient', () => AnimatedGradient); diff --git a/Examples/AnimatedGradient/index.ios.js b/Examples/AnimatedGradient/index.ios.js index 7238338..6b0cc50 100644 --- a/Examples/AnimatedGradient/index.ios.js +++ b/Examples/AnimatedGradient/index.ios.js @@ -24,12 +24,11 @@ var AnimatedGradient = React.createClass({ }, componentDidMount: function() { - var self = this; - this.setInterval(function() { - self.setState({ - count: self.state.count + 1, - colorTop: incrementColor(self.state.colorTop, 1), - colorBottom: incrementColor(self.state.colorBottom, -1), + this.setInterval(() => { + this.setState({ + count: this.state.count + 1, + colorTop: incrementColor(this.state.colorTop, 1), + colorBottom: incrementColor(this.state.colorBottom, -1), }); }, 20); }, diff --git a/Examples/AnimatedGradient/package.json b/Examples/AnimatedGradient/package.json index 408ece6..f7d0d2e 100644 --- a/Examples/AnimatedGradient/package.json +++ b/Examples/AnimatedGradient/package.json @@ -6,7 +6,8 @@ "start": "node_modules/react-native/packager/packager.sh" }, "dependencies": { - "react-native": "^0.3.10", - "react-native-linear-gradient": "^0.1.7" + "react-native": "0.16.0", + "react-native-linear-gradient": "../../", + "react-timer-mixin": "^0.13.3" } } diff --git a/index.android.js b/index.android.js index 26b458c..08174c9 100644 --- a/index.android.js +++ b/index.android.js @@ -7,7 +7,8 @@ var LinearGradient = React.createClass({ start: PropTypes.array, end: PropTypes.array, colors: PropTypes.array.isRequired, - locations: PropTypes.array + locations: PropTypes.array, + ...View.propTypes, }, render: function() { diff --git a/index.ios.js b/index.ios.js index 7cd1cf6..254a97f 100644 --- a/index.ios.js +++ b/index.ios.js @@ -6,10 +6,14 @@ 'use strict'; var React = require('react-native'); -var { requireNativeComponent, processColor } = React; +var { requireNativeComponent, processColor, View } = React; var NativeLinearGradient = requireNativeComponent('BVLinearGradient', null); var LinearGradient = React.createClass({ + propTypes: { + ...View.propTypes, + }, + render: function() { var { colors, ...otherProps } = this.props; return (