mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-05-27 04:32:57 +00:00
remove unused vars
This commit is contained in:
+40
-1
@@ -1,2 +1,41 @@
|
||||
node_modules/
|
||||
# OSX
|
||||
#
|
||||
.DS_Store
|
||||
|
||||
# Xcode
|
||||
#
|
||||
build/
|
||||
*.pbxuser
|
||||
!default.pbxuser
|
||||
*.mode1v3
|
||||
!default.mode1v3
|
||||
*.mode2v3
|
||||
!default.mode2v3
|
||||
*.perspectivev3
|
||||
!default.perspectivev3
|
||||
xcuserdata
|
||||
*.xccheckout
|
||||
*.moved-aside
|
||||
DerivedData
|
||||
*.hmap
|
||||
*.ipa
|
||||
project.xcworkspace
|
||||
|
||||
# Android/IJ
|
||||
#
|
||||
.idea/
|
||||
.gradle
|
||||
local.properties
|
||||
|
||||
# node.js
|
||||
#
|
||||
node_modules/
|
||||
npm-debug.log
|
||||
|
||||
|
||||
# webstorm
|
||||
#
|
||||
android/app/src/main/assets/index.android.bundle
|
||||
ios/marry/assets
|
||||
ios/marry/main.jsbundle
|
||||
*.iml
|
||||
|
||||
@@ -3,7 +3,8 @@ apply plugin: "com.android.application"
|
||||
import com.android.build.OutputFile
|
||||
|
||||
/**
|
||||
* The react.gradle file registers two tasks: bundleDebugJsAndAssets and bundleReleaseJsAndAssets.
|
||||
* The react.gradle file registers a task for each build variant (e.g. 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
|
||||
@@ -23,6 +24,13 @@ import com.android.build.OutputFile
|
||||
* // whether to bundle JS and assets in release mode
|
||||
* bundleInRelease: true,
|
||||
*
|
||||
* // whether to bundle JS and assets in another build variant (if configured).
|
||||
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
|
||||
* // The configuration property is in the format 'bundleIn${productFlavor}${buildType}'
|
||||
* // bundleInFreeDebug: true,
|
||||
* // bundleInPaidRelease: true,
|
||||
* // bundleInBeta: true,
|
||||
*
|
||||
* // the root of your project, i.e. where "package.json" lives
|
||||
* root: "../../",
|
||||
*
|
||||
@@ -84,7 +92,7 @@ android {
|
||||
splits {
|
||||
abi {
|
||||
enable enableSeparateBuildPerCPUArchitecture
|
||||
universalApk true
|
||||
universalApk false
|
||||
reset()
|
||||
include "armeabi-v7a", "x86"
|
||||
}
|
||||
@@ -113,5 +121,5 @@ android {
|
||||
dependencies {
|
||||
compile fileTree(dir: "libs", include: ["*.jar"])
|
||||
compile "com.android.support:appcompat-v7:23.0.1"
|
||||
compile "com.facebook.react:react-native:0.18.+"
|
||||
compile "com.facebook.react:react-native:0.20.+"
|
||||
}
|
||||
|
||||
+2
-2
@@ -42,8 +42,8 @@
|
||||
-keep class * extends com.facebook.react.bridge.NativeModule { *; }
|
||||
-keepclassmembers,includedescriptorclasses class * { native <methods>; }
|
||||
-keepclassmembers class * { @com.facebook.react.uimanager.UIProp <fields>; }
|
||||
-keepclassmembers class * { @com.facebook.react.uimanager.ReactProp <methods>; }
|
||||
-keepclassmembers class * { @com.facebook.react.uimanager.ReactPropGroup <methods>; }
|
||||
-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp <methods>; }
|
||||
-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup <methods>; }
|
||||
|
||||
-dontwarn com.facebook.react.**
|
||||
|
||||
|
||||
@@ -11,69 +11,8 @@ def elvisFile(thing) {
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
void runBefore(String dependentTaskName, Task task) {
|
||||
Task dependentTask = tasks.findByPath(dependentTaskName);
|
||||
if (dependentTask != null) {
|
||||
@@ -82,25 +21,76 @@ void runBefore(String dependentTaskName, Task task) {
|
||||
}
|
||||
|
||||
gradle.projectsEvaluated {
|
||||
// Grab all build types and product flavors
|
||||
def buildTypes = android.buildTypes.collect { type -> type.name }
|
||||
def productFlavors = android.productFlavors.collect { flavor -> flavor.name }
|
||||
|
||||
// hook bundleDebugJsAndAssets into the android build process
|
||||
// When no product flavors defined, use empty
|
||||
if (!productFlavors) productFlavors.add('')
|
||||
|
||||
bundleDebugJsAndAssets.dependsOn mergeDebugResources
|
||||
bundleDebugJsAndAssets.dependsOn mergeDebugAssets
|
||||
productFlavors.each { productFlavorName ->
|
||||
buildTypes.each { buildTypeName ->
|
||||
// Create variant and source names
|
||||
def sourceName = "${buildTypeName}"
|
||||
def targetName = "${sourceName.capitalize()}"
|
||||
if (productFlavorName) {
|
||||
sourceName = "${productFlavorName}${targetName}"
|
||||
}
|
||||
|
||||
runBefore('processArmeabi-v7aDebugResources', bundleDebugJsAndAssets)
|
||||
runBefore('processX86DebugResources', bundleDebugJsAndAssets)
|
||||
runBefore('processUniversalDebugResources', bundleDebugJsAndAssets)
|
||||
runBefore('processDebugResources', bundleDebugJsAndAssets)
|
||||
// React js bundle directories
|
||||
def jsBundleDirConfigName = "jsBundleDir${targetName}"
|
||||
def jsBundleDir = elvisFile(config."$jsBundleDirConfigName") ?:
|
||||
file("$buildDir/intermediates/assets/${sourceName}")
|
||||
|
||||
// hook bundleReleaseJsAndAssets into the android build process
|
||||
def resourcesDirConfigName = "jsBundleDir${targetName}"
|
||||
def resourcesDir = elvisFile(config."${resourcesDirConfigName}") ?:
|
||||
file("$buildDir/intermediates/res/merged/${sourceName}")
|
||||
def jsBundleFile = file("$jsBundleDir/$bundleAssetName")
|
||||
|
||||
bundleReleaseJsAndAssets.dependsOn mergeReleaseResources
|
||||
bundleReleaseJsAndAssets.dependsOn mergeReleaseAssets
|
||||
// Bundle task name for variant
|
||||
def bundleJsAndAssetsTaskName = "bundle${targetName}JsAndAssets"
|
||||
|
||||
runBefore('processArmeabi-v7aReleaseResources', bundleReleaseJsAndAssets)
|
||||
runBefore('processX86ReleaseResources', bundleReleaseJsAndAssets)
|
||||
runBefore('processUniversalReleaseResources', bundleReleaseJsAndAssets)
|
||||
runBefore('processReleaseResources', bundleReleaseJsAndAssets)
|
||||
def currentBundleTask = tasks.create(
|
||||
name: bundleJsAndAssetsTaskName,
|
||||
type: Exec) {
|
||||
group = "react"
|
||||
description = "bundle JS and assets for ${targetName}."
|
||||
|
||||
// Create dirs if they are not there (e.g. the "clean" task just ran)
|
||||
doFirst {
|
||||
jsBundleDir.mkdirs()
|
||||
resourcesDir.mkdirs()
|
||||
}
|
||||
|
||||
// Set up inputs and outputs so gradle can cache the result
|
||||
inputs.files fileTree(dir: reactRoot, excludes: inputExcludes)
|
||||
outputs.dir jsBundleDir
|
||||
outputs.dir resourcesDir
|
||||
|
||||
// Set up the call to the react-native cli
|
||||
workingDir reactRoot
|
||||
|
||||
// Set up dev mode
|
||||
def devEnabled = !targetName.toLowerCase().contains("release")
|
||||
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
||||
commandLine "cmd", "/c", "react-native", "bundle", "--platform", "android", "--dev", "${devEnabled}",
|
||||
"--entry-file", entryFile, "--bundle-output", jsBundleFile, "--assets-dest", resourcesDir
|
||||
} else {
|
||||
commandLine "react-native", "bundle", "--platform", "android", "--dev", "${devEnabled}",
|
||||
"--entry-file", entryFile, "--bundle-output", jsBundleFile, "--assets-dest", resourcesDir
|
||||
}
|
||||
|
||||
enabled config."bundleIn${targetName}" ?: targetName.toLowerCase().contains("release")
|
||||
}
|
||||
|
||||
// Hook bundle${productFlavor}${buildType}JsAndAssets into the android build process
|
||||
currentBundleTask.dependsOn("merge${targetName}Resources")
|
||||
currentBundleTask.dependsOn("merge${targetName}Assets")
|
||||
|
||||
runBefore("processArmeabi-v7a${targetName}Resources", currentBundleTask)
|
||||
runBefore("processX86${targetName}Resources", currentBundleTask)
|
||||
runBefore("processUniversal${targetName}Resources", currentBundleTask)
|
||||
runBefore("process${targetName}Resources", currentBundleTask)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ public class MainActivity extends ReactActivity {
|
||||
@Override
|
||||
protected List<ReactPackage> getPackages() {
|
||||
return Arrays.<ReactPackage>asList(
|
||||
new MainReactPackage());
|
||||
new MainReactPackage()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import Svg, {
|
||||
|
||||
class LineExample extends Component{
|
||||
static title = 'Line';
|
||||
|
||||
render() {
|
||||
return <Svg
|
||||
height="100"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"react-native": "^0.18.1",
|
||||
"react-native-art-svg": "^1.0.8",
|
||||
"react-native-art-svg": "../",
|
||||
"react-native-root-modal": "^1.0.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -572,6 +572,8 @@ npm install
|
||||
3. textPath ([wait for official supports](https://github.com/facebook/react-native/blob/master/Libraries/ART/ARTText.m#L56))
|
||||
4. pattern ([wait for official supports](https://github.com/facebook/react-native/blob/master/Libraries/ART/ReactNativeART.js#L332))
|
||||
5. [animations](https://github.com/gorangajic/react-svg-morph)
|
||||
6. isolated from ART\`s dependency
|
||||
|
||||
|
||||
#### Thanks:
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ import React, {
|
||||
PropTypes
|
||||
} from 'react-native';
|
||||
import Ellipse from './Ellipse';
|
||||
import strokeFilter from '../lib/strokeFilter';
|
||||
let propType = PropTypes.oneOfType([PropTypes.string, PropTypes.number]);
|
||||
class Circle extends Component{
|
||||
static displayName = 'Circle';
|
||||
|
||||
+2
-5
@@ -1,10 +1,9 @@
|
||||
import React, {
|
||||
Component,
|
||||
PropTypes,
|
||||
ART
|
||||
PropTypes
|
||||
} from 'react-native';
|
||||
import Path from './Path';
|
||||
|
||||
import strokeFilter from '../lib/strokeFilter';
|
||||
let propType = PropTypes.oneOfType([PropTypes.string, PropTypes.number]);
|
||||
class Ellipse extends Component{
|
||||
static displayName = 'Ellipse';
|
||||
@@ -25,8 +24,6 @@ class Ellipse extends Component{
|
||||
`;
|
||||
return <Path
|
||||
{...props}
|
||||
strokeCap={null}
|
||||
strokeJoin={null}
|
||||
cx={null}
|
||||
cy={null}
|
||||
rx={null}
|
||||
|
||||
+28
-7
@@ -1,15 +1,18 @@
|
||||
import React, {
|
||||
Component,
|
||||
PropTypes,
|
||||
ReactNativeBaseComponent,
|
||||
ART
|
||||
} from 'react-native';
|
||||
|
||||
let {
|
||||
Shape,
|
||||
} = ART;
|
||||
Path
|
||||
} = ART;
|
||||
|
||||
import strokeFilter from '../lib/strokeFilter';
|
||||
import transformFilter from '../lib/transformFilter';
|
||||
let propType = PropTypes.oneOfType([PropTypes.string, PropTypes.number]);
|
||||
|
||||
class Line extends Component{
|
||||
static displayName = 'Line';
|
||||
static propTypes = {
|
||||
@@ -20,18 +23,36 @@ class Line extends Component{
|
||||
strokeLinecap: PropTypes.oneOf(['butt', 'square', 'round']),
|
||||
strokeCap: PropTypes.oneOf(['butt', 'square', 'round'])
|
||||
};
|
||||
render() {
|
||||
let {props} = this;
|
||||
let d = `M${props.x1},${props.y1}L${props.x2},${props.y2}Z`;
|
||||
|
||||
|
||||
_convertPath = (props = this.props) => {
|
||||
return `M${props.x1},${props.y1}L${props.x2},${props.y2}Z`;
|
||||
};
|
||||
|
||||
setNativeProps = (props) => {
|
||||
let nativeProps = {};
|
||||
if (props.x1 || props.x2 || props.y1 || props.y2) {
|
||||
let path = this._convertPath(Object.assign({}, this.props, props));
|
||||
nativeProps.d = new Path(path).toJSON();
|
||||
} else if (props.strokeLinecap || props.strokeCap) {
|
||||
// TODO:
|
||||
}
|
||||
|
||||
this.refs.shape.setNativeProps(nativeProps);
|
||||
};
|
||||
|
||||
render() {
|
||||
return <Shape
|
||||
{...props}
|
||||
{...this.props}
|
||||
ref="shape"
|
||||
{...strokeFilter(this.props)}
|
||||
{...transformFilter(this.props)}
|
||||
x1={null}
|
||||
y1={null}
|
||||
x2={null}
|
||||
y2={null}
|
||||
fill={null}
|
||||
d={d}
|
||||
d={this._convertPath()}
|
||||
/>;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-5
@@ -1,11 +1,7 @@
|
||||
import React, {
|
||||
Component,
|
||||
PropTypes,
|
||||
ART
|
||||
PropTypes
|
||||
} from 'react-native';
|
||||
let {
|
||||
Group
|
||||
} = ART;
|
||||
class Stop extends Component{
|
||||
static displayName = 'Stop';
|
||||
static propTypes = {
|
||||
|
||||
+5
-4
@@ -1,16 +1,16 @@
|
||||
import React, {
|
||||
ART,
|
||||
Component,
|
||||
PropTypes,
|
||||
Children,
|
||||
cloneElement
|
||||
cloneElement,
|
||||
ART
|
||||
} from 'react-native';
|
||||
import extractViewbox from '../lib/extractViewbox';
|
||||
import ViewBox from './ViewBox';
|
||||
import _ from 'lodash';
|
||||
|
||||
let {
|
||||
Surface,
|
||||
Group
|
||||
Surface
|
||||
} = ART;
|
||||
|
||||
let id = 0;
|
||||
@@ -54,6 +54,7 @@ class Svg extends Component{
|
||||
|
||||
return <Surface
|
||||
{...props}
|
||||
ref="svg"
|
||||
style={[
|
||||
props.style,
|
||||
!isNaN(opacity) && {
|
||||
|
||||
+1
-2
@@ -1,7 +1,6 @@
|
||||
import React, {
|
||||
Component,
|
||||
PropTypes,
|
||||
ART
|
||||
PropTypes
|
||||
} from 'react-native';
|
||||
|
||||
import ViewBox from './ViewBox';
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import React, {
|
||||
Component,
|
||||
PropTypes,
|
||||
ART,
|
||||
cloneElement
|
||||
} from 'react-native';
|
||||
import Defs from './Defs';
|
||||
|
||||
+1
-6
@@ -1,13 +1,8 @@
|
||||
import React, {
|
||||
Component,
|
||||
PropTypes,
|
||||
ART
|
||||
PropTypes
|
||||
} from 'react-native';
|
||||
|
||||
let {
|
||||
Shape,
|
||||
} = ART;
|
||||
|
||||
import G from './G';
|
||||
import extractViewbox from '../lib/extractViewbox';
|
||||
class ViewBox extends Component{
|
||||
|
||||
@@ -46,7 +46,6 @@ export default function (props) {
|
||||
|
||||
return rgba(props.fill, fillOpacity);
|
||||
} else if (props.fill === undefined) {
|
||||
|
||||
let fillOpacity = +props.fillOpacity;
|
||||
if (isNaN(fillOpacity)) {
|
||||
fillOpacity = 1;
|
||||
|
||||
Reference in New Issue
Block a user