This commit is contained in:
Horcrux 2016-05-04 17:54:30 +08:00
Родитель be8c273adf
Коммит cbce096b5c
41 изменённых файлов: 93 добавлений и 297 удалений

Просмотреть файл

@ -1 +1,4 @@
**/node_modules/
android/
ios/
screenShoots/

Просмотреть файл

@ -208,7 +208,7 @@
"react/jsx-boolean-value": 0, "react/jsx-boolean-value": 0,
"react/jsx-no-undef": 1, "react/jsx-no-undef": 1,
"react/jsx-sort-props": 0, "react/jsx-sort-props": 0,
"react/jsx-uses-react": 0, "react/jsx-uses-react": 1,
"react/jsx-uses-vars": 1, "react/jsx-uses-vars": 1,
"react/no-did-mount-set-state": [1, "allow-in-func"], "react/no-did-mount-set-state": [1, "allow-in-func"],
"react/no-did-update-set-state": [1, "allow-in-func"], "react/no-did-update-set-state": [1, "allow-in-func"],

6
.gitignore поставляемый
Просмотреть файл

@ -4,7 +4,7 @@
# Xcode # Xcode
# #
build/ build
*.pbxuser *.pbxuser
!default.pbxuser !default.pbxuser
*.mode1v3 *.mode1v3
@ -23,13 +23,13 @@ project.xcworkspace
# Android/IJ # Android/IJ
# #
.idea/ .idea
.gradle .gradle
local.properties local.properties
# node.js # node.js
# #
node_modules/ node_modules
npm-debug.log npm-debug.log

10
.travis.yml Normal file
Просмотреть файл

@ -0,0 +1,10 @@
sudo: false
language: node_js
node_js:
- '5'
- '4'
- '0.12'
script:
- npm run lint

Просмотреть файл

@ -81,4 +81,4 @@ const samples = [CircleExample, StrokeCircle, StrokeOpacityCircle];
export { export {
icon, icon,
samples samples
} };

Просмотреть файл

@ -218,4 +218,4 @@ const samples = [ClipPathAttr, ClipRule, ClipPathElement, TextClipping];
export { export {
icon, icon,
samples samples
} };

Просмотреть файл

@ -73,4 +73,4 @@ const samples = [EllipseExample, PileEllipses, CombinedEllipses];
export { export {
icon, icon,
samples samples
} };

Просмотреть файл

@ -130,4 +130,4 @@ const samples = [GExample, GTransform];
export { export {
icon, icon,
samples samples
} };

Просмотреть файл

@ -84,4 +84,4 @@ const samples = [LineExample, LineWithStrokeLinecap];
export { export {
icon, icon,
samples samples
} };

Просмотреть файл

@ -114,4 +114,4 @@ const samples = [PathExample, UnclosedPath, BezierCurve];
export { export {
icon, icon,
samples samples
} };

Просмотреть файл

@ -100,4 +100,4 @@ const samples = [PolygonExample, FourSidePolygon, StarPolygon, EvenOddPolygon];
export { export {
icon, icon,
samples samples
} };

Просмотреть файл

