Use eslint, add travis-ci
This commit is contained in:
Родитель
be8c273adf
Коммит
cbce096b5c
|
@ -1 +1,4 @@
|
|||
|
||||
**/node_modules/
|
||||
android/
|
||||
ios/
|
||||
screenShoots/
|
||||
|
|
|
@ -208,7 +208,7 @@
|
|||
"react/jsx-boolean-value": 0,
|
||||
"react/jsx-no-undef": 1,
|
||||
"react/jsx-sort-props": 0,
|
||||
"react/jsx-uses-react": 0,
|
||||
"react/jsx-uses-react": 1,
|
||||
"react/jsx-uses-vars": 1,
|
||||
"react/no-did-mount-set-state": [1, "allow-in-func"],
|
||||
"react/no-did-update-set-state": [1, "allow-in-func"],
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
# Xcode
|
||||
#
|
||||
build/
|
||||
build
|
||||
*.pbxuser
|
||||
!default.pbxuser
|
||||
*.mode1v3
|
||||
|
@ -23,13 +23,13 @@ project.xcworkspace
|
|||
|
||||
# Android/IJ
|
||||
#
|
||||
.idea/
|
||||
.idea
|
||||
.gradle
|
||||
local.properties
|
||||
|
||||
# node.js
|
||||
#
|
||||
node_modules/
|
||||
node_modules
|
||||
npm-debug.log
|
||||
|
||||
|
||||
|
|
|
@ -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 {
|
||||
icon,
|
||||
samples
|
||||
}
|
||||
};
|
||||
|
|
|
@ -218,4 +218,4 @@ const samples = [ClipPathAttr, ClipRule, ClipPathElement, TextClipping];
|
|||
export {
|
||||
icon,
|
||||
samples
|
||||
}
|
||||
};
|
||||
|
|
|
@ -73,4 +73,4 @@ const samples = [EllipseExample, PileEllipses, CombinedEllipses];
|
|||
export {
|
||||
icon,
|
||||
samples
|
||||
}
|
||||
};
|
||||
|
|
|
@ -130,4 +130,4 @@ const samples = [GExample, GTransform];
|
|||
export {
|
||||
icon,
|
||||
samples
|
||||
}
|
||||
};
|
||||
|
|
|
@ -84,4 +84,4 @@ const samples = [LineExample, LineWithStrokeLinecap];
|
|||
export {
|
||||
icon,
|
||||
samples
|
||||
}
|
||||
};
|
||||
|
|
|
@ -114,4 +114,4 @@ const samples = [PathExample, UnclosedPath, BezierCurve];
|
|||
export {
|
||||
icon,
|
||||
samples
|
||||
}
|
||||
};
|
||||
|
|
|
@ -100,4 +100,4 @@ const samples = [PolygonExample, FourSidePolygon, StarPolygon, EvenOddPolygon];
|
|||
export {
|
||||
icon,
|
||||
samples
|
||||
}
|
||||
};
|
||||
|
|
|
@ -93,4 +93,4 @@ const samples = [PolylineExample, StraightLines, PolylineFill, PolylineFillStrok
|
|||
export {
|
||||
icon,
|
||||
samples
|
||||
}
|
||||
};
|
||||
|
|
|
@ -134,6 +134,6 @@ const samples = [RectExample, RectStrokeFill, RoundedRect, EllipseRect, RoundOve
|
|||
export {
|
||||
icon,
|
||||
samples
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -146,4 +146,4 @@ const samples = [StrokeExample, StrokeLinecap, StrokeDasharray, StrokeDashoffset
|
|||
export {
|
||||
icon,
|
||||
samples
|
||||
}
|
||||
};
|
||||
|
|
|
@ -161,4 +161,4 @@ const samples = [SvgExample, SvgOpacity, SvgViewbox, SvgLayout];
|
|||
export {
|
||||
icon,
|
||||
samples
|
||||
}
|
||||
};
|
||||
|
|
|
@ -73,4 +73,4 @@ const samples = [SymbolExample];
|
|||
export {
|
||||
icon,
|
||||
samples
|
||||
}
|
||||
};
|
||||
|
|
|
@ -6,9 +6,7 @@ import Svg, {
|
|||
Text,
|
||||
LinearGradient,
|
||||
Stop,
|
||||
Defs,
|
||||
ClipPath,
|
||||
Rect
|
||||
Defs
|
||||
} from 'react-native-svg';
|
||||
|
||||
class TextExample extends Component{
|
||||
|
@ -165,4 +163,4 @@ const samples = [
|
|||
export {
|
||||
icon,
|
||||
samples
|
||||
}
|
||||
};
|
||||
|
|
|
@ -30,7 +30,7 @@ class UseExample extends Component{
|
|||
<Use href="#shape" x="20" y="0"/>
|
||||
<Use href="#shape" x="170"y="0" />
|
||||
</Svg>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
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="150" y="50" stroke="#0f0" fill="none"/>
|
||||
</Svg>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const icon = <Svg
|
||||
|
@ -68,4 +68,4 @@ const samples = [UseExample, UseShapes];
|
|||
export {
|
||||
icon,
|
||||
samples
|
||||
}
|
||||
};
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; };
|
||||
00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.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 */; };
|
||||
133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; };
|
||||
139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; };
|
||||
|
@ -61,13 +60,6 @@
|
|||
remoteGlobalIDString = 832C81801AAF6DEF007FA2F7;
|
||||
remoteInfo = RCTVibration;
|
||||
};
|
||||
00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 13B07F861A680F5B00A75B9A;
|
||||
remoteInfo = ArtSvgExample;
|
||||
};
|
||||
103345EC1CC618D700B43156 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
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>"; };
|
||||
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>"; };
|
||||
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>"; };
|
||||
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>"; };
|
||||
|
@ -138,13 +127,6 @@
|
|||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
00E356EB1AD99517003FC87E /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
13B07F8C1A680F5B00A75B9A /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
|
@ -206,23 +188,6 @@
|
|||
name = Products;
|
||||
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 */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -308,7 +273,6 @@
|
|||
children = (
|
||||
13B07FAE1A68108700A75B9A /* ArtSvgExample */,
|
||||
832341AE1AAA6A7D00B99B32 /* Libraries */,
|
||||
00E356EF1AD99517003FC87E /* ArtSvgExampleTests */,
|
||||
83CBBA001A601CBA00E9B192 /* Products */,
|
||||
);
|
||||
indentWidth = 2;
|
||||
|
@ -319,7 +283,6 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
13B07F961A680F5B00A75B9A /* ArtSvgExample.app */,
|
||||
00E356EE1AD99517003FC87E /* ArtSvgExampleTests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
|
@ -327,24 +290,6 @@
|
|||
/* End PBXGroup 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 */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "ArtSvgExample" */;
|
||||
|
@ -371,12 +316,6 @@
|
|||
attributes = {
|
||||
LastUpgradeCheck = 0610;
|
||||
ORGANIZATIONNAME = Facebook;
|
||||
TargetAttributes = {
|
||||
00E356ED1AD99517003FC87E = {
|
||||
CreatedOnToolsVersion = 6.2;
|
||||
TestTargetID = 13B07F861A680F5B00A75B9A;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "ArtSvgExample" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
|
@ -438,7 +377,6 @@
|
|||
projectRoot = "";
|
||||
targets = (
|
||||
13B07F861A680F5B00A75B9A /* ArtSvgExample */,
|
||||
00E356ED1AD99517003FC87E /* ArtSvgExampleTests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
@ -524,13 +462,6 @@
|
|||
/* End PBXReferenceProxy section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
00E356EC1AD99517003FC87E /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
13B07F8E1A680F5B00A75B9A /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
|
@ -560,14 +491,6 @@
|
|||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
00E356EA1AD99517003FC87E /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
00E356F31AD99517003FC87E /* ArtSvgExampleTests.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
13B07F871A680F5B00A75B9A /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
|
@ -579,14 +502,6 @@
|
|||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
00E356F51AD99517003FC87E /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 13B07F861A680F5B00A75B9A /* ArtSvgExample */;
|
||||
targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
|
@ -600,43 +515,6 @@
|
|||
/* End PBXVariantGroup 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 */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
|
@ -759,15 +637,6 @@
|
|||
/* End XCBuildConfiguration 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" */ = {
|
||||
isa = XCConfigurationList;
|
||||
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,
|
||||
View,
|
||||
ScrollView,
|
||||
PixelRatio,
|
||||
TouchableHighlight,
|
||||
TouchableOpacity,
|
||||
Animated,
|
||||
|
@ -181,7 +180,7 @@ class ArtSvgExample extends Component {
|
|||
{icon}
|
||||
<Text style={styles.title}>{name}</Text>
|
||||
</View>
|
||||
</TouchableHighlight>
|
||||
</TouchableHighlight>;
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, {
|
||||
import {
|
||||
PropTypes
|
||||
} from 'react-native';
|
||||
import Shape, {CIRCLE} from './Shape';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, {
|
||||
import {
|
||||
PropTypes
|
||||
} from 'react-native';
|
||||
import Shape, {ELLIPSE} from './Shape';
|
||||
|
|
|
@ -7,7 +7,7 @@ import {set, remove} from '../lib/extract/patterns';
|
|||
import percentToFloat from '../lib/percentToFloat';
|
||||
import Stop from './Stop';
|
||||
import Color from 'color';
|
||||
class RadialGradient extends Component{
|
||||
class Gradient extends Component{
|
||||
static displayName = 'Gradient';
|
||||
|
||||
constructor() {
|
||||
|
@ -37,12 +37,12 @@ class RadialGradient extends Component{
|
|||
stops[offset] = Color(child.props.stopColor).alpha(+child.props.stopOpacity);
|
||||
set(this.id, generator.bind(null, stops));
|
||||
} else {
|
||||
console.warn(`'RadialGradient' can only receive 'Stop' elements as children`);
|
||||
console.warn(`'Gradient' can only receive 'Stop' elements as children`);
|
||||
}
|
||||
});
|
||||
return <NativeGroup />;
|
||||
}
|
||||
}
|
||||
|
||||
export default RadialGradient;
|
||||
export default Gradient;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, {
|
||||
import {
|
||||
Component,
|
||||
PropTypes
|
||||
} from 'react-native';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, {
|
||||
import {
|
||||
PropTypes
|
||||
} from 'react-native';
|
||||
import Shape, {LINE} from './Shape';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, {
|
||||
import {
|
||||
PropTypes
|
||||
} from 'react-native';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, {
|
||||
import {
|
||||
Component,
|
||||
PropTypes
|
||||
} from 'react-native';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, {
|
||||
import {
|
||||
PropTypes
|
||||
} from 'react-native';
|
||||
import stopsOpacity from '../lib/stopsOpacity';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, {
|
||||
import {
|
||||
PropTypes
|
||||
} from 'react-native';
|
||||
import Shape, {RECT} from './Shape';
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import React, {
|
||||
Component
|
||||
} 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 extractProps from '../lib/extract/extractProps';
|
||||
import {ShapeAttributes} from '../lib/attributes';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, {
|
||||
import {
|
||||
Component,
|
||||
PropTypes
|
||||
} from 'react-native';
|
||||
|
|
3
index.js
3
index.js
|
@ -1,6 +1,3 @@
|
|||
import React, {
|
||||
Component
|
||||
} from 'react-native';
|
||||
import Rect from './elements/Rect';
|
||||
import Circle from './elements/Circle';
|
||||
import Ellipse from './elements/Ellipse';
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import _ from 'lodash';
|
||||
const MOVE_TO = 0;
|
||||
const CLOSE = 1;
|
||||
const LINE_TO = 2;
|
||||
|
@ -93,7 +94,7 @@ export default class SerializablePath {
|
|||
};
|
||||
|
||||
lineTo = (x,y) => {
|
||||
if (this.penDownX == null) {
|
||||
if (_.isNil(this.penDownX)) {
|
||||
this.penDownX = this.penX; this.penDownY = this.penY;
|
||||
}
|
||||
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(
|
||||
x + (+c1x), y + (+c1y),
|
||||
c2x == null ? null : x + (+c2x),
|
||||
c2y == null ? null : y + (+c2y),
|
||||
ex == null ? null : x + (+ex),
|
||||
ey == null ? null : y + (+ey)
|
||||
_.isNil(c2x) ? null : x + (+c2x),
|
||||
_.isNil(c2y) ? null : y + (+c2y),
|
||||
_.isNil(ex) ? null : x + (+ex),
|
||||
_.isNil(ey) ? null : y + (+ey)
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -117,12 +118,12 @@ export default class SerializablePath {
|
|||
let x = this.penX,
|
||||
y = this.penY;
|
||||
|
||||
if (c2x == null){
|
||||
if (_.isNil(c2x)){
|
||||
c2x = +c1x; c2y = +c1y;
|
||||
c1x = (x * 2) - (this._pivotX || 0); c1y = (y * 2) - (this._pivotY || 0);
|
||||
}
|
||||
|
||||
if (ex == null){
|
||||
if (_.isNil(ex)){
|
||||
this._pivotX = +c1x; this._pivotY = +c1y;
|
||||
ex = +c2x; ey = +c2y;
|
||||
c2x = (ex + (+c1x) * 2) / 3; c2y = (ey + (+c1y) * 2) / 3;
|
||||
|
@ -130,7 +131,7 @@ export default class SerializablePath {
|
|||
} else {
|
||||
this._pivotX = +c2x; this._pivotY = +c2y;
|
||||
}
|
||||
if (this.penDownX == null) {
|
||||
if (_.isNil(this.penDownX)) {
|
||||
this.penDownX = x; this.penDownY = y;
|
||||
}
|
||||
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));
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -168,7 +169,10 @@ export default class SerializablePath {
|
|||
cx = x / 2; cy = y / 2;
|
||||
} else {
|
||||
a = Math.sqrt(a / (rxcy + rycx));
|
||||
if (large == clockwise) a = -a;
|
||||
|
||||
if (large === clockwise) {
|
||||
a = -a;
|
||||
}
|
||||
let cxd = -a * cy * rx / ry,
|
||||
cyd = a * cx * ry / rx;
|
||||
cx = cos * cxd - sin * cyd + x / 2;
|
||||
|
@ -187,7 +191,9 @@ export default class SerializablePath {
|
|||
x += tX; y += tY;
|
||||
|
||||
// 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(
|
||||
tX, tY, this._pivotX = this.penX = x, this._pivotY = this.penY = y,
|
||||
cx, cy, rx, ry, sa, ea, !clockwise, rotation
|
||||
|
@ -204,7 +210,7 @@ export default class SerializablePath {
|
|||
};
|
||||
|
||||
close = () => {
|
||||
if (this.penDownX != null){
|
||||
if (!_.isNil(this.penDownX)){
|
||||
this.onClose(this.penX, this.penY, this.penX = this.penDownX, this.penY = this.penDownY);
|
||||
this.penDownX = null;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
*
|
||||
*
|
||||
*/
|
||||
import _ from 'lodash';
|
||||
import percentToFloat from './percentToFloat';
|
||||
|
||||
function percentageTransform(value) {
|
||||
|
@ -34,14 +35,14 @@ function percentageTransform(value) {
|
|||
return {
|
||||
percentage: float !== +value,
|
||||
value: float
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default class {
|
||||
constructor(props, list) {
|
||||
this.shape = {};
|
||||
list.forEach(name => {
|
||||
if (props[name] != null) {
|
||||
if (!_.isNil(props[name])) {
|
||||
this.shape[name] = percentageTransform(props[name]);
|
||||
}
|
||||
});
|
||||
|
@ -50,5 +51,5 @@ export default class {
|
|||
toJSON = () => {
|
||||
return this.shape;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
import _ from 'lodash';
|
||||
export default class {
|
||||
constructor(xx, yx, xy, yy, x, y){
|
||||
if (xx && typeof xx === 'object'){
|
||||
yx = xx.yx; yy = xx.yy; y = xx.y;
|
||||
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.xy = xy || 0;
|
||||
this.yy = yy == null ? 1 : yy;
|
||||
this.x = (x == null ? this.x : x) || 0;
|
||||
this.y = (y == null ? this.y : y) || 0;
|
||||
this.yy = _.isNil(yy) ? 1 : yy;
|
||||
this.x = (_.isNil(x) ? this.x : x) || 0;
|
||||
this.y = (_.isNil(y) ? this.y : y) || 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -56,11 +57,11 @@ export default class {
|
|||
};
|
||||
|
||||
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) => {
|
||||
if (x == null || y == null){
|
||||
if (_.isNil(x) || _.isNil(y)){
|
||||
x = (this.left || 0) + (this.width || 0) / 2;
|
||||
y = (this.top || 0) + (this.height || 0) / 2;
|
||||
}
|
||||
|
@ -117,7 +118,7 @@ export default class {
|
|||
c = this.xy, d = this.yy,
|
||||
e = this.x, f = this.y;
|
||||
var det = b * c - a * d;
|
||||
if (det == 0) {
|
||||
if (det === 0) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import _ from 'lodash';
|
||||
|
||||
function arrayDiffer(a, b) {
|
||||
if (a == null) {
|
||||
if (_.isNil(a)) {
|
||||
return true;
|
||||
}
|
||||
if (a.length !== b.length) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import SerializablePath from 'react-native/Libraries/ART/ARTSerializablePath';
|
||||
|
||||
import _ from 'lodash';
|
||||
const newLine = /\n/g;
|
||||
const defaultFontFamily = '"Helvetica Neue", "Helvetica", Arial';
|
||||
const fontRegExp = /^\s*((?:(?:normal|bold|italic)\s+)*)(?:(\d+(?:\.\d+)?)[ptexm%]*(?:\s*\/.*?)?\s+)?\s*"?([^"]*)/i;
|
||||
|
@ -58,7 +58,7 @@ function parseFontString(font) {
|
|||
}
|
||||
|
||||
function extractFont(font) {
|
||||
if (font == null) {
|
||||
if (_.isNil(font)) {
|
||||
return null;
|
||||
}
|
||||
if (typeof font === 'string') {
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
import Transform from '../Transform';
|
||||
let pooledTransform = new Transform;
|
||||
import _ from 'lodash';
|
||||
let pooledTransform = new Transform();
|
||||
|
||||
function transformToMatrix(props) {
|
||||
let scaleX = props.scaleX != null ? props.scaleX :
|
||||
props.scale != null ? props.scale : 1;
|
||||
let scaleY = props.scaleY != null ? props.scaleY :
|
||||
props.scale != null ? props.scale : 1;
|
||||
let scaleX = !_.isNil(props.scaleX) ? props.scaleX :
|
||||
!_.isNil(props.scale) ? props.scale : 1;
|
||||
let scaleY = !_.isNil(props.scaleY) ? props.scaleY :
|
||||
!_.isNil(props.scale) ? props.scale : 1;
|
||||
|
||||
pooledTransform
|
||||
.transformTo(1, 0, 0, 1, 0, 0)
|
||||
|
@ -13,7 +14,7 @@ function transformToMatrix(props) {
|
|||
.rotate(props.rotation || 0, props.originX, props.originY)
|
||||
.scale(scaleX, scaleY, props.originX, props.originY);
|
||||
|
||||
if (props.transform != null) {
|
||||
if (!_.isNil(props.transform)) {
|
||||
pooledTransform.transform(props.transform);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
"ART",
|
||||
"VML"
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "eslint ./"
|
||||
},
|
||||
"dependencies": {
|
||||
"color": "^0.11.1",
|
||||
"lodash": "^4.0.0"
|
||||
|
|
Загрузка…
Ссылка в новой задаче