@ -93,4 +93,4 @@ const samples = [PolylineExample, StraightLines, PolylineFill, PolylineFillStrok
export { export {
icon, icon,
samples samples
} };

Просмотреть файл

@ -134,6 +134,6 @@ const samples = [RectExample, RectStrokeFill, RoundedRect, EllipseRect, RoundOve
export { export {
icon, icon,
samples samples
} };

Просмотреть файл

@ -146,4 +146,4 @@ const samples = [StrokeExample, StrokeLinecap, StrokeDasharray, StrokeDashoffset
export { export {
icon, icon,
samples samples
} };

Просмотреть файл

@ -161,4 +161,4 @@ const samples = [SvgExample, SvgOpacity, SvgViewbox, SvgLayout];
export { export {
icon, icon,
samples samples
} };

Просмотреть файл

@ -73,4 +73,4 @@ const samples = [SymbolExample];
export { export {
icon, icon,
samples samples
} };

Просмотреть файл

@ -6,9 +6,7 @@ import Svg, {
Text, Text,
LinearGradient, LinearGradient,
Stop, Stop,
Defs, Defs
ClipPath,
Rect
} from 'react-native-svg'; } from 'react-native-svg';
class TextExample extends Component{ class TextExample extends Component{
@ -165,4 +163,4 @@ const samples = [
export { export {
icon, icon,
samples samples
} };

Просмотреть файл

@ -30,7 +30,7 @@ class UseExample extends Component{
<Use href="#shape" x="20" y="0"/> <Use href="#shape" x="20" y="0"/>
<Use href="#shape" x="170"y="0" /> <Use href="#shape" x="170"y="0" />
</Svg>; </Svg>;
}; }
} }
class UseShapes extends Component{ class UseShapes extends Component{
@ -47,7 +47,7 @@ class UseShapes extends Component{
<Use href="#shape" x="110" y="0" stroke="#0ff" fill="#8a3" rotation="45" origin="25, 25"/> <Use href="#shape" x="110" y="0" stroke="#0ff" fill="#8a3" rotation="45" origin="25, 25"/>
<Use href="#shape" x="150" y="50" stroke="#0f0" fill="none"/> <Use href="#shape" x="150" y="50" stroke="#0f0" fill="none"/>
</Svg>; </Svg>;
}; }
} }
const icon = <Svg const icon = <Svg
@ -68,4 +68,4 @@ const samples = [UseExample, UseShapes];
export { export {
icon, icon,
samples samples
} };

Просмотреть файл

@ -12,7 +12,6 @@
00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; }; 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; };
00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; }; 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; };
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; }; 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; };
00E356F31AD99517003FC87E /* ArtSvgExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* ArtSvgExampleTests.m */; };
103345EE1CC618FA00B43156 /* libRNSVG.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 103345ED1CC618D700B43156 /* libRNSVG.a */; }; 103345EE1CC618FA00B43156 /* libRNSVG.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 103345ED1CC618D700B43156 /* libRNSVG.a */; };
133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; }; 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; };
139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; }; 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; };
@ -61,13 +60,6 @@
remoteGlobalIDString = 832C81801AAF6DEF007FA2F7; remoteGlobalIDString = 832C81801AAF6DEF007FA2F7;
remoteInfo = RCTVibration; remoteInfo = RCTVibration;
}; };
00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 13B07F861A680F5B00A75B9A;
remoteInfo = ArtSvgExample;
};
103345EC1CC618D700B43156 /* PBXContainerItemProxy */ = { 103345EC1CC618D700B43156 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy; isa = PBXContainerItemProxy;
containerPortal = 103345E81CC618D700B43156 /* RNSVG.xcodeproj */; containerPortal = 103345E81CC618D700B43156 /* RNSVG.xcodeproj */;
@ -119,9 +111,6 @@
00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = "<group>"; }; 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = "<group>"; };
00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = "<group>"; }; 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = "<group>"; };
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = "<group>"; }; 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = "<group>"; };
00E356EE1AD99517003FC87E /* ArtSvgExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ArtSvgExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
00E356F21AD99517003FC87E /* ArtSvgExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ArtSvgExampleTests.m; sourceTree = "<group>"; };
103345E81CC618D700B43156 /* RNSVG.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RNSVG.xcodeproj; path = "../node_modules/react-native-svg/ios/RNSVG.xcodeproj"; sourceTree = "<group>"; }; 103345E81CC618D700B43156 /* RNSVG.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RNSVG.xcodeproj; path = "../node_modules/react-native-svg/ios/RNSVG.xcodeproj"; sourceTree = "<group>"; };
139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = "<group>"; }; 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = "<group>"; };
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = "<group>"; }; 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = "<group>"; };
@ -138,13 +127,6 @@
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
00E356EB1AD99517003FC87E /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
13B07F8C1A680F5B00A75B9A /* Frameworks */ = { 13B07F8C1A680F5B00A75B9A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
@ -206,23 +188,6 @@
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
00E356EF1AD99517003FC87E /* ArtSvgExampleTests */ = {
isa = PBXGroup;
children = (
00E356F21AD99517003FC87E /* ArtSvgExampleTests.m */,
00E356F01AD99517003FC87E /* Supporting Files */,
);
path = ArtSvgExampleTests;
sourceTree = "<group>";
};
00E356F01AD99517003FC87E /* Supporting Files */ = {
isa = PBXGroup;
children = (
00E356F11AD99517003FC87E /* Info.plist */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
103345E91CC618D700B43156 /* Products */ = { 103345E91CC618D700B43156 /* Products */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -308,7 +273,6 @@
children = ( children = (
13B07FAE1A68108700A75B9A /* ArtSvgExample */, 13B07FAE1A68108700A75B9A /* ArtSvgExample */,
832341AE1AAA6A7D00B99B32 /* Libraries */, 832341AE1AAA6A7D00B99B32 /* Libraries */,
00E356EF1AD99517003FC87E /* ArtSvgExampleTests */,
83CBBA001A601CBA00E9B192 /* Products */, 83CBBA001A601CBA00E9B192 /* Products */,
); );
indentWidth = 2; indentWidth = 2;
@ -319,7 +283,6 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
13B07F961A680F5B00A75B9A /* ArtSvgExample.app */, 13B07F961A680F5B00A75B9A /* ArtSvgExample.app */,
00E356EE1AD99517003FC87E /* ArtSvgExampleTests.xctest */,
); );
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
@ -327,24 +290,6 @@
/* End PBXGroup section */ /* End PBXGroup section */
/* Begin PBXNativeTarget section */ /* Begin PBXNativeTarget section */
00E356ED1AD99517003FC87E /* ArtSvgExampleTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "ArtSvgExampleTests" */;
buildPhases = (
00E356EA1AD99517003FC87E /* Sources */,
00E356EB1AD99517003FC87E /* Frameworks */,
00E356EC1AD99517003FC87E /* Resources */,
);
buildRules = (
);
dependencies = (
00E356F51AD99517003FC87E /* PBXTargetDependency */,
);
name = ArtSvgExampleTests;
productName = ArtSvgExampleTests;
productReference = 00E356EE1AD99517003FC87E /* ArtSvgExampleTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
13B07F861A680F5B00A75B9A /* ArtSvgExample */ = { 13B07F861A680F5B00A75B9A /* ArtSvgExample */ = {
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "ArtSvgExample" */; buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "ArtSvgExample" */;
@ -371,12 +316,6 @@
attributes = { attributes = {
LastUpgradeCheck = 0610; LastUpgradeCheck = 0610;
ORGANIZATIONNAME = Facebook; ORGANIZATIONNAME = Facebook;
TargetAttributes = {
00E356ED1AD99517003FC87E = {
CreatedOnToolsVersion = 6.2;
TestTargetID = 13B07F861A680F5B00A75B9A;
};
};
}; };
buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "ArtSvgExample" */; buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "ArtSvgExample" */;
compatibilityVersion = "Xcode 3.2"; compatibilityVersion = "Xcode 3.2";
@ -438,7 +377,6 @@
projectRoot = ""; projectRoot = "";
targets = ( targets = (
13B07F861A680F5B00A75B9A /* ArtSvgExample */, 13B07F861A680F5B00A75B9A /* ArtSvgExample */,
00E356ED1AD99517003FC87E /* ArtSvgExampleTests */,
); );
}; };
/* End PBXProject section */ /* End PBXProject section */
@ -524,13 +462,6 @@
/* End PBXReferenceProxy section */ /* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */ /* Begin PBXResourcesBuildPhase section */
00E356EC1AD99517003FC87E /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
13B07F8E1A680F5B00A75B9A /* Resources */ = { 13B07F8E1A680F5B00A75B9A /* Resources */ = {
isa = PBXResourcesBuildPhase; isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
@ -560,14 +491,6 @@
/* End PBXShellScriptBuildPhase section */ /* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */
00E356EA1AD99517003FC87E /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
00E356F31AD99517003FC87E /* ArtSvgExampleTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
13B07F871A680F5B00A75B9A /* Sources */ = { 13B07F871A680F5B00A75B9A /* Sources */ = {
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
@ -579,14 +502,6 @@
}; };
/* End PBXSourcesBuildPhase section */ /* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
00E356F51AD99517003FC87E /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 13B07F861A680F5B00A75B9A /* ArtSvgExample */;
targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */ /* Begin PBXVariantGroup section */
13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = { 13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = {
isa = PBXVariantGroup; isa = PBXVariantGroup;
@ -600,43 +515,6 @@
/* End PBXVariantGroup section */ /* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */ /* Begin XCBuildConfiguration section */
00E356F61AD99517003FC87E /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
INFOPLIST_FILE = ArtSvgExampleTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ArtSvgExample.app/ArtSvgExample";
};
name = Debug;
};
00E356F71AD99517003FC87E /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
INFOPLIST_FILE = ArtSvgExampleTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ArtSvgExample.app/ArtSvgExample";
};
name = Release;
};
13B07F941A680F5B00A75B9A /* Debug */ = { 13B07F941A680F5B00A75B9A /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
@ -759,15 +637,6 @@
/* End XCBuildConfiguration section */ /* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */ /* Begin XCConfigurationList section */
00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "ArtSvgExampleTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
00E356F61AD99517003FC87E /* Debug */,
00E356F71AD99517003FC87E /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "ArtSvgExample" */ = { 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "ArtSvgExample" */ = {
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (

Просмотреть файл

@ -1,70 +0,0 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import <UIKit/UIKit.h>
#import <XCTest/XCTest.h>
#import "RCTLog.h"
#import "RCTRootView.h"
#define TIMEOUT_SECONDS 240
#define TEXT_TO_LOOK_FOR @"Welcome to React Native!"
@interface ArtSvgExampleTests : XCTestCase
@end
@implementation ArtSvgExampleTests
- (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test
{
if (test(view)) {
return YES;
}
for (UIView *subview in [view subviews]) {
if ([self findSubviewInView:subview matching:test]) {
return YES;
}
}
return NO;
}
- (void)testRendersWelcomeScreen
{
UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
BOOL foundElement = NO;
__block NSString *redboxError = nil;
RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
if (level >= RCTLogLevelError) {
redboxError = message;
}
});
while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
[[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) {
if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
return YES;
}
return NO;
}];
}
RCTSetLogFunction(RCTDefaultLogFunction);
XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
}
@end

Просмотреть файл

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

Просмотреть файл

@ -10,7 +10,6 @@ import React, {
Text, Text,
View, View,
ScrollView, ScrollView,
PixelRatio,
TouchableHighlight, TouchableHighlight,
TouchableOpacity, TouchableOpacity,
Animated, Animated,
@ -181,7 +180,7 @@ class ArtSvgExample extends Component {
{icon} {icon}
<Text style={styles.title}>{name}</Text> <Text style={styles.title}>{name}</Text>
</View> </View>
</TouchableHighlight> </TouchableHighlight>;
}); });
}; };

Просмотреть файл

@ -1,4 +1,4 @@
import React, { import {
PropTypes PropTypes
} from 'react-native'; } from 'react-native';
import Shape, {CIRCLE} from './Shape'; import Shape, {CIRCLE} from './Shape';

Просмотреть файл

@ -1,4 +1,4 @@
import React, { import {
PropTypes PropTypes
} from 'react-native'; } from 'react-native';
import Shape, {ELLIPSE} from './Shape'; import Shape, {ELLIPSE} from './Shape';

Просмотреть файл

@ -7,7 +7,7 @@ import {set, remove} from '../lib/extract/patterns';
import percentToFloat from '../lib/percentToFloat'; import percentToFloat from '../lib/percentToFloat';
import Stop from './Stop'; import Stop from './Stop';
import Color from 'color'; import Color from 'color';
class RadialGradient extends Component{ class Gradient extends Component{
static displayName = 'Gradient'; static displayName = 'Gradient';
constructor() { constructor() {
@ -37,12 +37,12 @@ class RadialGradient extends Component{
stops[offset] = Color(child.props.stopColor).alpha(+child.props.stopOpacity); stops[offset] = Color(child.props.stopColor).alpha(+child.props.stopOpacity);
set(this.id, generator.bind(null, stops)); set(this.id, generator.bind(null, stops));
} else { } else {
console.warn(`'RadialGradient' can only receive 'Stop' elements as children`); console.warn(`'Gradient' can only receive 'Stop' elements as children`);
} }
}); });
return <NativeGroup />; return <NativeGroup />;
} }
} }
export default RadialGradient; export default Gradient;

Просмотреть файл

@ -1,4 +1,4 @@
import React, { import {
Component, Component,
PropTypes PropTypes
} from 'react-native'; } from 'react-native';

Просмотреть файл

@ -1,4 +1,4 @@
import React, { import {
PropTypes PropTypes
} from 'react-native'; } from 'react-native';
import Shape, {LINE} from './Shape'; import Shape, {LINE} from './Shape';

Просмотреть файл

@ -1,4 +1,4 @@
import React, { import {
PropTypes PropTypes
} from 'react-native'; } from 'react-native';

Просмотреть файл

@ -1,4 +1,4 @@
import React, { import {
Component, Component,
PropTypes PropTypes
} from 'react-native'; } from 'react-native';

Просмотреть файл

@ -1,4 +1,4 @@
import React, { import {
PropTypes PropTypes
} from 'react-native'; } from 'react-native';
import stopsOpacity from '../lib/stopsOpacity'; import stopsOpacity from '../lib/stopsOpacity';

Просмотреть файл

@ -1,4 +1,4 @@
import React, { import {
PropTypes PropTypes
} from 'react-native'; } from 'react-native';
import Shape, {RECT} from './Shape'; import Shape, {RECT} from './Shape';

Просмотреть файл

@ -1,6 +1,7 @@
import React, { import React, {
Component Component
} from 'react-native'; } from 'react-native';
import './Path'; // must import Path first, don`t know why. without this will throw an `Super expression must either be null or a function, not undefined`, maybe cyclic dependencies issue
import _ from 'lodash'; import _ from 'lodash';
import extractProps from '../lib/extract/extractProps'; import extractProps from '../lib/extract/extractProps';
import {ShapeAttributes} from '../lib/attributes'; import {ShapeAttributes} from '../lib/attributes';

Просмотреть файл

@ -1,4 +1,4 @@
import React, { import {
Component, Component,
PropTypes PropTypes
} from 'react-native'; } from 'react-native';

Просмотреть файл

@ -1,6 +1,3 @@
import React, {
Component
} from 'react-native';
import Rect from './elements/Rect'; import Rect from './elements/Rect';
import Circle from './elements/Circle'; import Circle from './elements/Circle';
import Ellipse from './elements/Ellipse'; import Ellipse from './elements/Ellipse';

Просмотреть файл

@ -1,3 +1,4 @@
import _ from 'lodash';
const MOVE_TO = 0; const MOVE_TO = 0;
const CLOSE = 1; const CLOSE = 1;
const LINE_TO = 2; const LINE_TO = 2;
@ -93,7 +94,7 @@ export default class SerializablePath {
}; };
lineTo = (x,y) => { lineTo = (x,y) => {
if (this.penDownX == null) { if (_.isNil(this.penDownX)) {
this.penDownX = this.penX; this.penDownY = this.penY; this.penDownX = this.penX; this.penDownY = this.penY;
} }
this.onLine(this.penX, this.penY, this._pivotX = this.penX = (+x), this._pivotY = this.penY = (+y)); this.onLine(this.penX, this.penY, this._pivotX = this.penX = (+x), this._pivotY = this.penY = (+y));
@ -106,10 +107,10 @@ export default class SerializablePath {
return this.curveTo( return this.curveTo(
x + (+c1x), y + (+c1y), x + (+c1x), y + (+c1y),
c2x == null ? null : x + (+c2x), _.isNil(c2x) ? null : x + (+c2x),
c2y == null ? null : y + (+c2y), _.isNil(c2y) ? null : y + (+c2y),
ex == null ? null : x + (+ex), _.isNil(ex) ? null : x + (+ex),
ey == null ? null : y + (+ey) _.isNil(ey) ? null : y + (+ey)
); );
}; };
@ -117,12 +118,12 @@ export default class SerializablePath {
let x = this.penX, let x = this.penX,
y = this.penY; y = this.penY;
if (c2x == null){ if (_.isNil(c2x)){
c2x = +c1x; c2y = +c1y; c2x = +c1x; c2y = +c1y;
c1x = (x * 2) - (this._pivotX || 0); c1y = (y * 2) - (this._pivotY || 0); c1x = (x * 2) - (this._pivotX || 0); c1y = (y * 2) - (this._pivotY || 0);
} }
if (ex == null){ if (_.isNil(ex)){
this._pivotX = +c1x; this._pivotY = +c1y; this._pivotX = +c1x; this._pivotY = +c1y;
ex = +c2x; ey = +c2y; ex = +c2x; ey = +c2y;
c2x = (ex + (+c1x) * 2) / 3; c2y = (ey + (+c1y) * 2) / 3; c2x = (ex + (+c1x) * 2) / 3; c2y = (ey + (+c1y) * 2) / 3;
@ -130,7 +131,7 @@ export default class SerializablePath {
} else { } else {
this._pivotX = +c2x; this._pivotY = +c2y; this._pivotX = +c2x; this._pivotY = +c2y;
} }
if (this.penDownX == null) { if (_.isNil(this.penDownX)) {
this.penDownX = x; this.penDownY = y; this.penDownX = x; this.penDownY = y;
} }
this.onBezierCurve(x, y, +c1x, +c1y, +c2x, +c2y, this.penX = +ex, this.penY = +ey); this.onBezierCurve(x, y, +c1x, +c1y, +c2x, +c2y, this.penX = +ex, this.penY = +ey);
@ -145,7 +146,7 @@ export default class SerializablePath {
ry = Math.abs(+ry || +rx || (+y - this.penY)); ry = Math.abs(+ry || +rx || (+y - this.penY));
rx = Math.abs(+rx || (+x - this.penX)); rx = Math.abs(+rx || (+x - this.penX));
if (!rx || !ry || (x == this.penX && y == this.penY)) { if (!rx || !ry || (x === this.penX && y === this.penY)) {
return this.lineTo(x, y); return this.lineTo(x, y);
} }
@ -168,7 +169,10 @@ export default class SerializablePath {
cx = x / 2; cy = y / 2; cx = x / 2; cy = y / 2;
} else { } else {
a = Math.sqrt(a / (rxcy + rycx)); a = Math.sqrt(a / (rxcy + rycx));
if (large == clockwise) a = -a;
if (large === clockwise) {
a = -a;
}
let cxd = -a * cy * rx / ry, let cxd = -a * cy * rx / ry,
cyd = a * cx * ry / rx; cyd = a * cx * ry / rx;
cx = cos * cxd - sin * cyd + x / 2; cx = cos * cxd - sin * cyd + x / 2;
@ -187,7 +191,9 @@ export default class SerializablePath {
x += tX; y += tY; x += tX; y += tY;
// Circular Arc // Circular Arc
if (this.penDownX == null){ this.penDownX = this.penX; this.penDownY = this.penY; } if (_.isNil(this.penDownX)) {
this.penDownX = this.penX; this.penDownY = this.penY;
}
this.onArc( this.onArc(
tX, tY, this._pivotX = this.penX = x, this._pivotY = this.penY = y, tX, tY, this._pivotX = this.penX = x, this._pivotY = this.penY = y,
cx, cy, rx, ry, sa, ea, !clockwise, rotation cx, cy, rx, ry, sa, ea, !clockwise, rotation
@ -204,7 +210,7 @@ export default class SerializablePath {
}; };
close = () => { close = () => {
if (this.penDownX != null){ if (!_.isNil(this.penDownX)){
this.onClose(this.penX, this.penY, this.penX = this.penDownX, this.penY = this.penDownY); this.onClose(this.penX, this.penY, this.penX = this.penDownX, this.penY = this.penDownY);
this.penDownX = null; this.penDownX = null;
} }

Просмотреть файл

@ -19,6 +19,7 @@
* *
* *
*/ */
import _ from 'lodash';
import percentToFloat from './percentToFloat'; import percentToFloat from './percentToFloat';
function percentageTransform(value) { function percentageTransform(value) {
@ -34,14 +35,14 @@ function percentageTransform(value) {
return { return {
percentage: float !== +value, percentage: float !== +value,
value: float value: float
} };
} }
export default class { export default class {
constructor(props, list) { constructor(props, list) {
this.shape = {}; this.shape = {};
list.forEach(name => { list.forEach(name => {
if (props[name] != null) { if (!_.isNil(props[name])) {
this.shape[name] = percentageTransform(props[name]); this.shape[name] = percentageTransform(props[name]);
} }
}); });
@ -50,5 +51,5 @@ export default class {
toJSON = () => { toJSON = () => {
return this.shape; return this.shape;
}; };
}; }

Просмотреть файл

@ -1,15 +1,16 @@
import _ from 'lodash';
export default class { export default class {
constructor(xx, yx, xy, yy, x, y){ constructor(xx, yx, xy, yy, x, y){
if (xx && typeof xx === 'object'){ if (xx && typeof xx === 'object'){
yx = xx.yx; yy = xx.yy; y = xx.y; yx = xx.yx; yy = xx.yy; y = xx.y;
xy = xx.xy; x = xx.x; xx = xx.xx; xy = xx.xy; x = xx.x; xx = xx.xx;
} }
this.xx = xx == null ? 1 : xx; this.xx = _.isNil(xx) ? 1 : xx;
this.yx = yx || 0; this.yx = yx || 0;
this.xy = xy || 0; this.xy = xy || 0;
this.yy = yy == null ? 1 : yy; this.yy = _.isNil(yy) ? 1 : yy;
this.x = (x == null ? this.x : x) || 0; this.x = (_.isNil(x) ? this.x : x) || 0;
this.y = (y == null ? this.y : y) || 0; this.y = (_.isNil(y) ? this.y : y) || 0;
return this; return this;
} }
@ -56,11 +57,11 @@ export default class {
}; };
scale = (x, y) => { scale = (x, y) => {
return this.transform(x, 0, 0, y == null ? x : y, 0, 0); return this.transform(x, 0, 0, _.isNil(y) ? x : y, 0, 0);
}; };
rotate = (deg, x, y) => { rotate = (deg, x, y) => {
if (x == null || y == null){ if (_.isNil(x) || _.isNil(y)){
x = (this.left || 0) + (this.width || 0) / 2; x = (this.left || 0) + (this.width || 0) / 2;
y = (this.top || 0) + (this.height || 0) / 2; y = (this.top || 0) + (this.height || 0) / 2;
} }
@ -117,7 +118,7 @@ export default class {
c = this.xy, d = this.yy, c = this.xy, d = this.yy,
e = this.x, f = this.y; e = this.x, f = this.y;
var det = b * c - a * d; var det = b * c - a * d;
if (det == 0) { if (det === 0) {
return null; return null;
} }
return { return {

Просмотреть файл

@ -1,6 +1,7 @@
import _ from 'lodash';
function arrayDiffer(a, b) { function arrayDiffer(a, b) {
if (a == null) { if (_.isNil(a)) {
return true; return true;
} }
if (a.length !== b.length) { if (a.length !== b.length) {

Просмотреть файл

@ -1,5 +1,5 @@
import SerializablePath from 'react-native/Libraries/ART/ARTSerializablePath'; import SerializablePath from 'react-native/Libraries/ART/ARTSerializablePath';
import _ from 'lodash';
const newLine = /\n/g; const newLine = /\n/g;
const defaultFontFamily = '"Helvetica Neue", "Helvetica", Arial'; const defaultFontFamily = '"Helvetica Neue", "Helvetica", Arial';
const fontRegExp = /^\s*((?:(?:normal|bold|italic)\s+)*)(?:(\d+(?:\.\d+)?)[ptexm%]*(?:\s*\/.*?)?\s+)?\s*"?([^"]*)/i; const fontRegExp = /^\s*((?:(?:normal|bold|italic)\s+)*)(?:(\d+(?:\.\d+)?)[ptexm%]*(?:\s*\/.*?)?\s+)?\s*"?([^"]*)/i;
@ -58,7 +58,7 @@ function parseFontString(font) {
} }
function extractFont(font) { function extractFont(font) {
if (font == null) { if (_.isNil(font)) {
return null; return null;
} }
if (typeof font === 'string') { if (typeof font === 'string') {

Просмотреть файл

@ -1,11 +1,12 @@
import Transform from '../Transform'; import Transform from '../Transform';
let pooledTransform = new Transform; import _ from 'lodash';
let pooledTransform = new Transform();
function transformToMatrix(props) { function transformToMatrix(props) {
let scaleX = props.scaleX != null ? props.scaleX : let scaleX = !_.isNil(props.scaleX) ? props.scaleX :
props.scale != null ? props.scale : 1; !_.isNil(props.scale) ? props.scale : 1;
let scaleY = props.scaleY != null ? props.scaleY : let scaleY = !_.isNil(props.scaleY) ? props.scaleY :
props.scale != null ? props.scale : 1; !_.isNil(props.scale) ? props.scale : 1;
pooledTransform pooledTransform
.transformTo(1, 0, 0, 1, 0, 0) .transformTo(1, 0, 0, 1, 0, 0)
@ -13,7 +14,7 @@ function transformToMatrix(props) {
.rotate(props.rotation || 0, props.originX, props.originY) .rotate(props.rotation || 0, props.originX, props.originY)
.scale(scaleX, scaleY, props.originX, props.originY); .scale(scaleX, scaleY, props.originX, props.originY);
if (props.transform != null) { if (!_.isNil(props.transform)) {
pooledTransform.transform(props.transform); pooledTransform.transform(props.transform);
} }

Просмотреть файл

@ -17,6 +17,9 @@
"ART", "ART",
"VML" "VML"
], ],
"scripts": {
"lint": "eslint ./"
},
"dependencies": { "dependencies": {
"color": "^0.11.1", "color": "^0.11.1",
"lodash": "^4.0.0" "lodash": "^4.0.0"