diff --git a/Example/examples/Gradients.js b/Example/examples/Gradients.js
index b97d737a..fb723b2f 100644
--- a/Example/examples/Gradients.js
+++ b/Example/examples/Gradients.js
@@ -94,32 +94,6 @@ class RadialGradientExample extends Component{
}
}
-class RadialGradientPart extends Component{
- static title = 'Define another ellipse with a radial gradient from white to blue';
- render() {
- return ;
- }
-}
-
class RadialGradientPercent extends Component{
static title = 'Define a radial gradient in percent unit';
render() {
@@ -154,7 +128,7 @@ class FillGradientWithOpacity extends Component{
width="300"
>
-
+
+
+
+
+
+
+
+
+ ;
+ }
+}
+
+
const icon = ;
}
}
@@ -68,7 +68,7 @@ class EvenOddPolygon extends Component{
height="105"
width="105"
>
-
+
-
+
;
}
}
@@ -85,17 +85,17 @@ const icon = ;
-const samples = [PolygonExample, FourSidePolygon, StarPolygon];
+const samples = [PolygonExample, FourSidePolygon, StarPolygon, EvenOddPolygon];
export {
icon,
diff --git a/Example/examples/Svg.js b/Example/examples/Svg.js
index d0720b01..4adb0f63 100644
--- a/Example/examples/Svg.js
+++ b/Example/examples/Svg.js
@@ -106,7 +106,7 @@ const icon =
;
-const samples = [SvgExample, SvgOpacity ,SvgViewbox];
+const samples = [SvgExample, SvgOpacity, SvgViewbox];
export {
icon,
diff --git a/Example/examples/Text.js b/Example/examples/Text.js
index 2f70594a..36e41190 100644
--- a/Example/examples/Text.js
+++ b/Example/examples/Text.js
@@ -112,7 +112,7 @@ const icon = ;
-const samples = [TextExample, TextRotate, TextStroke];
+const samples = [TextExample, TextRotate, TextStroke, TextPath];
export {
icon,
diff --git a/Example/ios/ArtSvgExample.xcodeproj/project.pbxproj b/Example/ios/ArtSvgExample.xcodeproj/project.pbxproj
deleted file mode 100644
index 57b1412c..00000000
--- a/Example/ios/ArtSvgExample.xcodeproj/project.pbxproj
+++ /dev/null
@@ -1,792 +0,0 @@
-// !$*UTF8*$!
-{
- archiveVersion = 1;
- classes = {
- };
- objectVersion = 46;
- objects = {
-
-/* Begin PBXBuildFile section */
- 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
- 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
- 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 */; };
- 106F01161C50C16F00B58F21 /* libART.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 106F010B1C50C16200B58F21 /* libART.a */; };
- 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; };
- 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; };
- 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; };
- 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
- 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; };
- 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
- 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 */; };
-/* End PBXBuildFile section */
-
-/* Begin PBXContainerItemProxy section */
- 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = 134814201AA4EA6300B7C361;
- remoteInfo = RCTActionSheet;
- };
- 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = 134814201AA4EA6300B7C361;
- remoteInfo = RCTGeolocation;
- };
- 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = 58B5115D1A9E6B3D00147676;
- remoteInfo = RCTImage;
- };
- 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = 58B511DB1A9E6C8500147676;
- remoteInfo = RCTNetwork;
- };
- 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = 832C81801AAF6DEF007FA2F7;
- remoteInfo = RCTVibration;
- };
- 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
- proxyType = 1;
- remoteGlobalIDString = 13B07F861A680F5B00A75B9A;
- remoteInfo = ArtSvgExample;
- };
- 106F010A1C50C16200B58F21 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 106F01061C50C16200B58F21 /* ART.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = 0CF68AC11AF0540F00FF9E5C;
- remoteInfo = ART;
- };
- 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = 134814201AA4EA6300B7C361;
- remoteInfo = RCTSettings;
- };
- 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = 3C86DF461ADF2C930047B81A;
- remoteInfo = RCTWebSocket;
- };
- 146834031AC3E56700842450 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192;
- remoteInfo = React;
- };
- 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = 134814201AA4EA6300B7C361;
- remoteInfo = RCTLinking;
- };
- 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = 58B5119B1A9E6C1200147676;
- remoteInfo = RCTText;
- };
-/* End PBXContainerItemProxy section */
-
-/* Begin PBXFileReference section */
- 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = 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 = ""; };
- 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = "../node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj"; sourceTree = ""; };
- 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = ""; };
- 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = ""; };
- 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = ""; };
- 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 = ""; };
- 00E356F21AD99517003FC87E /* ArtSvgExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ArtSvgExampleTests.m; sourceTree = ""; };
- 106F01061C50C16200B58F21 /* ART.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ART.xcodeproj; path = "../node_modules/react-native/Libraries/ART/ART.xcodeproj"; sourceTree = ""; };
- 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = ""; };
- 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = ""; };
- 13B07F961A680F5B00A75B9A /* ArtSvgExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ArtSvgExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
- 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = ArtSvgExample/AppDelegate.h; sourceTree = ""; };
- 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = ArtSvgExample/AppDelegate.m; sourceTree = ""; };
- 13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; };
- 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = ArtSvgExample/Images.xcassets; sourceTree = ""; };
- 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = ArtSvgExample/Info.plist; sourceTree = ""; };
- 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = ArtSvgExample/main.m; sourceTree = ""; };
- 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = ""; };
- 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; };
- 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = ""; };
-/* End PBXFileReference section */
-
-/* Begin PBXFrameworksBuildPhase section */
- 00E356EB1AD99517003FC87E /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
- 13B07F8C1A680F5B00A75B9A /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 106F01161C50C16F00B58F21 /* libART.a in Frameworks */,
- 146834051AC3E58100842450 /* libReact.a in Frameworks */,
- 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */,
- 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */,
- 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */,
- 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */,
- 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */,
- 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */,
- 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */,
- 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
- 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXFrameworksBuildPhase section */
-
-/* Begin PBXGroup section */
- 00C302A81ABCB8CE00DB3ED1 /* Products */ = {
- isa = PBXGroup;
- children = (
- 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */,
- );
- name = Products;
- sourceTree = "";
- };
- 00C302B61ABCB90400DB3ED1 /* Products */ = {
- isa = PBXGroup;
- children = (
- 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */,
- );
- name = Products;
- sourceTree = "";
- };
- 00C302BC1ABCB91800DB3ED1 /* Products */ = {
- isa = PBXGroup;
- children = (
- 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */,
- );
- name = Products;
- sourceTree = "";
- };
- 00C302D41ABCB9D200DB3ED1 /* Products */ = {
- isa = PBXGroup;
- children = (
- 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */,
- );
- name = Products;
- sourceTree = "";
- };
- 00C302E01ABCB9EE00DB3ED1 /* Products */ = {
- isa = PBXGroup;
- children = (
- 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */,
- );
- name = Products;
- sourceTree = "";
- };
- 00E356EF1AD99517003FC87E /* ArtSvgExampleTests */ = {
- isa = PBXGroup;
- children = (
- 00E356F21AD99517003FC87E /* ArtSvgExampleTests.m */,
- 00E356F01AD99517003FC87E /* Supporting Files */,
- );
- path = ArtSvgExampleTests;
- sourceTree = "";
- };
- 00E356F01AD99517003FC87E /* Supporting Files */ = {
- isa = PBXGroup;
- children = (
- 00E356F11AD99517003FC87E /* Info.plist */,
- );
- name = "Supporting Files";
- sourceTree = "";
- };
- 106F01071C50C16200B58F21 /* Products */ = {
- isa = PBXGroup;
- children = (
- 106F010B1C50C16200B58F21 /* libART.a */,
- );
- name = Products;
- sourceTree = "";
- };
- 139105B71AF99BAD00B5F7CC /* Products */ = {
- isa = PBXGroup;
- children = (
- 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */,
- );
- name = Products;
- sourceTree = "";
- };
- 139FDEE71B06529A00C62182 /* Products */ = {
- isa = PBXGroup;
- children = (
- 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */,
- );
- name = Products;
- sourceTree = "";
- };
- 13B07FAE1A68108700A75B9A /* ArtSvgExample */ = {
- isa = PBXGroup;
- children = (
- 008F07F21AC5B25A0029DE68 /* main.jsbundle */,
- 13B07FAF1A68108700A75B9A /* AppDelegate.h */,
- 13B07FB01A68108700A75B9A /* AppDelegate.m */,
- 13B07FB51A68108700A75B9A /* Images.xcassets */,
- 13B07FB61A68108700A75B9A /* Info.plist */,
- 13B07FB11A68108700A75B9A /* LaunchScreen.xib */,
- 13B07FB71A68108700A75B9A /* main.m */,
- );
- name = ArtSvgExample;
- sourceTree = "";
- };
- 146834001AC3E56700842450 /* Products */ = {
- isa = PBXGroup;
- children = (
- 146834041AC3E56700842450 /* libReact.a */,
- );
- name = Products;
- sourceTree = "";
- };
- 78C398B11ACF4ADC00677621 /* Products */ = {
- isa = PBXGroup;
- children = (
- 78C398B91ACF4ADC00677621 /* libRCTLinking.a */,
- );
- name = Products;
- sourceTree = "";
- };
- 832341AE1AAA6A7D00B99B32 /* Libraries */ = {
- isa = PBXGroup;
- children = (
- 106F01061C50C16200B58F21 /* ART.xcodeproj */,
- 146833FF1AC3E56700842450 /* React.xcodeproj */,
- 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */,
- 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */,
- 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */,
- 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */,
- 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */,
- 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */,
- 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */,
- 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
- 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
- );
- name = Libraries;
- sourceTree = "";
- };
- 832341B11AAA6A8300B99B32 /* Products */ = {
- isa = PBXGroup;
- children = (
- 832341B51AAA6A8300B99B32 /* libRCTText.a */,
- );
- name = Products;
- sourceTree = "";
- };
- 83CBB9F61A601CBA00E9B192 = {
- isa = PBXGroup;
- children = (
- 13B07FAE1A68108700A75B9A /* ArtSvgExample */,
- 832341AE1AAA6A7D00B99B32 /* Libraries */,
- 00E356EF1AD99517003FC87E /* ArtSvgExampleTests */,
- 83CBBA001A601CBA00E9B192 /* Products */,
- );
- indentWidth = 2;
- sourceTree = "";
- tabWidth = 2;
- };
- 83CBBA001A601CBA00E9B192 /* Products */ = {
- isa = PBXGroup;
- children = (
- 13B07F961A680F5B00A75B9A /* ArtSvgExample.app */,
- 00E356EE1AD99517003FC87E /* ArtSvgExampleTests.xctest */,
- );
- name = Products;
- sourceTree = "";
- };
-/* 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" */;
- buildPhases = (
- 13B07F871A680F5B00A75B9A /* Sources */,
- 13B07F8C1A680F5B00A75B9A /* Frameworks */,
- 13B07F8E1A680F5B00A75B9A /* Resources */,
- 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
- );
- buildRules = (
- );
- dependencies = (
- );
- name = ArtSvgExample;
- productName = "Hello World";
- productReference = 13B07F961A680F5B00A75B9A /* ArtSvgExample.app */;
- productType = "com.apple.product-type.application";
- };
-/* End PBXNativeTarget section */
-
-/* Begin PBXProject section */
- 83CBB9F71A601CBA00E9B192 /* Project object */ = {
- isa = PBXProject;
- attributes = {
- LastUpgradeCheck = 0610;
- ORGANIZATIONNAME = Facebook;
- TargetAttributes = {
- 00E356ED1AD99517003FC87E = {
- CreatedOnToolsVersion = 6.2;
- TestTargetID = 13B07F861A680F5B00A75B9A;
- };
- };
- };
- buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "ArtSvgExample" */;
- compatibilityVersion = "Xcode 3.2";
- developmentRegion = English;
- hasScannedForEncodings = 0;
- knownRegions = (
- en,
- Base,
- );
- mainGroup = 83CBB9F61A601CBA00E9B192;
- productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */;
- projectDirPath = "";
- projectReferences = (
- {
- ProductGroup = 106F01071C50C16200B58F21 /* Products */;
- ProjectRef = 106F01061C50C16200B58F21 /* ART.xcodeproj */;
- },
- {
- ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */;
- ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */;
- },
- {
- ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */;
- ProjectRef = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */;
- },
- {
- ProductGroup = 00C302BC1ABCB91800DB3ED1 /* Products */;
- ProjectRef = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */;
- },
- {
- ProductGroup = 78C398B11ACF4ADC00677621 /* Products */;
- ProjectRef = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */;
- },
- {
- ProductGroup = 00C302D41ABCB9D200DB3ED1 /* Products */;
- ProjectRef = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */;
- },
- {
- ProductGroup = 139105B71AF99BAD00B5F7CC /* Products */;
- ProjectRef = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */;
- },
- {
- ProductGroup = 832341B11AAA6A8300B99B32 /* Products */;
- ProjectRef = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */;
- },
- {
- ProductGroup = 00C302E01ABCB9EE00DB3ED1 /* Products */;
- ProjectRef = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */;
- },
- {
- ProductGroup = 139FDEE71B06529A00C62182 /* Products */;
- ProjectRef = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */;
- },
- {
- ProductGroup = 146834001AC3E56700842450 /* Products */;
- ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */;
- },
- );
- projectRoot = "";
- targets = (
- 13B07F861A680F5B00A75B9A /* ArtSvgExample */,
- 00E356ED1AD99517003FC87E /* ArtSvgExampleTests */,
- );
- };
-/* End PBXProject section */
-
-/* Begin PBXReferenceProxy section */
- 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */ = {
- isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libRCTActionSheet.a;
- remoteRef = 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */ = {
- isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libRCTGeolocation.a;
- remoteRef = 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */ = {
- isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libRCTImage.a;
- remoteRef = 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */ = {
- isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libRCTNetwork.a;
- remoteRef = 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */ = {
- isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libRCTVibration.a;
- remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- 106F010B1C50C16200B58F21 /* libART.a */ = {
- isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libART.a;
- remoteRef = 106F010A1C50C16200B58F21 /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */ = {
- isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libRCTSettings.a;
- remoteRef = 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */ = {
- isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libRCTWebSocket.a;
- remoteRef = 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- 146834041AC3E56700842450 /* libReact.a */ = {
- isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libReact.a;
- remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- 78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = {
- isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libRCTLinking.a;
- remoteRef = 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
- 832341B51AAA6A8300B99B32 /* libRCTText.a */ = {
- isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libRCTText.a;
- remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
-/* End PBXReferenceProxy section */
-
-/* Begin PBXResourcesBuildPhase section */
- 00E356EC1AD99517003FC87E /* Resources */ = {
- isa = PBXResourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
- 13B07F8E1A680F5B00A75B9A /* Resources */ = {
- isa = PBXResourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
- 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXResourcesBuildPhase section */
-
-/* Begin PBXShellScriptBuildPhase section */
- 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = {
- isa = PBXShellScriptBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- inputPaths = (
- );
- name = "Bundle React Native code and images";
- outputPaths = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- shellPath = /bin/sh;
- shellScript = "../node_modules/react-native/packager/react-native-xcode.sh";
- };
-/* 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;
- files = (
- 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */,
- 13B07FC11A68108700A75B9A /* main.m in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* 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;
- children = (
- 13B07FB21A68108700A75B9A /* Base */,
- );
- name = LaunchScreen.xib;
- path = ArtSvgExample;
- sourceTree = "";
- };
-/* 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 = {
- ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
- DEAD_CODE_STRIPPING = NO;
- HEADER_SEARCH_PATHS = (
- "$(inherited)",
- /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
- "$(SRCROOT)/../node_modules/react-native/React/**",
- );
- INFOPLIST_FILE = ArtSvgExample/Info.plist;
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
- OTHER_LDFLAGS = "-ObjC";
- PRODUCT_NAME = ArtSvgExample;
- };
- name = Debug;
- };
- 13B07F951A680F5B00A75B9A /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
- HEADER_SEARCH_PATHS = (
- "$(inherited)",
- /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
- "$(SRCROOT)/../node_modules/react-native/React/**",
- );
- INFOPLIST_FILE = ArtSvgExample/Info.plist;
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
- OTHER_LDFLAGS = "-ObjC";
- PRODUCT_NAME = ArtSvgExample;
- };
- name = Release;
- };
- 83CBBA201A601CBA00E9B192 /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
- CLANG_CXX_LIBRARY = "libc++";
- CLANG_ENABLE_MODULES = YES;
- CLANG_ENABLE_OBJC_ARC = YES;
- CLANG_WARN_BOOL_CONVERSION = YES;
- CLANG_WARN_CONSTANT_CONVERSION = YES;
- CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
- CLANG_WARN_EMPTY_BODY = YES;
- CLANG_WARN_ENUM_CONVERSION = YES;
- CLANG_WARN_INT_CONVERSION = YES;
- CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
- CLANG_WARN_UNREACHABLE_CODE = YES;
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
- COPY_PHASE_STRIP = NO;
- ENABLE_STRICT_OBJC_MSGSEND = YES;
- GCC_C_LANGUAGE_STANDARD = gnu99;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_OPTIMIZATION_LEVEL = 0;
- GCC_PREPROCESSOR_DEFINITIONS = (
- "DEBUG=1",
- "$(inherited)",
- );
- GCC_SYMBOLS_PRIVATE_EXTERN = NO;
- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
- GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
- GCC_WARN_UNDECLARED_SELECTOR = YES;
- GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
- GCC_WARN_UNUSED_FUNCTION = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- HEADER_SEARCH_PATHS = (
- "$(inherited)",
- /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
- "$(SRCROOT)/../node_modules/react-native/React/**",
- );
- IPHONEOS_DEPLOYMENT_TARGET = 7.0;
- MTL_ENABLE_DEBUG_INFO = YES;
- ONLY_ACTIVE_ARCH = YES;
- SDKROOT = iphoneos;
- };
- name = Debug;
- };
- 83CBBA211A601CBA00E9B192 /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
- CLANG_CXX_LIBRARY = "libc++";
- CLANG_ENABLE_MODULES = YES;
- CLANG_ENABLE_OBJC_ARC = YES;
- CLANG_WARN_BOOL_CONVERSION = YES;
- CLANG_WARN_CONSTANT_CONVERSION = YES;
- CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
- CLANG_WARN_EMPTY_BODY = YES;
- CLANG_WARN_ENUM_CONVERSION = YES;
- CLANG_WARN_INT_CONVERSION = YES;
- CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
- CLANG_WARN_UNREACHABLE_CODE = YES;
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
- COPY_PHASE_STRIP = YES;
- ENABLE_NS_ASSERTIONS = NO;
- ENABLE_STRICT_OBJC_MSGSEND = YES;
- GCC_C_LANGUAGE_STANDARD = gnu99;
- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
- GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
- GCC_WARN_UNDECLARED_SELECTOR = YES;
- GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
- GCC_WARN_UNUSED_FUNCTION = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- HEADER_SEARCH_PATHS = (
- "$(inherited)",
- /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
- "$(SRCROOT)/../node_modules/react-native/React/**",
- );
- IPHONEOS_DEPLOYMENT_TARGET = 7.0;
- MTL_ENABLE_DEBUG_INFO = NO;
- SDKROOT = iphoneos;
- VALIDATE_PRODUCT = YES;
- };
- name = Release;
- };
-/* 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 = (
- 13B07F941A680F5B00A75B9A /* Debug */,
- 13B07F951A680F5B00A75B9A /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
- 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "ArtSvgExample" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 83CBBA201A601CBA00E9B192 /* Debug */,
- 83CBBA211A601CBA00E9B192 /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
-/* End XCConfigurationList section */
- };
- rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */;
-}
diff --git a/Example/ios/ArtSvgExample.xcodeproj/xcshareddata/xcschemes/ArtSvgExample.xcscheme b/Example/ios/ArtSvgExample.xcodeproj/xcshareddata/xcschemes/ArtSvgExample.xcscheme
deleted file mode 100644
index 20da5281..00000000
--- a/Example/ios/ArtSvgExample.xcodeproj/xcshareddata/xcschemes/ArtSvgExample.xcscheme
+++ /dev/null
@@ -1,112 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Example/ios/ArtSvgExample/AppDelegate.m b/Example/ios/ArtSvgExample/AppDelegate.m
deleted file mode 100644
index 9a61bad2..00000000
--- a/Example/ios/ArtSvgExample/AppDelegate.m
+++ /dev/null
@@ -1,57 +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 "AppDelegate.h"
-
-#import "RCTRootView.h"
-
-@implementation AppDelegate
-
-- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
-{
- NSURL *jsCodeLocation;
-
- /**
- * Loading JavaScript code - uncomment the one you want.
- *
- * OPTION 1
- * Load from development server. Start the server from the repository root:
- *
- * $ npm start
- *
- * To run on device, change `localhost` to the IP address of your computer
- * (you can get this by typing `ifconfig` into the terminal and selecting the
- * `inet` value under `en0:`) and make sure your computer and iOS device are
- * on the same Wi-Fi network.
- */
-
- jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];
-
- /**
- * OPTION 2
- * Load from pre-bundled file on disk. The static bundle is automatically
- * generated by "Bundle React Native code and images" build step.
- */
-
-// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
-
- RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
- moduleName:@"ArtSvgExample"
- initialProperties:nil
- launchOptions:launchOptions];
-
- self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
- UIViewController *rootViewController = [UIViewController new];
- rootViewController.view = rootView;
- self.window.rootViewController = rootViewController;
- [self.window makeKeyAndVisible];
- return YES;
-}
-
-@end
diff --git a/Example/ios/ArtSvgExample/Base.lproj/LaunchScreen.xib b/Example/ios/ArtSvgExample/Base.lproj/LaunchScreen.xib
deleted file mode 100644
index 02cd9345..00000000
--- a/Example/ios/ArtSvgExample/Base.lproj/LaunchScreen.xib
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Example/ios/ArtSvgExample/Images.xcassets/AppIcon.appiconset/Contents.json b/Example/ios/ArtSvgExample/Images.xcassets/AppIcon.appiconset/Contents.json
deleted file mode 100644
index 118c98f7..00000000
--- a/Example/ios/ArtSvgExample/Images.xcassets/AppIcon.appiconset/Contents.json
+++ /dev/null
@@ -1,38 +0,0 @@
-{
- "images" : [
- {
- "idiom" : "iphone",
- "size" : "29x29",
- "scale" : "2x"
- },
- {
- "idiom" : "iphone",
- "size" : "29x29",
- "scale" : "3x"
- },
- {
- "idiom" : "iphone",
- "size" : "40x40",
- "scale" : "2x"
- },
- {
- "idiom" : "iphone",
- "size" : "40x40",
- "scale" : "3x"
- },
- {
- "idiom" : "iphone",
- "size" : "60x60",
- "scale" : "2x"
- },
- {
- "idiom" : "iphone",
- "size" : "60x60",
- "scale" : "3x"
- }
- ],
- "info" : {
- "version" : 1,
- "author" : "xcode"
- }
-}
\ No newline at end of file
diff --git a/Example/ios/ArtSvgExample/Info.plist b/Example/ios/ArtSvgExample/Info.plist
deleted file mode 100644
index 91963b26..00000000
--- a/Example/ios/ArtSvgExample/Info.plist
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
- CFBundleDevelopmentRegion
- en
- CFBundleExecutable
- $(EXECUTABLE_NAME)
- CFBundleIdentifier
- org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)
- CFBundleInfoDictionaryVersion
- 6.0
- CFBundleName
- $(PRODUCT_NAME)
- CFBundlePackageType
- APPL
- CFBundleShortVersionString
- 1.0
- CFBundleSignature
- ????
- CFBundleVersion
- 1
- LSRequiresIPhoneOS
-
- UILaunchStoryboardName
- LaunchScreen
- UIRequiredDeviceCapabilities
-
- armv7
-
- UISupportedInterfaceOrientations
-
- UIInterfaceOrientationPortrait
- UIInterfaceOrientationLandscapeLeft
- UIInterfaceOrientationLandscapeRight
-
- UIViewControllerBasedStatusBarAppearance
-
- NSLocationWhenInUseUsageDescription
-
- NSAppTransportSecurity
-
-
- NSAllowsArbitraryLoads
-
-
-
-
diff --git a/Example/ios/ArtSvgExampleTests/ArtSvgExampleTests.m b/Example/ios/ArtSvgExampleTests/ArtSvgExampleTests.m
deleted file mode 100644
index 469ea87c..00000000
--- a/Example/ios/ArtSvgExampleTests/ArtSvgExampleTests.m
+++ /dev/null
@@ -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
-#import
-
-#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
diff --git a/Example/ios/ArtSvgExampleTests/Info.plist b/Example/ios/ArtSvgExampleTests/Info.plist
deleted file mode 100644
index 886825cc..00000000
--- a/Example/ios/ArtSvgExampleTests/Info.plist
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
- CFBundleDevelopmentRegion
- en
- CFBundleExecutable
- $(EXECUTABLE_NAME)
- CFBundleIdentifier
- org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)
- CFBundleInfoDictionaryVersion
- 6.0
- CFBundleName
- $(PRODUCT_NAME)
- CFBundlePackageType
- BNDL
- CFBundleShortVersionString
- 1.0
- CFBundleSignature
- ????
- CFBundleVersion
- 1
-
-
diff --git a/README.md b/README.md
index 56186b0e..258557bd 100644
--- a/README.md
+++ b/README.md
@@ -573,6 +573,7 @@ npm install
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
+7. fix propTypes
#### Thanks:
diff --git a/elements/Defs.js b/elements/Defs.js
index 5b01ffe2..abb53c22 100644
--- a/elements/Defs.js
+++ b/elements/Defs.js
@@ -1,11 +1,10 @@
import React, {
Children,
Component,
- ART,
cloneElement,
PropTypes
} from 'react-native';
-let {Group} = ART;
+import {NativeGroup} from './G';
let map = {};
import LinearGradient from './LinearGradient';
@@ -44,7 +43,7 @@ class DefsItem extends Component{
};
render() {
- return this.props.visible ? onlyChild(this.props.children) : ;
+ return this.props.visible ? onlyChild(this.props.children) : ;
}
}
@@ -71,7 +70,7 @@ class DefsUse extends Component{
}
console.warn(`Invalid href: '${href}' for Use element.\n Please check if '${href}' if defined`);
- return ;
+ return ;
}
}
@@ -89,15 +88,18 @@ class Defs extends Component{
});
}
if (child.props.id) {
- return {child};
+ return {child};
}
});
};
render() {
- return
+ return
{this.getChildren()}
- ;
+ ;
}
}
diff --git a/elements/Ellipse.js b/elements/Ellipse.js
index 462ff06f..a35e7ed6 100644
--- a/elements/Ellipse.js
+++ b/elements/Ellipse.js
@@ -3,7 +3,6 @@ import React, {
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';
diff --git a/elements/G.js b/elements/G.js
index 671afce7..e577c037 100644
--- a/elements/G.js
+++ b/elements/G.js
@@ -1,13 +1,12 @@
import React, {
- ART,
Component,
Children,
- cloneElement
+ cloneElement,
+ requireNativeComponent
} from 'react-native';
-let {
- Group
-} = ART;
+import createReactNativeComponentClass from 'react-native/Libraries/ReactNative/createReactNativeComponentClass';
import Defs from './Defs';
+import {GroupAttributes} from '../lib/attributes';
const transformProps = {
scale: null,
@@ -20,8 +19,7 @@ const transformProps = {
originX: null,
originY: null
};
-
-import transformFilter from '../lib/transformFilter';
+import extractProps from '../lib/extractProps';
class G extends Component{
static displayName = 'G';
@@ -42,16 +40,26 @@ class G extends Component{
svgId={this.props.svgId}
visible={true}
>
-
+
;
} else {
- return {this.getChildren()};
+ return
+ {this.getChildren()}
+ ;
}
}
}
+var NativeGroup = createReactNativeComponentClass({
+ validAttributes: GroupAttributes,
+ uiViewClassName: 'RNSVGGroup'
+});
export default G;
+export {
+ NativeGroup
+}
diff --git a/elements/Gradient.js b/elements/Gradient.js
index f2fbacb2..9c1ebbda 100644
--- a/elements/Gradient.js
+++ b/elements/Gradient.js
@@ -1,13 +1,10 @@
import React, {
Component,
PropTypes,
- ART,
Children
} from 'react-native';
-let {
- Group
-} = ART;
-import {set, remove} from '../lib/fillFilter';
+import {NativeGroup} from './G';
+import {set, remove} from '../lib/extractFill';
import percentFactory from '../lib/percentFactory';
import percentToFloat from '../lib/percentToFloat';
import Stop from './Stop';
@@ -51,7 +48,7 @@ class RadialGradient extends Component{
console.warn(`'RadialGradient' can only receive 'Stop' elements as children`);
}
});
- return ;
+ return ;
}
}
diff --git a/elements/Line.js b/elements/Line.js
index b518a089..aad6119b 100644
--- a/elements/Line.js
+++ b/elements/Line.js
@@ -1,16 +1,10 @@
import React, {
Component,
PropTypes,
- ReactNativeBaseComponent,
- ART
+ ReactNativeBaseComponent
} from 'react-native';
-let {
- Shape,
- Path
- } = ART;
+import Path from './Path';
-import strokeFilter from '../lib/strokeFilter';
-import transformFilter from '../lib/transformFilter';
let propType = PropTypes.oneOfType([PropTypes.string, PropTypes.number]);
class Line extends Component{
@@ -29,29 +23,10 @@ class Line extends Component{
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 ;
}
diff --git a/elements/LinearGradient.js b/elements/LinearGradient.js
index aed2b8c9..e2f18bac 100644
--- a/elements/LinearGradient.js
+++ b/elements/LinearGradient.js
@@ -1,23 +1,49 @@
import React, {
Component,
PropTypes,
- ART,
Children
} from 'react-native';
-let {
- LinearGradient: ARTLinearGradient
-} = ART;
+
import stopsOpacity from '../lib/stopsOpacity';
+import numberProp from '../lib/numberProp';
import Gradient from './Gradient';
-let propType = PropTypes.oneOfType([PropTypes.string, PropTypes.number]);
+import {LINEAR_GRADIENT} from '../lib/extractBrush';
+import {insertColorStopsIntoArray} from '../lib/insertProcessor';
+
+function LinearGradientGenerator(stops, x1, y1, x2, y2) {
+ var type = LINEAR_GRADIENT;
+
+ if (arguments.length < 5) {
+ var angle = ((x1 == null) ? 270 : x1) * Math.PI / 180;
+
+ var x = Math.cos(angle);
+ var y = -Math.sin(angle);
+ var l = (Math.abs(x) + Math.abs(y)) / 2;
+
+ x *= l; y *= l;
+
+ x1 = 0.5 - x;
+ x2 = 0.5 + x;
+ y1 = 0.5 - y;
+ y2 = 0.5 + y;
+ this._bb = true;
+ } else {
+ this._bb = false;
+ }
+ var brushData = [type, +x1, +y1, +x2, +y2];
+ insertColorStopsIntoArray(stops, brushData, 5);
+ this._brush = brushData;
+}
+
+
class LinearGradient extends Gradient{
static displayName = 'LinearGradient';
static propTypes = {
- x1: propType,
- x2: propType,
- y1: propType,
- y2: propType,
- id: PropTypes.string
+ x1: numberProp,
+ x2: numberProp,
+ y1: numberProp,
+ y2: numberProp,
+ id: PropTypes.string.isRequired
};
render() {
@@ -31,7 +57,7 @@ class LinearGradient extends Gradient{
return super.render(
gradientProps,
function (factories, stops, boundingBox, opacity) {
- return new ARTLinearGradient(
+ return new LinearGradientGenerator(
stopsOpacity(stops, opacity),
factories[0](boundingBox.width),
factories[1](boundingBox.height),
@@ -40,7 +66,8 @@ class LinearGradient extends Gradient{
);
},
function (stops, opacity) {
- return new ARTLinearGradient(stopsOpacity(stops, opacity), ...gradientProps);
+ console.log(stopsOpacity(stops, opacity), ...gradientProps);
+ return new LinearGradientGenerator(stopsOpacity(stops, opacity), ...gradientProps);
}
);
}
diff --git a/elements/Path.js b/elements/Path.js
index e505a6e1..a1832fc7 100644
--- a/elements/Path.js
+++ b/elements/Path.js
@@ -1,22 +1,23 @@
import React, {
- ART,
Component,
PropTypes,
+ requireNativeComponent,
cloneElement
} from 'react-native';
-let {
- Shape
-} = ART;
-import Defs from './Defs';
-import calculateBoundingBox from '../lib/calculateBoundingBox';
-import fillFilter from '../lib/fillFilter';
-import strokeFilter from '../lib/strokeFilter';
-import transformFilter from '../lib/transformFilter';
+import Defs from './Defs';
+import createReactNativeComponentClass from 'react-native/Libraries/ReactNative/createReactNativeComponentClass';
+import calculateBoundingBox from '../lib/calculateBoundingBox';
+import extractProps from '../lib/extractProps';
+import SerializablePath from 'react-native/Libraries/ART/ARTSerializablePath';
+import {PathAttributes} from '../lib/attributes';
+
+
let propType = PropTypes.oneOfType([PropTypes.string, PropTypes.number]);
class Path extends Component{
static displayName = 'Path';
static propTypes = {
+ visible: PropTypes.bool,
d: PropTypes.string,
x: propType,
y: propType,
@@ -54,14 +55,21 @@ class Path extends Component{
;
}
- return ;
+
+ let d = new SerializablePath(props.d).toJSON();
+
+ return (
+
+ );
}
}
+let NativePath = createReactNativeComponentClass({
+ validAttributes: PathAttributes,
+ uiViewClassName: 'RNSVGPath'
+});
+
export default Path;
diff --git a/elements/Polygon.js b/elements/Polygon.js
index e4d8323e..d8d918fe 100644
--- a/elements/Polygon.js
+++ b/elements/Polygon.js
@@ -1,7 +1,6 @@
import React, {
Component,
- PropTypes,
- ART
+ PropTypes
} from 'react-native';
import Path from './Path';
diff --git a/elements/Polyline.js b/elements/Polyline.js
index b99bbc0b..ca607adc 100644
--- a/elements/Polyline.js
+++ b/elements/Polyline.js
@@ -1,7 +1,6 @@
import React, {
Component,
- PropTypes,
- ART
+ PropTypes
} from 'react-native';
import Path from './Path';
diff --git a/elements/RadialGradient.js b/elements/RadialGradient.js
index 24fcf87f..d1da5508 100644
--- a/elements/RadialGradient.js
+++ b/elements/RadialGradient.js
@@ -1,26 +1,53 @@
import React, {
Component,
PropTypes,
- ART,
Children
} from 'react-native';
-let {
- RadialGradient: ARTRadialGradient
-} = ART;
import stopsOpacity from '../lib/stopsOpacity';
+import numberProp from '../lib/numberProp';
import Gradient from './Gradient';
-let propType = PropTypes.oneOfType([PropTypes.string, PropTypes.number]);
+import {RADIAL_GRADIENT} from '../lib/extractBrush';
+import {insertDoubleColorStopsIntoArray} from '../lib/insertProcessor';
+
+
+function RadialGradientGenerator(stops, fx, fy, rx, ry, cx, cy) {
+ if (ry == null) {
+ ry = rx;
+ }
+ if (cx == null) {
+ cx = fx;
+ }
+ if (cy == null) {
+ cy = fy;
+ }
+ if (fx == null) {
+ // As a convenience we allow the whole radial gradient to cover the
+ // bounding box. We should consider dropping this API.
+ fx = fy = rx = ry = cx = cy = 0.5;
+ this._bb = true;
+ } else {
+ this._bb = false;
+ }
+ // The ART API expects the radial gradient to be repeated at the edges.
+ // To simulate this we render the gradient twice as large and add double
+ // color stops. Ideally this API would become more restrictive so that this
+ // extra work isn't needed.
+ var brushData = [RADIAL_GRADIENT, +fx, +fy, +rx * 2, +ry * 2, +cx, +cy];
+ insertDoubleColorStopsIntoArray(stops, brushData, 7);
+ this._brush = brushData;
+}
+
class RadialGradient extends Gradient{
static displayName = 'RadialGradient';
static propTypes = {
- fx: propType,
- fy: propType,
- rx: propType,
- ry: propType,
- cx: propType,
- cy: propType,
- r: propType,
- id: PropTypes.string
+ fx: numberProp,
+ fy: numberProp,
+ rx: numberProp,
+ ry: numberProp,
+ cx: numberProp,
+ cy: numberProp,
+ r: numberProp,
+ id: PropTypes.string.isRequired
};
render() {
@@ -34,15 +61,12 @@ class RadialGradient extends Gradient{
r
} = this.props;
- if (r) {
- rx = ry = +r;
- }
- let gradientProps = [fx, fy, rx, ry, cx, cy];
+ let gradientProps = [fx, fy, rx || r, ry || r, cx, cy];
return super.render(
gradientProps,
function (factories, stops, boundingBox, opacity) {
let {x1,y1,width, height} = boundingBox;
- return new ARTRadialGradient(
+ return new RadialGradientGenerator(
stopsOpacity(stops, opacity),
x1 + factories[0](width),
y1 + factories[1](height),
@@ -53,7 +77,7 @@ class RadialGradient extends Gradient{
);
},
function (stops, opacity) {
- return new ARTRadialGradient(stopsOpacity(stops, opacity), ...gradientProps);
+ return new RadialGradientGenerator(stopsOpacity(stops, opacity), ...gradientProps);
}
);
}
diff --git a/elements/Rect.js b/elements/Rect.js
index 19abd30e..e15e8c8c 100644
--- a/elements/Rect.js
+++ b/elements/Rect.js
@@ -1,7 +1,6 @@
import React, {
Component,
- PropTypes,
- ART
+ PropTypes
} from 'react-native';
import Path from './Path';
diff --git a/elements/Svg.js b/elements/Svg.js
index f1300a91..74e484c1 100644
--- a/elements/Svg.js
+++ b/elements/Svg.js
@@ -3,22 +3,24 @@ import React, {
PropTypes,
Children,
cloneElement,
- ART
+ View,
+ requireNativeComponent
} from 'react-native';
import extractViewbox from '../lib/extractViewbox';
import ViewBox from './ViewBox';
import _ from 'lodash';
-let {
- Surface
-} = ART;
+// Svg - Root node of all Svg elements
let id = 0;
class Svg extends Component{
static displayName = 'Svg';
- static propType = {
+ static propTypes = {
+ ...View.propTypes,
opacity: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
+ width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
+ height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
viewbox: PropTypes.string,
// TODO: complete other values of preserveAspectRatio
// http://www.justinmccandless.com/demos/viewbox/index.html
@@ -40,6 +42,22 @@ class Svg extends Component{
});
};
+ measureInWindow = (...args) => {
+ this.refs.root.measureInWindow(...args);
+ };
+
+ measure = (...args) => {
+ this.refs.root.measure(...args);
+ };
+
+ measureLayout = (...args) => {
+ this.refs.root.measureLayout(...args);
+ };
+
+ setNativeProps = (...args) => {
+ this.refs.root.setNativeProps(...args);
+ };
+
render() {
let {props} = this;
let opacity = +props.opacity;
@@ -52,19 +70,26 @@ class Svg extends Component{
{this.getChildren()}
: this.getChildren();
- return
- {content}
- ;
+ let width = +props.width || 0;
+ let height = +props.height || 0;
+
+ return (
+
+ {content}
+
+ );
}
}
+const NativeSvgView = requireNativeComponent('RNSVGSvgView', Svg);
+
export default Svg;
diff --git a/elements/Text.js b/elements/Text.js
index 17723b2d..1578c9f6 100644
--- a/elements/Text.js
+++ b/elements/Text.js
@@ -1,26 +1,20 @@
import React, {
- ART,
- Component,
- PropTypes
+ Component
} from 'react-native';
-
-let {
- Text:ARTText
-} = ART;
import Defs from './Defs';
+import createReactNativeComponentClass from 'react-native/Libraries/ReactNative/createReactNativeComponentClass';
+import extractProps from '../lib/extractProps';
+import extractText from '../lib/extractText';
+import {TextAttributes} from '../lib/attributes';
+import numberProp from '../lib/numberProp';
-import fillFilter from '../lib/fillFilter';
-import strokeFilter from '../lib/strokeFilter';
-import transformFilter from '../lib/transformFilter';
-
-const fontFamily = '"Helvetica Neue", "Helvetica", Arial';
class Text extends Component{
static displayName = 'Text';
static propTypes = {
- strokeLinecap: PropTypes.oneOf(['butt', 'square', 'round']),
- strokeCap: PropTypes.oneOf(['butt', 'square', 'round']),
- strokeLinejoin: PropTypes.oneOf(['miter', 'bevel', 'round']),
- strokeJoin: PropTypes.oneOf(['miter', 'bevel', 'round'])
+ x: numberProp,
+ y: numberProp,
+ dx: numberProp,
+ dy: numberProp
};
render() {
let {props} = this;
@@ -44,25 +38,19 @@ class Text extends Component{
;
}
-
// TODO: support percent gradients
- return ;
+ return (
+
+ );
}
}
+let NativeText = createReactNativeComponentClass({
+ validAttributes: TextAttributes,
+ uiViewClassName: 'RNSVGText'
+});
+
export default Text;
diff --git a/index.js b/index.js
index 2301cfda..6b44e21f 100644
--- a/index.js
+++ b/index.js
@@ -1,5 +1,4 @@
import React, {
- ART,
Component
} from 'react-native';
import Rect from './elements/Rect';
@@ -19,15 +18,10 @@ import LinearGradient from './elements/LinearGradient';
import RadialGradient from './elements/RadialGradient';
import Stop from './elements/Stop';
-let {
- Group
-} = ART;
-
export {
Svg,
Circle,
Ellipse,
- Group,
G,
Text,
Path,
diff --git a/ios/ART.xcodeproj/project.pbxproj b/ios/ART.xcodeproj/project.pbxproj
new file mode 100644
index 00000000..1f98a615
--- /dev/null
+++ b/ios/ART.xcodeproj/project.pbxproj
@@ -0,0 +1,371 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 0CF68B051AF0549300FF9E5C /* ARTGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68ADE1AF0549300FF9E5C /* ARTGroup.m */; };
+ 0CF68B061AF0549300FF9E5C /* ARTNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE01AF0549300FF9E5C /* ARTNode.m */; };
+ 0CF68B071AF0549300FF9E5C /* ARTRenderable.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE21AF0549300FF9E5C /* ARTRenderable.m */; };
+ 0CF68B081AF0549300FF9E5C /* ARTShape.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE41AF0549300FF9E5C /* ARTShape.m */; };
+ 0CF68B091AF0549300FF9E5C /* ARTSurfaceView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE61AF0549300FF9E5C /* ARTSurfaceView.m */; };
+ 0CF68B0A1AF0549300FF9E5C /* ARTText.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE81AF0549300FF9E5C /* ARTText.m */; };
+ 0CF68B0B1AF0549300FF9E5C /* ARTBrush.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AEC1AF0549300FF9E5C /* ARTBrush.m */; };
+ 0CF68B0C1AF0549300FF9E5C /* ARTLinearGradient.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AEE1AF0549300FF9E5C /* ARTLinearGradient.m */; };
+ 0CF68B0D1AF0549300FF9E5C /* ARTPattern.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AF01AF0549300FF9E5C /* ARTPattern.m */; };
+ 0CF68B0E1AF0549300FF9E5C /* ARTRadialGradient.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AF21AF0549300FF9E5C /* ARTRadialGradient.m */; };
+ 0CF68B0F1AF0549300FF9E5C /* ARTSolidColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AF41AF0549300FF9E5C /* ARTSolidColor.m */; };
+ 0CF68B101AF0549300FF9E5C /* RCTConvert+ART.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AF71AF0549300FF9E5C /* RCTConvert+ART.m */; };
+ 0CF68B111AF0549300FF9E5C /* ARTGroupManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AFA1AF0549300FF9E5C /* ARTGroupManager.m */; };
+ 0CF68B121AF0549300FF9E5C /* ARTNodeManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AFC1AF0549300FF9E5C /* ARTNodeManager.m */; };
+ 0CF68B131AF0549300FF9E5C /* ARTRenderableManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AFE1AF0549300FF9E5C /* ARTRenderableManager.m */; };
+ 0CF68B141AF0549300FF9E5C /* ARTShapeManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68B001AF0549300FF9E5C /* ARTShapeManager.m */; };
+ 0CF68B151AF0549300FF9E5C /* ARTSurfaceViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68B021AF0549300FF9E5C /* ARTSurfaceViewManager.m */; };
+ 0CF68B161AF0549300FF9E5C /* ARTTextManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68B041AF0549300FF9E5C /* ARTTextManager.m */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ 0CF68ABF1AF0540F00FF9E5C /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = "include/$(PRODUCT_NAME)";
+ dstSubfolderSpec = 16;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+ 0CF68AC11AF0540F00FF9E5C /* libART.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libART.a; sourceTree = BUILT_PRODUCTS_DIR; };
+ 0CF68ADB1AF0549300FF9E5C /* ARTCGFloatArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTCGFloatArray.h; sourceTree = ""; };
+ 0CF68ADC1AF0549300FF9E5C /* ARTContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTContainer.h; sourceTree = ""; };
+ 0CF68ADD1AF0549300FF9E5C /* ARTGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTGroup.h; sourceTree = ""; };
+ 0CF68ADE1AF0549300FF9E5C /* ARTGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTGroup.m; sourceTree = ""; };
+ 0CF68ADF1AF0549300FF9E5C /* ARTNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTNode.h; sourceTree = ""; };
+ 0CF68AE01AF0549300FF9E5C /* ARTNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTNode.m; sourceTree = ""; };
+ 0CF68AE11AF0549300FF9E5C /* ARTRenderable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTRenderable.h; sourceTree = ""; };
+ 0CF68AE21AF0549300FF9E5C /* ARTRenderable.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTRenderable.m; sourceTree = ""; };
+ 0CF68AE31AF0549300FF9E5C /* ARTShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTShape.h; sourceTree = ""; };
+ 0CF68AE41AF0549300FF9E5C /* ARTShape.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTShape.m; sourceTree = ""; };
+ 0CF68AE51AF0549300FF9E5C /* ARTSurfaceView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTSurfaceView.h; sourceTree = ""; };
+ 0CF68AE61AF0549300FF9E5C /* ARTSurfaceView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTSurfaceView.m; sourceTree = ""; };
+ 0CF68AE71AF0549300FF9E5C /* ARTText.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTText.h; sourceTree = ""; };
+ 0CF68AE81AF0549300FF9E5C /* ARTText.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTText.m; sourceTree = ""; };
+ 0CF68AE91AF0549300FF9E5C /* ARTTextFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTTextFrame.h; sourceTree = ""; };
+ 0CF68AEB1AF0549300FF9E5C /* ARTBrush.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTBrush.h; sourceTree = ""; };
+ 0CF68AEC1AF0549300FF9E5C /* ARTBrush.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTBrush.m; sourceTree = ""; };
+ 0CF68AED1AF0549300FF9E5C /* ARTLinearGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTLinearGradient.h; sourceTree = ""; };
+ 0CF68AEE1AF0549300FF9E5C /* ARTLinearGradient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTLinearGradient.m; sourceTree = ""; };
+ 0CF68AEF1AF0549300FF9E5C /* ARTPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTPattern.h; sourceTree = ""; };
+ 0CF68AF01AF0549300FF9E5C /* ARTPattern.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTPattern.m; sourceTree = ""; };
+ 0CF68AF11AF0549300FF9E5C /* ARTRadialGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTRadialGradient.h; sourceTree = ""; };
+ 0CF68AF21AF0549300FF9E5C /* ARTRadialGradient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTRadialGradient.m; sourceTree = ""; };
+ 0CF68AF31AF0549300FF9E5C /* ARTSolidColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTSolidColor.h; sourceTree = ""; };
+ 0CF68AF41AF0549300FF9E5C /* ARTSolidColor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTSolidColor.m; sourceTree = ""; };
+ 0CF68AF61AF0549300FF9E5C /* RCTConvert+ART.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RCTConvert+ART.h"; sourceTree = ""; };
+ 0CF68AF71AF0549300FF9E5C /* RCTConvert+ART.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RCTConvert+ART.m"; sourceTree = ""; };
+ 0CF68AF91AF0549300FF9E5C /* ARTGroupManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTGroupManager.h; sourceTree = ""; };
+ 0CF68AFA1AF0549300FF9E5C /* ARTGroupManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTGroupManager.m; sourceTree = ""; };
+ 0CF68AFB1AF0549300FF9E5C /* ARTNodeManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTNodeManager.h; sourceTree = ""; };
+ 0CF68AFC1AF0549300FF9E5C /* ARTNodeManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTNodeManager.m; sourceTree = ""; };
+ 0CF68AFD1AF0549300FF9E5C /* ARTRenderableManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTRenderableManager.h; sourceTree = ""; };
+ 0CF68AFE1AF0549300FF9E5C /* ARTRenderableManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTRenderableManager.m; sourceTree = ""; };
+ 0CF68AFF1AF0549300FF9E5C /* ARTShapeManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTShapeManager.h; sourceTree = ""; };
+ 0CF68B001AF0549300FF9E5C /* ARTShapeManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTShapeManager.m; sourceTree = ""; };
+ 0CF68B011AF0549300FF9E5C /* ARTSurfaceViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTSurfaceViewManager.h; sourceTree = ""; };
+ 0CF68B021AF0549300FF9E5C /* ARTSurfaceViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTSurfaceViewManager.m; sourceTree = ""; };
+ 0CF68B031AF0549300FF9E5C /* ARTTextManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARTTextManager.h; sourceTree = ""; };
+ 0CF68B041AF0549300FF9E5C /* ARTTextManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARTTextManager.m; sourceTree = ""; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 0CF68ABE1AF0540F00FF9E5C /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 0CF68AB81AF0540F00FF9E5C = {
+ isa = PBXGroup;
+ children = (
+ 0CF68AEA1AF0549300FF9E5C /* Brushes */,
+ 0CF68AF81AF0549300FF9E5C /* ViewManagers */,
+ 0CF68ADB1AF0549300FF9E5C /* ARTCGFloatArray.h */,
+ 0CF68ADC1AF0549300FF9E5C /* ARTContainer.h */,
+ 0CF68ADD1AF0549300FF9E5C /* ARTGroup.h */,
+ 0CF68ADE1AF0549300FF9E5C /* ARTGroup.m */,
+ 0CF68ADF1AF0549300FF9E5C /* ARTNode.h */,
+ 0CF68AE01AF0549300FF9E5C /* ARTNode.m */,
+ 0CF68AE11AF0549300FF9E5C /* ARTRenderable.h */,
+ 0CF68AE21AF0549300FF9E5C /* ARTRenderable.m */,
+ 0CF68AE31AF0549300FF9E5C /* ARTShape.h */,
+ 0CF68AE41AF0549300FF9E5C /* ARTShape.m */,
+ 0CF68AE51AF0549300FF9E5C /* ARTSurfaceView.h */,
+ 0CF68AE61AF0549300FF9E5C /* ARTSurfaceView.m */,
+ 0CF68AE71AF0549300FF9E5C /* ARTText.h */,
+ 0CF68AE81AF0549300FF9E5C /* ARTText.m */,
+ 0CF68AE91AF0549300FF9E5C /* ARTTextFrame.h */,
+ 0CF68AF61AF0549300FF9E5C /* RCTConvert+ART.h */,
+ 0CF68AF71AF0549300FF9E5C /* RCTConvert+ART.m */,
+ 0CF68AC21AF0540F00FF9E5C /* Products */,
+ );
+ sourceTree = "";
+ };
+ 0CF68AC21AF0540F00FF9E5C /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 0CF68AC11AF0540F00FF9E5C /* libART.a */,
+ );
+ name = Products;
+ sourceTree = "";
+ };
+ 0CF68AEA1AF0549300FF9E5C /* Brushes */ = {
+ isa = PBXGroup;
+ children = (
+ 0CF68AEB1AF0549300FF9E5C /* ARTBrush.h */,
+ 0CF68AEC1AF0549300FF9E5C /* ARTBrush.m */,
+ 0CF68AED1AF0549300FF9E5C /* ARTLinearGradient.h */,
+ 0CF68AEE1AF0549300FF9E5C /* ARTLinearGradient.m */,
+ 0CF68AEF1AF0549300FF9E5C /* ARTPattern.h */,
+ 0CF68AF01AF0549300FF9E5C /* ARTPattern.m */,
+ 0CF68AF11AF0549300FF9E5C /* ARTRadialGradient.h */,
+ 0CF68AF21AF0549300FF9E5C /* ARTRadialGradient.m */,
+ 0CF68AF31AF0549300FF9E5C /* ARTSolidColor.h */,
+ 0CF68AF41AF0549300FF9E5C /* ARTSolidColor.m */,
+ );
+ path = Brushes;
+ sourceTree = "";
+ };
+ 0CF68AF81AF0549300FF9E5C /* ViewManagers */ = {
+ isa = PBXGroup;
+ children = (
+ 0CF68AF91AF0549300FF9E5C /* ARTGroupManager.h */,
+ 0CF68AFA1AF0549300FF9E5C /* ARTGroupManager.m */,
+ 0CF68AFB1AF0549300FF9E5C /* ARTNodeManager.h */,
+ 0CF68AFC1AF0549300FF9E5C /* ARTNodeManager.m */,
+ 0CF68AFD1AF0549300FF9E5C /* ARTRenderableManager.h */,
+ 0CF68AFE1AF0549300FF9E5C /* ARTRenderableManager.m */,
+ 0CF68AFF1AF0549300FF9E5C /* ARTShapeManager.h */,
+ 0CF68B001AF0549300FF9E5C /* ARTShapeManager.m */,
+ 0CF68B011AF0549300FF9E5C /* ARTSurfaceViewManager.h */,
+ 0CF68B021AF0549300FF9E5C /* ARTSurfaceViewManager.m */,
+ 0CF68B031AF0549300FF9E5C /* ARTTextManager.h */,
+ 0CF68B041AF0549300FF9E5C /* ARTTextManager.m */,
+ );
+ path = ViewManagers;
+ sourceTree = "";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 0CF68AC01AF0540F00FF9E5C /* ART */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 0CF68AD51AF0540F00FF9E5C /* Build configuration list for PBXNativeTarget "ART" */;
+ buildPhases = (
+ 0CF68ABD1AF0540F00FF9E5C /* Sources */,
+ 0CF68ABE1AF0540F00FF9E5C /* Frameworks */,
+ 0CF68ABF1AF0540F00FF9E5C /* CopyFiles */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = ART;
+ productName = ART;
+ productReference = 0CF68AC11AF0540F00FF9E5C /* libART.a */;
+ productType = "com.apple.product-type.library.static";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 0CF68AB91AF0540F00FF9E5C /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0620;
+ TargetAttributes = {
+ 0CF68AC01AF0540F00FF9E5C = {
+ CreatedOnToolsVersion = 6.2;
+ };
+ };
+ };
+ buildConfigurationList = 0CF68ABC1AF0540F00FF9E5C /* Build configuration list for PBXProject "ART" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ );
+ mainGroup = 0CF68AB81AF0540F00FF9E5C;
+ productRefGroup = 0CF68AC21AF0540F00FF9E5C /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 0CF68AC01AF0540F00FF9E5C /* ART */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 0CF68ABD1AF0540F00FF9E5C /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 0CF68B161AF0549300FF9E5C /* ARTTextManager.m in Sources */,
+ 0CF68B111AF0549300FF9E5C /* ARTGroupManager.m in Sources */,
+ 0CF68B0D1AF0549300FF9E5C /* ARTPattern.m in Sources */,
+ 0CF68B0A1AF0549300FF9E5C /* ARTText.m in Sources */,
+ 0CF68B121AF0549300FF9E5C /* ARTNodeManager.m in Sources */,
+ 0CF68B051AF0549300FF9E5C /* ARTGroup.m in Sources */,
+ 0CF68B131AF0549300FF9E5C /* ARTRenderableManager.m in Sources */,
+ 0CF68B091AF0549300FF9E5C /* ARTSurfaceView.m in Sources */,
+ 0CF68B0E1AF0549300FF9E5C /* ARTRadialGradient.m in Sources */,
+ 0CF68B151AF0549300FF9E5C /* ARTSurfaceViewManager.m in Sources */,
+ 0CF68B081AF0549300FF9E5C /* ARTShape.m in Sources */,
+ 0CF68B071AF0549300FF9E5C /* ARTRenderable.m in Sources */,
+ 0CF68B101AF0549300FF9E5C /* RCTConvert+ART.m in Sources */,
+ 0CF68B061AF0549300FF9E5C /* ARTNode.m in Sources */,
+ 0CF68B0F1AF0549300FF9E5C /* ARTSolidColor.m in Sources */,
+ 0CF68B0C1AF0549300FF9E5C /* ARTLinearGradient.m in Sources */,
+ 0CF68B0B1AF0549300FF9E5C /* ARTBrush.m in Sources */,
+ 0CF68B141AF0549300FF9E5C /* ARTShapeManager.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+ 0CF68AD31AF0540F00FF9E5C /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ COPY_PHASE_STRIP = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = (
+ "$(inherited)",
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
+ "$(SRCROOT)/../../React/**",
+ );
+ IPHONEOS_DEPLOYMENT_TARGET = 7.0;
+ MTL_ENABLE_DEBUG_INFO = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = iphoneos;
+ };
+ name = Debug;
+ };
+ 0CF68AD41AF0540F00FF9E5C /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ COPY_PHASE_STRIP = NO;
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = (
+ "$(inherited)",
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
+ "$(SRCROOT)/../../React/**",
+ );
+ IPHONEOS_DEPLOYMENT_TARGET = 7.0;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = iphoneos;
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ 0CF68AD61AF0540F00FF9E5C /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ OTHER_LDFLAGS = "-ObjC";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SKIP_INSTALL = YES;
+ };
+ name = Debug;
+ };
+ 0CF68AD71AF0540F00FF9E5C /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ OTHER_LDFLAGS = "-ObjC";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SKIP_INSTALL = YES;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 0CF68ABC1AF0540F00FF9E5C /* Build configuration list for PBXProject "ART" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 0CF68AD31AF0540F00FF9E5C /* Debug */,
+ 0CF68AD41AF0540F00FF9E5C /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 0CF68AD51AF0540F00FF9E5C /* Build configuration list for PBXNativeTarget "ART" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 0CF68AD61AF0540F00FF9E5C /* Debug */,
+ 0CF68AD71AF0540F00FF9E5C /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 0CF68AB91AF0540F00FF9E5C /* Project object */;
+}
diff --git a/ios/Brushes/RNSVGBrush.h b/ios/Brushes/RNSVGBrush.h
new file mode 100644
index 00000000..7a044bda
--- /dev/null
+++ b/ios/Brushes/RNSVGBrush.h
@@ -0,0 +1,35 @@
+/**
+ * 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
+#import
+
+@interface RNSVGBrush : NSObject
+
+/* @abstract */
+- (instancetype)initWithArray:(NSArray *)data NS_DESIGNATED_INITIALIZER;
+
+/**
+ * For certain brushes we can fast path a combined fill and stroke.
+ * For those brushes we override applyFillColor which sets the fill
+ * color to be used by those batch paints. Those return YES.
+ * We can't batch gradient painting in CoreGraphics, so those will
+ * return NO and paint gets called instead.
+ * @abstract
+ */
+- (BOOL)applyFillColor:(CGContextRef)context;
+
+/**
+ * paint fills the context with a brush. The context is assumed to
+ * be clipped.
+ * @abstract
+ */
+- (void)paint:(CGContextRef)context;
+
+@end
diff --git a/ios/Brushes/RNSVGBrush.m b/ios/Brushes/RNSVGBrush.m
new file mode 100644
index 00000000..c1e0fbca
--- /dev/null
+++ b/ios/Brushes/RNSVGBrush.m
@@ -0,0 +1,33 @@
+/**
+ * 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 "RNSVGBrush.h"
+
+#import "RCTDefines.h"
+
+@implementation RNSVGBrush
+
+- (instancetype)initWithArray:(NSArray *)data
+{
+ return [super init];
+}
+
+RCT_NOT_IMPLEMENTED(- (instancetype)init)
+
+- (BOOL)applyFillColor:(CGContextRef)context
+{
+ return NO;
+}
+
+- (void)paint:(CGContextRef)context
+{
+ // abstract
+}
+
+@end
diff --git a/ios/Brushes/RNSVGLinearGradient.h b/ios/Brushes/RNSVGLinearGradient.h
new file mode 100644
index 00000000..95cb73eb
--- /dev/null
+++ b/ios/Brushes/RNSVGLinearGradient.h
@@ -0,0 +1,14 @@
+/**
+ * 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 "RNSVGBrush.h"
+
+@interface RNSVGLinearGradient : RNSVGBrush
+
+@end
diff --git a/ios/Brushes/RNSVGLinearGradient.m b/ios/Brushes/RNSVGLinearGradient.m
new file mode 100644
index 00000000..5294ccfb
--- /dev/null
+++ b/ios/Brushes/RNSVGLinearGradient.m
@@ -0,0 +1,49 @@
+/**
+ * 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 "RNSVGLinearGradient.h"
+
+#import "RCTConvert+RNSVG.h"
+#import "RCTLog.h"
+
+@implementation RNSVGLinearGradient
+{
+ CGGradientRef _gradient;
+ CGPoint _startPoint;
+ CGPoint _endPoint;
+}
+
+- (instancetype)initWithArray:(NSArray *)array
+{
+ if ((self = [super initWithArray:array])) {
+ if (array.count < 5) {
+ RCTLogError(@"-[%@ %@] expects 5 elements, received %@",
+ self.class, NSStringFromSelector(_cmd), array);
+ return nil;
+ }
+ _startPoint = [RCTConvert CGPoint:array offset:1];
+ _endPoint = [RCTConvert CGPoint:array offset:3];
+ _gradient = CGGradientRetain([RCTConvert CGGradient:array offset:5]);
+ }
+ return self;
+}
+
+- (void)dealloc
+{
+ CGGradientRelease(_gradient);
+}
+
+- (void)paint:(CGContextRef)context
+{
+ CGGradientDrawingOptions extendOptions =
+ kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation;
+ CGContextDrawLinearGradient(context, _gradient, _startPoint, _endPoint, extendOptions);
+}
+
+@end
diff --git a/ios/Brushes/RNSVGPattern.h b/ios/Brushes/RNSVGPattern.h
new file mode 100644
index 00000000..44259d6b
--- /dev/null
+++ b/ios/Brushes/RNSVGPattern.h
@@ -0,0 +1,14 @@
+/**
+ * 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 "RNSVGBrush.h"
+
+@interface RNSVGPattern : RNSVGBrush
+
+@end
diff --git a/ios/Brushes/RNSVGPattern.m b/ios/Brushes/RNSVGPattern.m
new file mode 100644
index 00000000..a08930af
--- /dev/null
+++ b/ios/Brushes/RNSVGPattern.m
@@ -0,0 +1,50 @@
+/**
+ * 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 "RNSVGPattern.h"
+
+#import "RCTConvert+RNSVG.h"
+#import "RCTLog.h"
+
+@implementation RNSVGPattern
+{
+ CGImageRef _image;
+ CGRect _rect;
+}
+
+- (instancetype)initWithArray:(NSArray *)array
+{
+ if ((self = [super initWithArray:array])) {
+ if (array.count < 6) {
+ RCTLogError(@"-[%@ %@] expects 6 elements, received %@",
+ self.class, NSStringFromSelector(_cmd), array);
+ return nil;
+ }
+ _image = CGImageRetain([RCTConvert CGImage:array[1]]);
+ _rect = [RCTConvert CGRect:array offset:2];
+ }
+ return self;
+}
+
+- (void)dealloc
+{
+ CGImageRelease(_image);
+}
+
+// Note: This could use applyFillColor with a pattern. This could be more efficient but
+// to do that, we need to calculate our own user space CTM.
+
+- (void)paint:(CGContextRef)context
+{
+ CGContextDrawTiledImage(context, _rect, _image);
+}
+
+
+
+@end
diff --git a/ios/Brushes/RNSVGRadialGradient.h b/ios/Brushes/RNSVGRadialGradient.h
new file mode 100644
index 00000000..b1472c36
--- /dev/null
+++ b/ios/Brushes/RNSVGRadialGradient.h
@@ -0,0 +1,14 @@
+/**
+ * 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 "RNSVGBrush.h"
+
+@interface RNSVGRadialGradient : RNSVGBrush
+
+@end
diff --git a/ios/Brushes/RNSVGRadialGradient.m b/ios/Brushes/RNSVGRadialGradient.m
new file mode 100644
index 00000000..aecfc275
--- /dev/null
+++ b/ios/Brushes/RNSVGRadialGradient.m
@@ -0,0 +1,56 @@
+/**
+ * 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 "RNSVGRadialGradient.h"
+
+#import "RCTConvert+RNSVG.h"
+#import "RCTLog.h"
+
+@implementation RNSVGRadialGradient
+{
+ CGGradientRef _gradient;
+ CGPoint _focusPoint;
+ CGPoint _centerPoint;
+ CGFloat _radius;
+ CGFloat _radiusRatio;
+}
+
+- (instancetype)initWithArray:(NSArray *)array
+{
+ if ((self = [super initWithArray:array])) {
+ if (array.count < 7) {
+ RCTLogError(@"-[%@ %@] expects 7 elements, received %@",
+ self.class, NSStringFromSelector(_cmd), array);
+ return nil;
+ }
+ _radius = [RCTConvert CGFloat:array[3]];
+ _radiusRatio = [RCTConvert CGFloat:array[4]] / _radius;
+ _focusPoint.x = [RCTConvert CGFloat:array[1]];
+ _focusPoint.y = [RCTConvert CGFloat:array[2]] / _radiusRatio;
+ _centerPoint.x = [RCTConvert CGFloat:array[5]];
+ _centerPoint.y = [RCTConvert CGFloat:array[6]] / _radiusRatio;
+ _gradient = CGGradientRetain([RCTConvert CGGradient:array offset:7]);
+ }
+ return self;
+}
+
+- (void)dealloc
+{
+ CGGradientRelease(_gradient);
+}
+
+- (void)paint:(CGContextRef)context
+{
+ CGAffineTransform transform = CGAffineTransformMakeScale(1, _radiusRatio);
+ CGContextConcatCTM(context, transform);
+ CGGradientDrawingOptions extendOptions = kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation;
+ CGContextDrawRadialGradient(context, _gradient, _focusPoint, 0, _centerPoint, _radius, extendOptions);
+}
+
+@end
diff --git a/ios/Brushes/RNSVGSolidColor.h b/ios/Brushes/RNSVGSolidColor.h
new file mode 100644
index 00000000..857e612e
--- /dev/null
+++ b/ios/Brushes/RNSVGSolidColor.h
@@ -0,0 +1,14 @@
+/**
+ * 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 "RNSVGBrush.h"
+
+@interface RNSVGSolidColor : RNSVGBrush
+
+@end
diff --git a/ios/Brushes/RNSVGSolidColor.m b/ios/Brushes/RNSVGSolidColor.m
new file mode 100644
index 00000000..028b7d3b
--- /dev/null
+++ b/ios/Brushes/RNSVGSolidColor.m
@@ -0,0 +1,39 @@
+/**
+ * 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 "RNSVGSolidColor.h"
+
+#import "RCTConvert+RNSVG.h"
+#import "RCTLog.h"
+
+@implementation RNSVGSolidColor
+{
+ CGColorRef _color;
+}
+
+- (instancetype)initWithArray:(NSArray *)array
+{
+ if ((self = [super initWithArray:array])) {
+ _color = CGColorRetain([RCTConvert CGColor:array offset:1]);
+ }
+ return self;
+}
+
+- (void)dealloc
+{
+ CGColorRelease(_color);
+}
+
+- (BOOL)applyFillColor:(CGContextRef)context
+{
+ CGContextSetFillColorWithColor(context, _color);
+ return YES;
+}
+
+@end
diff --git a/ios/RCTConvert+RNSVG.h b/ios/RCTConvert+RNSVG.h
new file mode 100644
index 00000000..d26fe489
--- /dev/null
+++ b/ios/RCTConvert+RNSVG.h
@@ -0,0 +1,30 @@
+/**
+ * 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
+
+#import "RNSVGBrush.h"
+#import "RNSVGCGFloatArray.h"
+#import "RNSVGTextFrame.h"
+#import "RCTConvert.h"
+
+@interface RCTConvert (RNSVG)
+
++ (CGPathRef)CGPath:(id)json;
++ (CTTextAlignment)CTTextAlignment:(id)json;
++ (RNSVGTextFrame)RNSVGTextFrame:(id)json;
++ (RNSVGCGFloatArray)RNSVGCGFloatArray:(id)json;
++ (RNSVGBrush *)RNSVGBrush:(id)json;
+
++ (CGPoint)CGPoint:(id)json offset:(NSUInteger)offset;
++ (CGRect)CGRect:(id)json offset:(NSUInteger)offset;
++ (CGColorRef)CGColor:(id)json offset:(NSUInteger)offset;
++ (CGGradientRef)CGGradient:(id)json offset:(NSUInteger)offset;
+
+@end
diff --git a/ios/RCTConvert+RNSVG.m b/ios/RCTConvert+RNSVG.m
new file mode 100644
index 00000000..5e74c9ed
--- /dev/null
+++ b/ios/RCTConvert+RNSVG.m
@@ -0,0 +1,223 @@
+/**
+ * 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 "RCTConvert+RNSVG.h"
+
+#import "RNSVGLinearGradient.h"
+#import "RNSVGPattern.h"
+#import "RNSVGRadialGradient.h"
+#import "RNSVGSolidColor.h"
+#import "RCTLog.h"
+
+@implementation RCTConvert (RNSVG)
+
++ (CGPathRef)CGPath:(id)json
+{
+ NSArray *arr = [self NSNumberArray:json];
+
+ NSUInteger count = [arr count];
+
+#define NEXT_VALUE [self double:arr[i++]]
+
+ CGMutablePathRef path = CGPathCreateMutable();
+ CGPathMoveToPoint(path, NULL, 0, 0);
+
+ @try {
+ NSUInteger i = 0;
+ while (i < count) {
+ NSUInteger type = [arr[i++] unsignedIntegerValue];
+ switch (type) {
+ case 0:
+ CGPathMoveToPoint(path, NULL, NEXT_VALUE, NEXT_VALUE);
+ break;
+ case 1:
+ CGPathCloseSubpath(path);
+ break;
+ case 2:
+ CGPathAddLineToPoint(path, NULL, NEXT_VALUE, NEXT_VALUE);
+ break;
+ case 3:
+ CGPathAddCurveToPoint(path, NULL, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE);
+ break;
+ case 4:
+ CGPathAddArc(path, NULL, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE == 0);
+ break;
+ default:
+ RCTLogError(@"Invalid CGPath type %zd at element %zd of %@", type, i, arr);
+ CGPathRelease(path);
+ return NULL;
+ }
+ }
+ }
+ @catch (NSException *exception) {
+ RCTLogError(@"Invalid CGPath format: %@", arr);
+ CGPathRelease(path);
+ return NULL;
+ }
+
+ return (CGPathRef)CFAutorelease(path);
+}
+
+RCT_ENUM_CONVERTER(CTTextAlignment, (@{
+ @"auto": @(kCTTextAlignmentNatural),
+ @"left": @(kCTTextAlignmentLeft),
+ @"center": @(kCTTextAlignmentCenter),
+ @"right": @(kCTTextAlignmentRight),
+ @"justify": @(kCTTextAlignmentJustified),
+}), kCTTextAlignmentNatural, integerValue)
+
+// This takes a tuple of text lines and a font to generate a CTLine for each text line.
+// This prepares everything for rendering a frame of text in RNSVGText.
++ (RNSVGTextFrame)RNSVGTextFrame:(id)json
+{
+ NSDictionary *dict = [self NSDictionary:json];
+ RNSVGTextFrame frame;
+ frame.count = 0;
+
+ NSArray *lines = [self NSArray:dict[@"lines"]];
+ NSUInteger lineCount = [lines count];
+ if (lineCount == 0) {
+ return frame;
+ }
+
+ NSDictionary *fontDict = dict[@"font"];
+ CTFontRef font = (__bridge CTFontRef)[self UIFont:nil withFamily:fontDict[@"fontFamily"] size:fontDict[@"fontSize"] weight:fontDict[@"fontWeight"] style:fontDict[@"fontStyle"] scaleMultiplier:1.0];
+ if (!font) {
+ return frame;
+ }
+
+ // Create a dictionary for this font
+ CFDictionaryRef attributes = (__bridge CFDictionaryRef)@{
+ (NSString *)kCTFontAttributeName: (__bridge id)font,
+ (NSString *)kCTForegroundColorFromContextAttributeName: @YES
+ };
+
+ // Set up text frame with font metrics
+ CGFloat size = CTFontGetSize(font);
+ frame.count = lineCount;
+ frame.baseLine = size; // estimate base line
+ frame.lineHeight = size * 1.1; // Base on RNSVG canvas line height estimate
+ frame.lines = malloc(sizeof(CTLineRef) * lineCount);
+ frame.widths = malloc(sizeof(CGFloat) * lineCount);
+
+ [lines enumerateObjectsUsingBlock:^(NSString *text, NSUInteger i, BOOL *stop) {
+
+ CFStringRef string = (__bridge CFStringRef)text;
+ CFAttributedStringRef attrString = CFAttributedStringCreate(kCFAllocatorDefault, string, attributes);
+ CTLineRef line = CTLineCreateWithAttributedString(attrString);
+ CFRelease(attrString);
+
+ frame.lines[i] = line;
+ frame.widths[i] = CTLineGetTypographicBounds(line, NULL, NULL, NULL);
+ }];
+
+ return frame;
+}
+
++ (RNSVGCGFloatArray)RNSVGCGFloatArray:(id)json
+{
+ NSArray *arr = [self NSNumberArray:json];
+ NSUInteger count = arr.count;
+
+ RNSVGCGFloatArray array;
+ array.count = count;
+ array.array = NULL;
+
+ if (count) {
+ // Ideally, these arrays should already use the same memory layout.
+ // In that case we shouldn't need this new malloc.
+ array.array = malloc(sizeof(CGFloat) * count);
+ for (NSUInteger i = 0; i < count; i++) {
+ array.array[i] = [arr[i] doubleValue];
+ }
+ }
+
+ return array;
+}
+
++ (RNSVGBrush *)RNSVGBrush:(id)json
+{
+ NSArray *arr = [self NSArray:json];
+ NSUInteger type = [self NSUInteger:arr.firstObject];
+ switch (type) {
+ case 0: // solid color
+ // These are probably expensive allocations since it's often the same value.
+ // We should memoize colors but look ups may be just as expensive.
+ return [[RNSVGSolidColor alloc] initWithArray:arr];
+ case 1: // linear gradient
+ return [[RNSVGLinearGradient alloc] initWithArray:arr];
+ case 2: // radial gradient
+ return [[RNSVGRadialGradient alloc] initWithArray:arr];
+ case 3: // pattern
+ return [[RNSVGPattern alloc] initWithArray:arr];
+ default:
+ RCTLogError(@"Unknown brush type: %zd", type);
+ return nil;
+ }
+}
+
++ (CGPoint)CGPoint:(id)json offset:(NSUInteger)offset
+{
+ NSArray *arr = [self NSArray:json];
+ if (arr.count < offset + 2) {
+ RCTLogError(@"Too few elements in array (expected at least %zd): %@", 2 + offset, arr);
+ return CGPointZero;
+ }
+ return (CGPoint){
+ [self CGFloat:arr[offset]],
+ [self CGFloat:arr[offset + 1]],
+ };
+}
+
++ (CGRect)CGRect:(id)json offset:(NSUInteger)offset
+{
+ NSArray *arr = [self NSArray:json];
+ if (arr.count < offset + 4) {
+ RCTLogError(@"Too few elements in array (expected at least %zd): %@", 4 + offset, arr);
+ return CGRectZero;
+ }
+ return (CGRect){
+ {[self CGFloat:arr[offset]], [self CGFloat:arr[offset + 1]]},
+ {[self CGFloat:arr[offset + 2]], [self CGFloat:arr[offset + 3]]},
+ };
+}
+
++ (CGColorRef)CGColor:(id)json offset:(NSUInteger)offset
+{
+ NSArray *arr = [self NSArray:json];
+ if (arr.count < offset + 4) {
+ RCTLogError(@"Too few elements in array (expected at least %zd): %@", 4 + offset, arr);
+ return NULL;
+ }
+ return [self CGColor:[arr subarrayWithRange:(NSRange){offset, 4}]];
+}
+
++ (CGGradientRef)CGGradient:(id)json offset:(NSUInteger)offset
+{
+ NSArray *arr = [self NSArray:json];
+ if (arr.count < offset) {
+ RCTLogError(@"Too few elements in array (expected at least %zd): %@", offset, arr);
+ return NULL;
+ }
+ arr = [arr subarrayWithRange:(NSRange){offset, arr.count - offset}];
+ RNSVGCGFloatArray colorsAndOffsets = [self RNSVGCGFloatArray:arr];
+ size_t stops = colorsAndOffsets.count / 5;
+ CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB();
+ CGGradientRef gradient = CGGradientCreateWithColorComponents(
+ rgb,
+ colorsAndOffsets.array,
+ colorsAndOffsets.array + stops * 4,
+ stops
+ );
+ CGColorSpaceRelease(rgb);
+ free(colorsAndOffsets.array);
+ return (CGGradientRef)CFAutorelease(gradient);
+}
+
+@end
diff --git a/ios/RNSVG.xcodeproj/project.pbxproj b/ios/RNSVG.xcodeproj/project.pbxproj
new file mode 100644
index 00000000..51ab786e
--- /dev/null
+++ b/ios/RNSVG.xcodeproj/project.pbxproj
@@ -0,0 +1,381 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 0CF68B051AF0549300FF9E5C /* RNSVGGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68ADE1AF0549300FF9E5C /* RNSVGGroup.m */; };
+ 0CF68B061AF0549300FF9E5C /* RNSVGNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE01AF0549300FF9E5C /* RNSVGNode.m */; };
+ 0CF68B071AF0549300FF9E5C /* RNSVGRenderable.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE21AF0549300FF9E5C /* RNSVGRenderable.m */; };
+ 0CF68B081AF0549300FF9E5C /* RNSVGShape.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE41AF0549300FF9E5C /* RNSVGShape.m */; };
+ 0CF68B091AF0549300FF9E5C /* RNSVGSurfaceView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE61AF0549300FF9E5C /* RNSVGSurfaceView.m */; };
+ 0CF68B0A1AF0549300FF9E5C /* RNSVGText.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AE81AF0549300FF9E5C /* RNSVGText.m */; };
+ 0CF68B0B1AF0549300FF9E5C /* RNSVGBrush.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AEC1AF0549300FF9E5C /* RNSVGBrush.m */; };
+ 0CF68B0C1AF0549300FF9E5C /* RNSVGLinearGradient.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AEE1AF0549300FF9E5C /* RNSVGLinearGradient.m */; };
+ 0CF68B0D1AF0549300FF9E5C /* RNSVGPattern.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AF01AF0549300FF9E5C /* RNSVGPattern.m */; };
+ 0CF68B0E1AF0549300FF9E5C /* RNSVGRadialGradient.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AF21AF0549300FF9E5C /* RNSVGRadialGradient.m */; };
+ 0CF68B0F1AF0549300FF9E5C /* RNSVGSolidColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AF41AF0549300FF9E5C /* RNSVGSolidColor.m */; };
+ 0CF68B101AF0549300FF9E5C /* RCTConvert+RNSVG.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AF71AF0549300FF9E5C /* RCTConvert+RNSVG.m */; };
+ 0CF68B111AF0549300FF9E5C /* RNSVGGroupManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AFA1AF0549300FF9E5C /* RNSVGGroupManager.m */; };
+ 0CF68B121AF0549300FF9E5C /* RNSVGNodeManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AFC1AF0549300FF9E5C /* RNSVGNodeManager.m */; };
+ 0CF68B131AF0549300FF9E5C /* RNSVGRenderableManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68AFE1AF0549300FF9E5C /* RNSVGRenderableManager.m */; };
+ 0CF68B141AF0549300FF9E5C /* RNSVGShapeManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68B001AF0549300FF9E5C /* RNSVGShapeManager.m */; };
+ 0CF68B151AF0549300FF9E5C /* RNSVGSurfaceViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68B021AF0549300FF9E5C /* RNSVGSurfaceViewManager.m */; };
+ 0CF68B161AF0549300FF9E5C /* RNSVGTextManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0CF68B041AF0549300FF9E5C /* RNSVGTextManager.m */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ 0CF68ABF1AF0540F00FF9E5C /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = "include/$(PRODUCT_NAME)";
+ dstSubfolderSpec = 16;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+ 0CF68AC11AF0540F00FF9E5C /* libRNSVG.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNSVG.a; sourceTree = BUILT_PRODUCTS_DIR; };
+ 0CF68ADB1AF0549300FF9E5C /* RNSVGCGFloatArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNSVGCGFloatArray.h; sourceTree = ""; };
+ 0CF68ADC1AF0549300FF9E5C /* RNSVGContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNSVGContainer.h; sourceTree = ""; };
+ 0CF68ADD1AF0549300FF9E5C /* RNSVGGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNSVGGroup.h; sourceTree = ""; };
+ 0CF68ADE1AF0549300FF9E5C /* RNSVGGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNSVGGroup.m; sourceTree = ""; };
+ 0CF68ADF1AF0549300FF9E5C /* RNSVGNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNSVGNode.h; sourceTree = ""; };
+ 0CF68AE01AF0549300FF9E5C /* RNSVGNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNSVGNode.m; sourceTree = ""; };
+ 0CF68AE11AF0549300FF9E5C /* RNSVGRenderable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNSVGRenderable.h; sourceTree = ""; };
+ 0CF68AE21AF0549300FF9E5C /* RNSVGRenderable.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNSVGRenderable.m; sourceTree = ""; };
+ 0CF68AE31AF0549300FF9E5C /* RNSVGShape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNSVGShape.h; sourceTree = ""; };
+ 0CF68AE41AF0549300FF9E5C /* RNSVGShape.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNSVGShape.m; sourceTree = ""; };
+ 0CF68AE51AF0549300FF9E5C /* RNSVGSurfaceView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNSVGSurfaceView.h; sourceTree = ""; };
+ 0CF68AE61AF0549300FF9E5C /* RNSVGSurfaceView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNSVGSurfaceView.m; sourceTree = ""; };
+ 0CF68AE71AF0549300FF9E5C /* RNSVGText.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNSVGText.h; sourceTree = ""; };
+ 0CF68AE81AF0549300FF9E5C /* RNSVGText.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNSVGText.m; sourceTree = ""; };
+ 0CF68AE91AF0549300FF9E5C /* RNSVGTextFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNSVGTextFrame.h; sourceTree = ""; };
+ 0CF68AEB1AF0549300FF9E5C /* RNSVGBrush.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNSVGBrush.h; sourceTree = ""; };
+ 0CF68AEC1AF0549300FF9E5C /* RNSVGBrush.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNSVGBrush.m; sourceTree = ""; };
+ 0CF68AED1AF0549300FF9E5C /* RNSVGLinearGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNSVGLinearGradient.h; sourceTree = ""; };
+ 0CF68AEE1AF0549300FF9E5C /* RNSVGLinearGradient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNSVGLinearGradient.m; sourceTree = ""; };
+ 0CF68AEF1AF0549300FF9E5C /* RNSVGPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNSVGPattern.h; sourceTree = ""; };
+ 0CF68AF01AF0549300FF9E5C /* RNSVGPattern.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNSVGPattern.m; sourceTree = ""; };
+ 0CF68AF11AF0549300FF9E5C /* RNSVGRadialGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNSVGRadialGradient.h; sourceTree = ""; };
+ 0CF68AF21AF0549300FF9E5C /* RNSVGRadialGradient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNSVGRadialGradient.m; sourceTree = ""; };
+ 0CF68AF31AF0549300FF9E5C /* RNSVGSolidColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNSVGSolidColor.h; sourceTree = ""; };
+ 0CF68AF41AF0549300FF9E5C /* RNSVGSolidColor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNSVGSolidColor.m; sourceTree = ""; };
+ 0CF68AF61AF0549300FF9E5C /* RCTConvert+RNSVG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RCTConvert+RNSVG.h"; sourceTree = ""; };
+ 0CF68AF71AF0549300FF9E5C /* RCTConvert+RNSVG.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RCTConvert+RNSVG.m"; sourceTree = ""; };
+ 0CF68AF91AF0549300FF9E5C /* RNSVGGroupManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNSVGGroupManager.h; sourceTree = ""; };
+ 0CF68AFA1AF0549300FF9E5C /* RNSVGGroupManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNSVGGroupManager.m; sourceTree = ""; };
+ 0CF68AFB1AF0549300FF9E5C /* RNSVGNodeManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNSVGNodeManager.h; sourceTree = ""; };
+ 0CF68AFC1AF0549300FF9E5C /* RNSVGNodeManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNSVGNodeManager.m; sourceTree = ""; };
+ 0CF68AFD1AF0549300FF9E5C /* RNSVGRenderableManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNSVGRenderableManager.h; sourceTree = ""; };
+ 0CF68AFE1AF0549300FF9E5C /* RNSVGRenderableManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNSVGRenderableManager.m; sourceTree = ""; };
+ 0CF68AFF1AF0549300FF9E5C /* RNSVGShapeManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNSVGShapeManager.h; sourceTree = ""; };
+ 0CF68B001AF0549300FF9E5C /* RNSVGShapeManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNSVGShapeManager.m; sourceTree = ""; };
+ 0CF68B011AF0549300FF9E5C /* RNSVGSurfaceViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNSVGSurfaceViewManager.h; sourceTree = ""; };
+ 0CF68B021AF0549300FF9E5C /* RNSVGSurfaceViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNSVGSurfaceViewManager.m; sourceTree = ""; };
+ 0CF68B031AF0549300FF9E5C /* RNSVGTextManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNSVGTextManager.h; sourceTree = ""; };
+ 0CF68B041AF0549300FF9E5C /* RNSVGTextManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNSVGTextManager.m; sourceTree = ""; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 0CF68ABE1AF0540F00FF9E5C /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 0CF68AB81AF0540F00FF9E5C = {
+ isa = PBXGroup;
+ children = (
+ 0CF68AEA1AF0549300FF9E5C /* Brushes */,
+ 0CF68AF81AF0549300FF9E5C /* ViewManagers */,
+ 0CF68ADB1AF0549300FF9E5C /* RNSVGCGFloatArray.h */,
+ 0CF68ADC1AF0549300FF9E5C /* RNSVGContainer.h */,
+ 0CF68ADD1AF0549300FF9E5C /* RNSVGGroup.h */,
+ 0CF68ADE1AF0549300FF9E5C /* RNSVGGroup.m */,
+ 0CF68ADF1AF0549300FF9E5C /* RNSVGNode.h */,
+ 0CF68AE01AF0549300FF9E5C /* RNSVGNode.m */,
+ 0CF68AE11AF0549300FF9E5C /* RNSVGRenderable.h */,
+ 0CF68AE21AF0549300FF9E5C /* RNSVGRenderable.m */,
+ 0CF68AE31AF0549300FF9E5C /* RNSVGShape.h */,
+ 0CF68AE41AF0549300FF9E5C /* RNSVGShape.m */,
+ 0CF68AE51AF0549300FF9E5C /* RNSVGSurfaceView.h */,
+ 0CF68AE61AF0549300FF9E5C /* RNSVGSurfaceView.m */,
+ 0CF68AE71AF0549300FF9E5C /* RNSVGText.h */,
+ 0CF68AE81AF0549300FF9E5C /* RNSVGText.m */,
+ 0CF68AE91AF0549300FF9E5C /* RNSVGTextFrame.h */,
+ 0CF68AF61AF0549300FF9E5C /* RCTConvert+RNSVG.h */,
+ 0CF68AF71AF0549300FF9E5C /* RCTConvert+RNSVG.m */,
+ 0CF68AC21AF0540F00FF9E5C /* Products */,
+ );
+ sourceTree = "";
+ };
+ 0CF68AC21AF0540F00FF9E5C /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 0CF68AC11AF0540F00FF9E5C /* libRNSVG.a */,
+ );
+ name = Products;
+ sourceTree = "";
+ };
+ 0CF68AEA1AF0549300FF9E5C /* Brushes */ = {
+ isa = PBXGroup;
+ children = (
+ 0CF68AEB1AF0549300FF9E5C /* RNSVGBrush.h */,
+ 0CF68AEC1AF0549300FF9E5C /* RNSVGBrush.m */,
+ 0CF68AED1AF0549300FF9E5C /* RNSVGLinearGradient.h */,
+ 0CF68AEE1AF0549300FF9E5C /* RNSVGLinearGradient.m */,
+ 0CF68AEF1AF0549300FF9E5C /* RNSVGPattern.h */,
+ 0CF68AF01AF0549300FF9E5C /* RNSVGPattern.m */,
+ 0CF68AF11AF0549300FF9E5C /* RNSVGRadialGradient.h */,
+ 0CF68AF21AF0549300FF9E5C /* RNSVGRadialGradient.m */,
+ 0CF68AF31AF0549300FF9E5C /* RNSVGSolidColor.h */,
+ 0CF68AF41AF0549300FF9E5C /* RNSVGSolidColor.m */,
+ );
+ path = Brushes;
+ sourceTree = "";
+ };
+ 0CF68AF81AF0549300FF9E5C /* ViewManagers */ = {
+ isa = PBXGroup;
+ children = (
+ 0CF68AF91AF0549300FF9E5C /* RNSVGGroupManager.h */,
+ 0CF68AFA1AF0549300FF9E5C /* RNSVGGroupManager.m */,
+ 0CF68AFB1AF0549300FF9E5C /* RNSVGNodeManager.h */,
+ 0CF68AFC1AF0549300FF9E5C /* RNSVGNodeManager.m */,
+ 0CF68AFD1AF0549300FF9E5C /* RNSVGRenderableManager.h */,
+ 0CF68AFE1AF0549300FF9E5C /* RNSVGRenderableManager.m */,
+ 0CF68AFF1AF0549300FF9E5C /* RNSVGShapeManager.h */,
+ 0CF68B001AF0549300FF9E5C /* RNSVGShapeManager.m */,
+ 0CF68B011AF0549300FF9E5C /* RNSVGSurfaceViewManager.h */,
+ 0CF68B021AF0549300FF9E5C /* RNSVGSurfaceViewManager.m */,
+ 0CF68B031AF0549300FF9E5C /* RNSVGTextManager.h */,
+ 0CF68B041AF0549300FF9E5C /* RNSVGTextManager.m */,
+ );
+ path = ViewManagers;
+ sourceTree = "";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 0CF68AC01AF0540F00FF9E5C /* RNSVG */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 0CF68AD51AF0540F00FF9E5C /* Build configuration list for PBXNativeTarget "RNSVG" */;
+ buildPhases = (
+ 0CF68ABD1AF0540F00FF9E5C /* Sources */,
+ 0CF68ABE1AF0540F00FF9E5C /* Frameworks */,
+ 0CF68ABF1AF0540F00FF9E5C /* CopyFiles */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = RNSVG;
+ productName = RNSVG;
+ productReference = 0CF68AC11AF0540F00FF9E5C /* libRNSVG.a */;
+ productType = "com.apple.product-type.library.static";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 0CF68AB91AF0540F00FF9E5C /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0620;
+ TargetAttributes = {
+ 0CF68AC01AF0540F00FF9E5C = {
+ CreatedOnToolsVersion = 6.2;
+ };
+ };
+ };
+ buildConfigurationList = 0CF68ABC1AF0540F00FF9E5C /* Build configuration list for PBXProject "RNSVG" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ );
+ mainGroup = 0CF68AB81AF0540F00FF9E5C;
+ productRefGroup = 0CF68AC21AF0540F00FF9E5C /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 0CF68AC01AF0540F00FF9E5C /* RNSVG */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 0CF68ABD1AF0540F00FF9E5C /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 0CF68B161AF0549300FF9E5C /* RNSVGTextManager.m in Sources */,
+ 0CF68B111AF0549300FF9E5C /* RNSVGGroupManager.m in Sources */,
+ 0CF68B0D1AF0549300FF9E5C /* RNSVGPattern.m in Sources */,
+ 0CF68B0A1AF0549300FF9E5C /* RNSVGText.m in Sources */,
+ 0CF68B121AF0549300FF9E5C /* RNSVGNodeManager.m in Sources */,
+ 0CF68B051AF0549300FF9E5C /* RNSVGGroup.m in Sources */,
+ 0CF68B131AF0549300FF9E5C /* RNSVGRenderableManager.m in Sources */,
+ 0CF68B091AF0549300FF9E5C /* RNSVGSurfaceView.m in Sources */,
+ 0CF68B0E1AF0549300FF9E5C /* RNSVGRadialGradient.m in Sources */,
+ 0CF68B151AF0549300FF9E5C /* RNSVGSurfaceViewManager.m in Sources */,
+ 0CF68B081AF0549300FF9E5C /* RNSVGShape.m in Sources */,
+ 0CF68B071AF0549300FF9E5C /* RNSVGRenderable.m in Sources */,
+ 0CF68B101AF0549300FF9E5C /* RCTConvert+RNSVG.m in Sources */,
+ 0CF68B061AF0549300FF9E5C /* RNSVGNode.m in Sources */,
+ 0CF68B0F1AF0549300FF9E5C /* RNSVGSolidColor.m in Sources */,
+ 0CF68B0C1AF0549300FF9E5C /* RNSVGLinearGradient.m in Sources */,
+ 0CF68B0B1AF0549300FF9E5C /* RNSVGBrush.m in Sources */,
+ 0CF68B141AF0549300FF9E5C /* RNSVGShapeManager.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+ 0CF68AD31AF0540F00FF9E5C /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ COPY_PHASE_STRIP = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = (
+ "$(inherited)",
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
+ "$(SRCROOT)/../../React/**",
+ );
+ IPHONEOS_DEPLOYMENT_TARGET = 7.0;
+ MTL_ENABLE_DEBUG_INFO = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = iphoneos;
+ };
+ name = Debug;
+ };
+ 0CF68AD41AF0540F00FF9E5C /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ COPY_PHASE_STRIP = NO;
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = (
+ "$(inherited)",
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
+ "$(SRCROOT)/../../React/**",
+ );
+ IPHONEOS_DEPLOYMENT_TARGET = 7.0;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = iphoneos;
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ 0CF68AD61AF0540F00FF9E5C /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ "$(inherited)",
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
+ "$(SRCROOT)/../../react-native/React/**",
+ );
+ OTHER_LDFLAGS = "-ObjC";
+ PRODUCT_NAME = RNSVG;
+ SKIP_INSTALL = YES;
+ };
+ name = Debug;
+ };
+ 0CF68AD71AF0540F00FF9E5C /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ HEADER_SEARCH_PATHS = (
+ "$(inherited)",
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
+ "$(SRCROOT)/../../react-native/React/**",
+ );
+ OTHER_LDFLAGS = "-ObjC";
+ PRODUCT_NAME = RNSVG;
+ SKIP_INSTALL = YES;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 0CF68ABC1AF0540F00FF9E5C /* Build configuration list for PBXProject "RNSVG" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 0CF68AD31AF0540F00FF9E5C /* Debug */,
+ 0CF68AD41AF0540F00FF9E5C /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 0CF68AD51AF0540F00FF9E5C /* Build configuration list for PBXNativeTarget "RNSVG" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 0CF68AD61AF0540F00FF9E5C /* Debug */,
+ 0CF68AD71AF0540F00FF9E5C /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 0CF68AB91AF0540F00FF9E5C /* Project object */;
+}
diff --git a/ios/RNSVGCGFloatArray.h b/ios/RNSVGCGFloatArray.h
new file mode 100644
index 00000000..0f1f03a7
--- /dev/null
+++ b/ios/RNSVGCGFloatArray.h
@@ -0,0 +1,20 @@
+/**
+ * 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.
+ */
+
+// A little helper to make sure we have the right memory allocation ready for use.
+// We assume that we will only this in one place so no reference counting is necessary.
+// Needs to be freed when dealloced.
+
+// This is fragile since this relies on these values not getting reused. Consider
+// wrapping these in an Obj-C class or some ARC hackery to get refcounting.
+
+typedef struct {
+ size_t count;
+ CGFloat *array;
+} RNSVGCGFloatArray;
diff --git a/ios/RNSVGContainer.h b/ios/RNSVGContainer.h
new file mode 100644
index 00000000..322b6e6c
--- /dev/null
+++ b/ios/RNSVGContainer.h
@@ -0,0 +1,18 @@
+/**
+ * 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
+
+@protocol RNSVGContainer
+
+// This is used as a hook for child to mark it's parent as dirty.
+// This bubbles up to the root which gets marked as dirty.
+- (void)invalidate;
+
+@end
diff --git a/ios/RNSVGGroup.h b/ios/RNSVGGroup.h
new file mode 100644
index 00000000..73522974
--- /dev/null
+++ b/ios/RNSVGGroup.h
@@ -0,0 +1,17 @@
+/**
+ * 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
+
+#import "RNSVGContainer.h"
+#import "RNSVGNode.h"
+
+@interface RNSVGGroup : RNSVGNode
+
+@end
diff --git a/ios/RNSVGGroup.m b/ios/RNSVGGroup.m
new file mode 100644
index 00000000..a3a2ae00
--- /dev/null
+++ b/ios/RNSVGGroup.m
@@ -0,0 +1,22 @@
+/**
+ * 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 "RNSVGGroup.h"
+
+@implementation RNSVGGroup
+
+- (void)renderLayerTo:(CGContextRef)context
+{
+// TO-DO: Clipping rectangle
+ for (RNSVGNode *node in self.subviews) {
+ [node renderTo:context];
+ }
+}
+
+@end
diff --git a/ios/RNSVGNode.h b/ios/RNSVGNode.h
new file mode 100644
index 00000000..1d3c25ac
--- /dev/null
+++ b/ios/RNSVGNode.h
@@ -0,0 +1,33 @@
+/**
+ * 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
+#import
+
+/**
+ * RNSVG nodes are implemented as empty UIViews but this is just an implementation detail to fit
+ * into the existing view management. They should also be shadow views and painted on a background
+ * thread.
+ */
+
+@interface RNSVGNode : UIView
+
+@property (nonatomic, assign) CGFloat opacity;
+
+- (void)invalidate;
+- (void)renderTo:(CGContextRef)context;
+
+/**
+ * renderTo will take opacity into account and draw renderLayerTo off-screen if there is opacity
+ * specified, then composite that onto the context. renderLayerTo always draws at opacity=1.
+ * @abstract
+ */
+- (void)renderLayerTo:(CGContextRef)context;
+
+@end
diff --git a/ios/RNSVGNode.m b/ios/RNSVGNode.m
new file mode 100644
index 00000000..bd988696
--- /dev/null
+++ b/ios/RNSVGNode.m
@@ -0,0 +1,76 @@
+/**
+ * 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 "RNSVGNode.h"
+
+#import "RNSVGContainer.h"
+
+@implementation RNSVGNode
+
+- (void)insertSubview:(UIView *)subview atIndex:(NSInteger)index
+{
+ [self invalidate];
+ [super insertSubview:subview atIndex:index];
+}
+
+- (void)removeFromSuperview
+{
+ [self invalidate];
+ [super removeFromSuperview];
+}
+
+- (void)setOpacity:(CGFloat)opacity
+{
+ [self invalidate];
+ _opacity = opacity;
+}
+
+- (void)setTransform:(CGAffineTransform)transform
+{
+ [self invalidate];
+ super.transform = transform;
+}
+
+- (void)invalidate
+{
+ id container = (id)self.superview;
+ [container invalidate];
+}
+
+- (void)renderTo:(CGContextRef)context
+{
+ if (self.opacity <= 0) {
+ // Nothing to paint
+ return;
+ }
+ if (self.opacity >= 1) {
+ // Just paint at full opacity
+ CGContextSaveGState(context);
+ CGContextConcatCTM(context, self.transform);
+ CGContextSetAlpha(context, 1);
+ [self renderLayerTo:context];
+ CGContextRestoreGState(context);
+ return;
+ }
+ // This needs to be painted on a layer before being composited.
+ CGContextSaveGState(context);
+ CGContextConcatCTM(context, self.transform);
+ CGContextSetAlpha(context, self.opacity);
+ CGContextBeginTransparencyLayer(context, NULL);
+ [self renderLayerTo:context];
+ CGContextEndTransparencyLayer(context);
+ CGContextRestoreGState(context);
+}
+
+- (void)renderLayerTo:(CGContextRef)context
+{
+ // abstract
+}
+
+@end
diff --git a/ios/RNSVGPath.h b/ios/RNSVGPath.h
new file mode 100644
index 00000000..c9d3acfe
--- /dev/null
+++ b/ios/RNSVGPath.h
@@ -0,0 +1,18 @@
+/**
+ * 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
+
+#import "RNSVGRenderable.h"
+
+@interface RNSVGPath : RNSVGRenderable
+
+@property (nonatomic, assign) CGPathRef d;
+
+@end
diff --git a/ios/RNSVGPath.m b/ios/RNSVGPath.m
new file mode 100644
index 00000000..c4dc6efb
--- /dev/null
+++ b/ios/RNSVGPath.m
@@ -0,0 +1,68 @@
+/**
+ * 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 "RNSVGPath.h"
+
+@implementation RNSVGPath
+
+- (void)setD:(CGPathRef)d
+{
+ if (d == _d) {
+ return;
+ }
+ [self invalidate];
+ CGPathRelease(_d);
+ _d = CGPathRetain(d);
+}
+
+- (void)dealloc
+{
+ CGPathRelease(_d);
+}
+
+- (void)renderLayerTo:(CGContextRef)context
+{
+ if ((!self.fill && !self.stroke) || !self.d) {
+ return;
+ }
+
+ CGPathDrawingMode mode = kCGPathStroke;
+ if (self.fill) {
+ if ([self.fill applyFillColor:context]) {
+ mode = kCGPathFill;
+ } else {
+ CGContextSaveGState(context);
+ CGContextAddPath(context, self.d);
+ CGContextClip(context);
+ [self.fill paint:context];
+ CGContextRestoreGState(context);
+ if (!self.stroke) {
+ return;
+ }
+ }
+ }
+ if (self.stroke) {
+ CGContextSetStrokeColorWithColor(context, self.stroke);
+ CGContextSetLineWidth(context, self.strokeWidth);
+ CGContextSetLineCap(context, self.strokeLinecap);
+ CGContextSetLineJoin(context, self.strokeLinejoin);
+ RNSVGCGFloatArray dash = self.strokeDash;
+ if (dash.count) {
+ CGContextSetLineDash(context, 0, dash.array, dash.count);
+ }
+ if (mode == kCGPathFill) {
+ mode = kCGPathFillStroke;
+ }
+ }
+
+ CGContextAddPath(context, self.d);
+ CGContextDrawPath(context, mode);
+}
+
+@end
diff --git a/ios/RNSVGRenderable.h b/ios/RNSVGRenderable.h
new file mode 100644
index 00000000..104df36b
--- /dev/null
+++ b/ios/RNSVGRenderable.h
@@ -0,0 +1,25 @@
+/**
+ * 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
+
+#import "RNSVGBrush.h"
+#import "RNSVGCGFloatArray.h"
+#import "RNSVGNode.h"
+
+@interface RNSVGRenderable : RNSVGNode
+
+@property (nonatomic, strong) RNSVGBrush *fill;
+@property (nonatomic, assign) CGColorRef stroke;
+@property (nonatomic, assign) CGFloat strokeWidth;
+@property (nonatomic, assign) CGLineCap strokeLinecap;
+@property (nonatomic, assign) CGLineJoin strokeLinejoin;
+@property (nonatomic, assign) RNSVGCGFloatArray strokeDash;
+
+@end
diff --git a/ios/RNSVGRenderable.m b/ios/RNSVGRenderable.m
new file mode 100644
index 00000000..771ced13
--- /dev/null
+++ b/ios/RNSVGRenderable.m
@@ -0,0 +1,89 @@
+/**
+ * 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 "RNSVGRenderable.h"
+
+@implementation RNSVGRenderable
+
+- (void)setFill:(RNSVGBrush *)fill
+{
+ [self invalidate];
+ _fill = fill;
+}
+
+- (void)setStroke:(CGColorRef)stroke
+{
+ if (stroke == _stroke) {
+ return;
+ }
+ [self invalidate];
+ CGColorRelease(_stroke);
+ _stroke = CGColorRetain(stroke);
+}
+
+- (void)setStrokeWidth:(CGFloat)strokeWidth
+{
+ [self invalidate];
+ _strokeWidth = strokeWidth;
+}
+
+- (void)setStrokeLinecap:(CGLineCap)strokeLinecap
+{
+ [self invalidate];
+ _strokeLinecap = strokeLinecap;
+}
+
+- (void)setStrokeJoin:(CGLineJoin)strokeLinejoin
+{
+ [self invalidate];
+ _strokeLinejoin = strokeLinejoin;
+}
+
+- (void)setStrokeDash:(RNSVGCGFloatArray)strokeDash
+{
+ if (strokeDash.array == _strokeDash.array) {
+ return;
+ }
+ if (_strokeDash.array) {
+ free(_strokeDash.array);
+ }
+ [self invalidate];
+ _strokeDash = strokeDash;
+}
+
+- (void)dealloc
+{
+ CGColorRelease(_stroke);
+ if (_strokeDash.array) {
+ free(_strokeDash.array);
+ }
+}
+
+- (void)renderTo:(CGContextRef)context
+{
+ if (self.opacity <= 0 || self.opacity >= 1 || (self.fill && self.stroke)) {
+ // If we have both fill and stroke, we will need to paint this using normal compositing
+ [super renderTo: context];
+ return;
+ }
+ // This is a terminal with only one painting. Therefore we don't need to paint this
+ // off-screen. We can just composite it straight onto the buffer.
+ CGContextSaveGState(context);
+ CGContextConcatCTM(context, self.transform);
+ CGContextSetAlpha(context, self.opacity);
+ [self renderLayerTo:context];
+ CGContextRestoreGState(context);
+}
+
+- (void)renderLayerTo:(CGContextRef)context
+{
+ // abstract
+}
+
+@end
diff --git a/Example/ios/ArtSvgExample/AppDelegate.h b/ios/RNSVGSvgView.h
similarity index 75%
rename from Example/ios/ArtSvgExample/AppDelegate.h
rename to ios/RNSVGSvgView.h
index a9654d5e..4984d2fe 100644
--- a/Example/ios/ArtSvgExample/AppDelegate.h
+++ b/ios/RNSVGSvgView.h
@@ -9,8 +9,8 @@
#import
-@interface AppDelegate : UIResponder
+#import "RNSVGContainer.h"
-@property (nonatomic, strong) UIWindow *window;
+@interface RNSVGSvgView : UIView
@end
diff --git a/ios/RNSVGSvgView.m b/ios/RNSVGSvgView.m
new file mode 100644
index 00000000..85a7252a
--- /dev/null
+++ b/ios/RNSVGSvgView.m
@@ -0,0 +1,35 @@
+/**
+ * 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 "RNSVGSvgView.h"
+
+#import "RNSVGNode.h"
+#import "RCTLog.h"
+
+@implementation RNSVGSvgView
+
+- (void)invalidate
+{
+ [self setNeedsDisplay];
+}
+
+- (void)drawRect:(CGRect)rect
+{
+ CGContextRef context = UIGraphicsGetCurrentContext();
+ for (RNSVGNode *node in self.subviews) {
+ [node renderTo:context];
+ }
+}
+
+- (void)reactSetInheritedBackgroundColor:(UIColor *)inheritedBackgroundColor
+{
+ self.backgroundColor = inheritedBackgroundColor;
+}
+
+@end
diff --git a/ios/RNSVGText.h b/ios/RNSVGText.h
new file mode 100644
index 00000000..60dba968
--- /dev/null
+++ b/ios/RNSVGText.h
@@ -0,0 +1,20 @@
+/**
+ * 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
+
+#import "RNSVGRenderable.h"
+#import "RNSVGTextFrame.h"
+
+@interface RNSVGText : RNSVGRenderable
+
+@property (nonatomic, assign) CTTextAlignment alignment;
+@property (nonatomic, assign) RNSVGTextFrame textFrame;
+
+@end
diff --git a/ios/RNSVGText.m b/ios/RNSVGText.m
new file mode 100644
index 00000000..51298b36
--- /dev/null
+++ b/ios/RNSVGText.m
@@ -0,0 +1,127 @@
+/**
+ * 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 "RNSVGText.h"
+
+#import
+
+@implementation RNSVGText
+
+- (void)setAlignment:(CTTextAlignment)alignment
+{
+ [self invalidate];
+ _alignment = alignment;
+}
+
+static void RNSVGFreeTextFrame(RNSVGTextFrame frame)
+{
+ if (frame.count) {
+ // We must release each line before freeing up this struct
+ for (int i = 0; i < frame.count; i++) {
+ CFRelease(frame.lines[i]);
+ }
+ free(frame.lines);
+ free(frame.widths);
+ }
+}
+
+- (void)setTextFrame:(RNSVGTextFrame)frame
+{
+ if (frame.lines != _textFrame.lines) {
+ RNSVGFreeTextFrame(_textFrame);
+ }
+ [self invalidate];
+ _textFrame = frame;
+}
+
+- (void)dealloc
+{
+ RNSVGFreeTextFrame(_textFrame);
+}
+
+- (void)renderLayerTo:(CGContextRef)context
+{
+ RNSVGTextFrame frame = self.textFrame;
+
+ if ((!self.fill && !self.stroke) || !frame.count) {
+ return;
+ }
+
+ // to-do: draw along a path
+
+ CGTextDrawingMode mode = kCGTextStroke;
+ if (self.fill) {
+ if ([self.fill applyFillColor:context]) {
+ mode = kCGTextFill;
+ } else {
+
+ for (int i = 0; i < frame.count; i++) {
+ CGContextSaveGState(context);
+ // Inverse the coordinate space since CoreText assumes a bottom-up coordinate space
+ CGContextScaleCTM(context, 1.0, -1.0);
+ CGContextSetTextDrawingMode(context, kCGTextClip);
+ [self renderLineTo:context atIndex:i];
+ // Inverse the coordinate space back to the original before filling
+ CGContextScaleCTM(context, 1.0, -1.0);
+ [self.fill paint:context];
+ // Restore the state so that the next line can be clipped separately
+ CGContextRestoreGState(context);
+ }
+
+ if (!self.stroke) {
+ return;
+ }
+ }
+ }
+ if (self.stroke) {
+ CGContextSetStrokeColorWithColor(context, self.stroke);
+ CGContextSetLineWidth(context, self.strokeWidth);
+ CGContextSetLineCap(context, self.strokeLinecap);
+ CGContextSetLineJoin(context, self.strokeLinejoin);
+ RNSVGCGFloatArray dash = self.strokeDash;
+ if (dash.count) {
+ CGContextSetLineDash(context, 0, dash.array, dash.count);
+ }
+ if (mode == kCGTextFill) {
+ mode = kCGTextFillStroke;
+ }
+ }
+
+ CGContextSetTextDrawingMode(context, mode);
+
+ // Inverse the coordinate space since CoreText assumes a bottom-up coordinate space
+ CGContextScaleCTM(context, 1.0, -1.0);
+ for (int i = 0; i < frame.count; i++) {
+ [self renderLineTo:context atIndex:i];
+ }
+}
+
+- (void)renderLineTo:(CGContextRef)context atIndex:(int)index
+{
+ RNSVGTextFrame frame = self.textFrame;
+ CGFloat shift;
+ switch (self.alignment) {
+ case kCTTextAlignmentRight:
+ shift = frame.widths[index];
+ break;
+ case kCTTextAlignmentCenter:
+ shift = (frame.widths[index] / 2);
+ break;
+ default:
+ shift = 0;
+ break;
+ }
+ // We should consider snapping this shift to device pixels to improve rendering quality
+ // when a line has subpixel width.
+ CGContextSetTextPosition(context, -shift, -frame.baseLine - frame.lineHeight * index);
+ CTLineRef line = frame.lines[index];
+ CTLineDraw(line, context);
+}
+
+@end
diff --git a/ios/RNSVGTextFrame.h b/ios/RNSVGTextFrame.h
new file mode 100644
index 00000000..f4ee86f7
--- /dev/null
+++ b/ios/RNSVGTextFrame.h
@@ -0,0 +1,25 @@
+/**
+ * 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
+
+// A little helper to make sure we have a set of lines including width ready for use.
+// We assume that we will only this in one place so no reference counting is necessary.
+// Needs to be freed when dealloced.
+
+// This is fragile since this relies on these values not getting reused. Consider
+// wrapping these in an Obj-C class or some ARC hackery to get refcounting.
+
+typedef struct {
+ size_t count;
+ CGFloat baseLine; // Distance from the origin to the base line of the first line
+ CGFloat lineHeight; // Distance between lines
+ CTLineRef *lines;
+ CGFloat *widths; // Width of each line
+} RNSVGTextFrame;
diff --git a/ios/ViewManagers/RNSVGGroupManager.h b/ios/ViewManagers/RNSVGGroupManager.h
new file mode 100644
index 00000000..3414f09f
--- /dev/null
+++ b/ios/ViewManagers/RNSVGGroupManager.h
@@ -0,0 +1,14 @@
+/**
+ * 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 "RNSVGNodeManager.h"
+
+@interface RNSVGGroupManager : RNSVGNodeManager
+
+@end
diff --git a/Example/ios/ArtSvgExample/main.m b/ios/ViewManagers/RNSVGGroupManager.m
similarity index 61%
rename from Example/ios/ArtSvgExample/main.m
rename to ios/ViewManagers/RNSVGGroupManager.m
index 3d767fcb..c48fda70 100644
--- a/Example/ios/ArtSvgExample/main.m
+++ b/ios/ViewManagers/RNSVGGroupManager.m
@@ -7,12 +7,17 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
-#import
+#import "RNSVGGroupManager.h"
-#import "AppDelegate.h"
+#import "RNSVGGroup.h"
-int main(int argc, char * argv[]) {
- @autoreleasepool {
- return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
- }
+@implementation RNSVGGroupManager
+
+RCT_EXPORT_MODULE()
+
+- (RNSVGNode *)node
+{
+ return [RNSVGGroup new];
}
+
+@end
diff --git a/ios/ViewManagers/RNSVGNodeManager.h b/ios/ViewManagers/RNSVGNodeManager.h
new file mode 100644
index 00000000..4cd3eb15
--- /dev/null
+++ b/ios/ViewManagers/RNSVGNodeManager.h
@@ -0,0 +1,17 @@
+/**
+ * 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 "RNSVGNode.h"
+#import "RCTViewManager.h"
+
+@interface RNSVGNodeManager : RCTViewManager
+
+- (RNSVGNode *)node;
+
+@end
diff --git a/ios/ViewManagers/RNSVGNodeManager.m b/ios/ViewManagers/RNSVGNodeManager.m
new file mode 100644
index 00000000..6cb29a2a
--- /dev/null
+++ b/ios/ViewManagers/RNSVGNodeManager.m
@@ -0,0 +1,36 @@
+/**
+ * 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 "RNSVGNodeManager.h"
+
+#import "RNSVGNode.h"
+
+@implementation RNSVGNodeManager
+
+RCT_EXPORT_MODULE()
+
+- (RNSVGNode *)node
+{
+ return [RNSVGNode new];
+}
+
+- (UIView *)view
+{
+ return [self node];
+}
+
+- (RCTShadowView *)shadowView
+{
+ return nil;
+}
+
+RCT_EXPORT_VIEW_PROPERTY(opacity, CGFloat)
+RCT_EXPORT_VIEW_PROPERTY(transform, CGAffineTransform)
+
+@end
diff --git a/ios/ViewManagers/RNSVGPathManager.h b/ios/ViewManagers/RNSVGPathManager.h
new file mode 100644
index 00000000..ac71b99a
--- /dev/null
+++ b/ios/ViewManagers/RNSVGPathManager.h
@@ -0,0 +1,14 @@
+/**
+ * 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 "RNSVGRenderableManager.h"
+
+@interface RNSVGPathManager : RNSVGRenderableManager
+
+@end
diff --git a/ios/ViewManagers/RNSVGPathManager.m b/ios/ViewManagers/RNSVGPathManager.m
new file mode 100644
index 00000000..486322d5
--- /dev/null
+++ b/ios/ViewManagers/RNSVGPathManager.m
@@ -0,0 +1,26 @@
+/**
+ * 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 "RNSVGPathManager.h"
+
+#import "RNSVGPath.h"
+#import "RCTConvert+RNSVG.h"
+
+@implementation RNSVGPathManager
+
+RCT_EXPORT_MODULE()
+
+- (RNSVGRenderable *)node
+{
+ return [RNSVGPath new];
+}
+
+RCT_EXPORT_VIEW_PROPERTY(d, CGPath)
+
+@end
diff --git a/ios/ViewManagers/RNSVGRenderableManager.h b/ios/ViewManagers/RNSVGRenderableManager.h
new file mode 100644
index 00000000..589ef345
--- /dev/null
+++ b/ios/ViewManagers/RNSVGRenderableManager.h
@@ -0,0 +1,17 @@
+/**
+ * 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 "RNSVGNodeManager.h"
+#import "RNSVGRenderable.h"
+
+@interface RNSVGRenderableManager : RNSVGNodeManager
+
+- (RNSVGRenderable *)node;
+
+@end
diff --git a/ios/ViewManagers/RNSVGRenderableManager.m b/ios/ViewManagers/RNSVGRenderableManager.m
new file mode 100644
index 00000000..2cfb3864
--- /dev/null
+++ b/ios/ViewManagers/RNSVGRenderableManager.m
@@ -0,0 +1,30 @@
+/**
+ * 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 "RNSVGRenderableManager.h"
+
+#import "RCTConvert+RNSVG.h"
+
+@implementation RNSVGRenderableManager
+
+RCT_EXPORT_MODULE()
+
+- (RNSVGRenderable *)node
+{
+ return [RNSVGRenderable new];
+}
+
+RCT_EXPORT_VIEW_PROPERTY(strokeWidth, CGFloat)
+RCT_EXPORT_VIEW_PROPERTY(strokeLinecap, CGLineCap)
+RCT_EXPORT_VIEW_PROPERTY(strokeLinejoin, CGLineJoin)
+RCT_EXPORT_VIEW_PROPERTY(fill, RNSVGBrush)
+RCT_EXPORT_VIEW_PROPERTY(stroke, CGColor)
+RCT_EXPORT_VIEW_PROPERTY(strokeDash, RNSVGCGFloatArray)
+
+@end
diff --git a/ios/ViewManagers/RNSVGSvgViewManager.h b/ios/ViewManagers/RNSVGSvgViewManager.h
new file mode 100644
index 00000000..f01a072a
--- /dev/null
+++ b/ios/ViewManagers/RNSVGSvgViewManager.h
@@ -0,0 +1,14 @@
+/**
+ * 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 "RCTViewManager.h"
+
+@interface RNSVGSvgViewManager : RCTViewManager
+
+@end
diff --git a/ios/ViewManagers/RNSVGSvgViewManager.m b/ios/ViewManagers/RNSVGSvgViewManager.m
new file mode 100644
index 00000000..b0c1ba28
--- /dev/null
+++ b/ios/ViewManagers/RNSVGSvgViewManager.m
@@ -0,0 +1,23 @@
+/**
+ * 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 "RNSVGSvgViewManager.h"
+
+#import "RNSVGSvgView.h"
+
+@implementation RNSVGSvgViewManager
+
+RCT_EXPORT_MODULE()
+
+- (UIView *)view
+{
+ return [RNSVGSvgView new];
+}
+
+@end
diff --git a/ios/ViewManagers/RNSVGTextManager.h b/ios/ViewManagers/RNSVGTextManager.h
new file mode 100644
index 00000000..3c064b10
--- /dev/null
+++ b/ios/ViewManagers/RNSVGTextManager.h
@@ -0,0 +1,14 @@
+/**
+ * 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 "RNSVGRenderableManager.h"
+
+@interface RNSVGTextManager : RNSVGRenderableManager
+
+@end
diff --git a/ios/ViewManagers/RNSVGTextManager.m b/ios/ViewManagers/RNSVGTextManager.m
new file mode 100644
index 00000000..23c45a98
--- /dev/null
+++ b/ios/ViewManagers/RNSVGTextManager.m
@@ -0,0 +1,27 @@
+/**
+ * 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 "RNSVGTextManager.h"
+
+#import "RNSVGText.h"
+#import "RCTConvert+RNSVG.h"
+
+@implementation RNSVGTextManager
+
+RCT_EXPORT_MODULE()
+
+- (RNSVGRenderable *)node
+{
+ return [RNSVGText new];
+}
+
+RCT_EXPORT_VIEW_PROPERTY(alignment, CTTextAlignment)
+RCT_REMAP_VIEW_PROPERTY(frame, textFrame, RNSVGTextFrame)
+
+@end
diff --git a/lib/Transform.js b/lib/Transform.js
new file mode 100644
index 00000000..322417f6
--- /dev/null
+++ b/lib/Transform.js
@@ -0,0 +1,132 @@
+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.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;
+ return this;
+ }
+
+ xx = 1;
+ yx = 0;
+ x = 0;
+ xy = 0;
+ yy = 1;
+ y = 0;
+
+ transform = (xx, yx, xy, yy, x, y) => {
+ var m = this;
+ if (xx && typeof xx == 'object'){
+ yx = xx.yx; yy = xx.yy; y = xx.y;
+ xy = xx.xy; x = xx.x; xx = xx.xx;
+ }
+ if (!x) x = 0;
+ if (!y) y = 0;
+ return this.transformTo(
+ m.xx * xx + m.xy * yx,
+ m.yx * xx + m.yy * yx,
+ m.xx * xy + m.xy * yy,
+ m.yx * xy + m.yy * yy,
+ m.xx * x + m.xy * y + m.x,
+ m.yx * x + m.yy * y + m.y
+ );
+ };
+
+ transformTo = this.constructor;
+
+ translate = (x, y) => {
+ return this.transform(1, 0, 0, 1, x, y);
+ };
+
+ move = (x, y) => {
+ this.x += x || 0;
+ this.y += y || 0;
+ return this;
+ };
+
+ scale = (x, y) => {
+ if (y == null) {
+ y = x;
+ }
+ return this.transform(x, 0, 0, y, 0, 0);
+ };
+
+ rotate = (deg, x, y) => {
+ if (x == null || y == null){
+ x = (this.left || 0) + (this.width || 0) / 2;
+ y = (this.top || 0) + (this.height || 0) / 2;
+ }
+
+ var rad = deg * Math.PI / 180, sin = Math.sin(rad), cos = Math.cos(rad);
+
+ this.transform(1, 0, 0, 1, x, y);
+ var m = this;
+
+ return this.transformTo(
+ cos * m.xx - sin * m.yx,
+ sin * m.xx + cos * m.yx,
+ cos * m.xy - sin * m.yy,
+ sin * m.xy + cos * m.yy,
+ m.x,
+ m.y
+ ).transform(1, 0, 0, 1, -x, -y);
+ };
+
+ moveTo = (x, y) => {
+ var m = this;
+ return this.transformTo(m.xx, m.yx, m.xy, m.yy, x, y);
+ };
+
+ rotateTo = (deg, x, y) => {
+ var m = this;
+ var flip = m.yx / m.xx > m.yy / m.xy ? -1 : 1;
+ if (m.xx < 0 ? m.xy >= 0 : m.xy < 0) flip = -flip;
+ return this.rotate(deg - Math.atan2(flip * m.yx, flip * m.xx) * 180 / Math.PI, x, y);
+ };
+
+ scaleTo = (x, y) => {
+ // Normalize
+ var m = this;
+
+ var h = Math.sqrt(m.xx * m.xx + m.yx * m.yx);
+ m.xx /= h; m.yx /= h;
+
+ h = Math.sqrt(m.yy * m.yy + m.xy * m.xy);
+ m.yy /= h; m.xy /= h;
+
+ return this.scale(x, y);
+ };
+
+ resizeTo = (width, height) => {
+ var w = this.width, h = this.height;
+ if (!w || !h) return this;
+ return this.scaleTo(width / w, height / h);
+ };
+
+ inversePoint = (x, y) => {
+ var a = this.xx, b = this.yx,
+ c = this.xy, d = this.yy,
+ e = this.x, f = this.y;
+ var det = b * c - a * d;
+ if (det == 0) return null;
+ return {
+ x: (d * (e - x) + c * (y - f)) / det,
+ y: (a * (f - y) + b * (x - e)) / det
+ };
+ };
+
+ point = (x, y) => {
+ var m = this;
+ return {
+ x: m.xx * x + m.xy * y + m.x,
+ y: m.yx * x + m.yy * y + m.y
+ };
+ };
+}
+
diff --git a/lib/attributes.js b/lib/attributes.js
new file mode 100644
index 00000000..5f390226
--- /dev/null
+++ b/lib/attributes.js
@@ -0,0 +1,90 @@
+
+function arrayDiffer(a, b) {
+ if (a == null) {
+ return true;
+ }
+ if (a.length !== b.length) {
+ return true;
+ }
+ for (var i = 0; i < a.length; i++) {
+ if (a[i] !== b[i]) {
+ return true;
+ }
+ }
+ return false;
+}
+
+function fontAndLinesDiffer(a, b) {
+ if (a === b) {
+ return false;
+ }
+ if (a.font !== b.font) {
+ if (a.font === null) {
+ return true;
+ }
+ if (b.font === null) {
+ return true;
+ }
+
+ if (
+ a.font.fontFamily !== b.font.fontFamily ||
+ a.font.fontSize !== b.font.fontSize ||
+ a.font.fontWeight !== b.font.fontWeight ||
+ a.font.fontStyle !== b.font.fontStyle
+ ) {
+ return true;
+ }
+ }
+ return arrayDiffer(a.lines, b.lines);
+}
+
+var NodeAttributes = {
+ transform: {
+ diff: arrayDiffer
+ },
+ opacity: true
+};
+
+var GroupAttributes = Object.assign({
+ clipping: {
+ diff: arrayDiffer
+ }
+}, NodeAttributes);
+
+var RenderableAttributes = Object.assign({
+ fill: {
+ diff: arrayDiffer
+ },
+ stroke: {
+ diff: arrayDiffer
+ },
+ strokeWidth: true,
+ strokeCap: true,
+ strokeJoin: true,
+ strokeDash: {
+ diff: arrayDiffer
+ }
+}, NodeAttributes);
+
+var PathAttributes = Object.assign({
+ d: {
+ diff: arrayDiffer
+ }
+}, RenderableAttributes);
+
+var TextAttributes = Object.assign({
+ alignment: true,
+ frame: {
+ diff: fontAndLinesDiffer
+ },
+ path: {
+ diff: arrayDiffer
+ }
+}, RenderableAttributes);
+
+export {
+ GroupAttributes,
+ PathAttributes,
+ TextAttributes
+}
+
diff --git a/lib/extractBrush.js b/lib/extractBrush.js
new file mode 100644
index 00000000..6ff0db57
--- /dev/null
+++ b/lib/extractBrush.js
@@ -0,0 +1,52 @@
+import Color from 'color';
+const SOLID_COLOR = 0;
+const LINEAR_GRADIENT = 1;
+const RADIAL_GRADIENT = 2;
+const PATTERN = 3;
+
+function applyBoundingBoxToBrushData(brushData, props) {
+ let type = brushData[0];
+ let width = +props.width;
+ let height = +props.height;
+ if (type === LINEAR_GRADIENT) {
+ brushData[1] *= width;
+ brushData[2] *= height;
+ brushData[3] *= width;
+ brushData[4] *= height;
+ } else if (type === RADIAL_GRADIENT) {
+ brushData[1] *= width;
+ brushData[2] *= height;
+ brushData[3] *= width;
+ brushData[4] *= height;
+ brushData[5] *= width;
+ brushData[6] *= height;
+ } else if (type === PATTERN) {
+ // todo
+ }
+}
+
+export default function (colorOrBrush, props) {
+ if (colorOrBrush == null) {
+ return null;
+ }
+ if (colorOrBrush._brush) {
+ if (colorOrBrush._bb) {
+ // The legacy API for Gradients allow for the bounding box to be used
+ // as a convenience for specifying gradient positions. This should be
+ // deprecated. It's not properly implemented in canvas mode. ReactART
+ // doesn't handle update to the bounding box correctly. That's why we
+ // mutate this so that if it's reused, we reuse the same resolved box.
+ applyBoundingBoxToBrushData(colorOrBrush._brush, props);
+ colorOrBrush._bb = false;
+ }
+ return colorOrBrush._brush;
+ }
+
+ let c = new Color(colorOrBrush).rgbaArray();
+ return [SOLID_COLOR, c[0] / 255, c[1] / 255, c[2] / 255, c[3]];
+}
+
+export {
+ LINEAR_GRADIENT,
+ RADIAL_GRADIENT
+}
diff --git a/lib/fillFilter.js b/lib/extractFill.js
similarity index 78%
rename from lib/fillFilter.js
rename to lib/extractFill.js
index 08d053d3..332ce401 100644
--- a/lib/fillFilter.js
+++ b/lib/extractFill.js
@@ -1,4 +1,5 @@
import rgba from './rgba';
+import extractBrush from './extractBrush';
import {
ART
} from 'react-native';
@@ -15,10 +16,21 @@ function isGradient(obj) {
return obj instanceof LinearGradient || obj instanceof RadialGradient;
}
-export default function (props) {
+function set(id, pattern) {
+ fillPatterns[id] = pattern;
+}
+
+function remove(id) {
+ delete fillPatterns[id];
+}
+
+function fillFilter(props) {
let {fill} = props;
- if (fill) {
+ if (fill === 'none') {
+ return null;
+ } if (fill) {
+
if (isGradient(fill)) {
return fill;
}
@@ -30,9 +42,11 @@ export default function (props) {
// 尝试匹配 fill="url(#pattern)"
let matched = fill.match(fillReg);
+
if (matched) {
let patternName = `${matched[1]}:${props.svgId}`;
let pattern = fillPatterns[patternName];
+
if (pattern) {
if (pattern.length === 2) {
let dimensions = this.getBoundingBox();
@@ -44,25 +58,22 @@ export default function (props) {
return null;
}
- return rgba(props.fill, fillOpacity);
+ return rgba(props.fill, fillOpacity).rgbaString();
} else if (props.fill === undefined) {
let fillOpacity = +props.fillOpacity;
if (isNaN(fillOpacity)) {
fillOpacity = 1;
}
- return rgba('#000', fillOpacity);
+ return rgba('#000', fillOpacity).rgbaString();
} else {
return null;
}
}
-function set(id, pattern) {
- fillPatterns[id] = pattern;
-}
-
-function remove(id) {
- delete fillPatterns[id];
+export default function(props) {
+ let fill = fillFilter.call(this, props);
+ return extractBrush(fill, props);
}
export {
diff --git a/lib/extractProps.js b/lib/extractProps.js
new file mode 100644
index 00000000..b0c5da88
--- /dev/null
+++ b/lib/extractProps.js
@@ -0,0 +1,28 @@
+import extractFill from './extractFill';
+import extractStroke from './extractStroke';
+import extractTransform from './extractTransform';
+
+export default function(props, options = {stroke: true, join: true, transform: true, fill: true}) {
+ if (props.visible === false) {
+ return {
+ opacity: 0
+ }
+ }
+ let extractedProps = {
+ opacity: +props.opacity || 1
+ };
+
+ if (options.stroke) {
+ Object.assign(extractedProps, extractStroke(props));
+ }
+
+ if (options.fill) {
+ extractedProps.fill = extractFill.call(this, props);
+ }
+
+ if (options.transform) {
+ extractedProps.transform = extractTransform(props);
+ }
+
+ return extractedProps;
+}
diff --git a/lib/extractStroke.js b/lib/extractStroke.js
new file mode 100644
index 00000000..b6f53d24
--- /dev/null
+++ b/lib/extractStroke.js
@@ -0,0 +1,55 @@
+import rgba from './rgba';
+import extractBrush from './extractBrush';
+let separator = /\s*,\s*/;
+
+const caps = {
+ butt: 0,
+ square: 2,
+ round: 1
+};
+
+const joins = {
+ miter: 0,
+ bevel: 2,
+ round: 1
+};
+
+function strokeFilter(props) {
+ if (!props.stroke && !props.strokeLinecap && !props.strokeOpacity &&
+ !props.strokeLinejoin && !props.strokeDasharray && !props.strokeWidth) {
+ return null;
+ }
+
+ let strokeDasharray = props.strokeDasharray;
+
+ if (typeof strokeDasharray === 'string') {
+ strokeDasharray = strokeDasharray.split(separator).map(dash => +dash);
+ }
+
+ return {
+ stroke: rgba(props.stroke, props.strokeOpacity).rgbaArray(),
+ strokeLinecap: caps[props.strokeLinecap] || 2,
+ strokeLinejoin: joins[props.strokeLinejoin] || 0,
+ strokeDash: strokeDasharray || null,
+ strokeWidth: +props.strokeWidth || 1
+ };
+}
+
+export default function(props) {
+ let strokeProps = strokeFilter(props);
+ if (!strokeProps) {
+ return {};
+ }
+
+ let {stroke} = strokeProps;
+ return {
+ ...strokeProps,
+ stroke: stroke ? [stroke[0] / 255, stroke[1] / 255, stroke[2] / 255, stroke[3]] : null
+ };
+
+ // TODO: implement brush on stroke prop
+ //return {
+ // ...strokeProps,
+ // stroke: extractBrush(strokeProps.stroke, props)
+ //};
+}
diff --git a/lib/extractText.js b/lib/extractText.js
new file mode 100644
index 00000000..6b80fa11
--- /dev/null
+++ b/lib/extractText.js
@@ -0,0 +1,96 @@
+import SerializablePath from 'react-native/Libraries/ART/ARTSerializablePath';
+
+const newLine = /\n/g;
+const defaultFontFamily = '"Helvetica Neue", "Helvetica", Arial';
+const fontRegExp = /^\s*((?:(?:normal|bold|italic)\s+)*)(?:(\d+(?:\.\d+)?)[ptexm%]*(?:\s*\/.*?)?\s+)?\s*"?([^"]*)/i;
+const fontFamilyPrefix = /^[\s"']*/;
+const fontFamilySuffix = /[\s"']*$/;
+let cachedFontObjectsFromString = {};
+
+function childrenAsString(children) {
+ if (!children) {
+ return '';
+ }
+ if (typeof children === 'string') {
+ return children;
+ }
+ if (children.length) {
+ return children.join('\n');
+ }
+ return '';
+}
+
+function extractFontAndLines(font, text) {
+ return {
+ font: extractFont(font),
+ lines: text.split(newLine)
+ };
+}
+
+function extractSingleFontFamily(fontFamilyString = defaultFontFamily) {
+ // ART on the web allows for multiple font-families to be specified.
+ // For compatibility, we extract the first font-family, hoping
+ // we'll get a match.
+ return fontFamilyString.split(',')[0]
+ .replace(fontFamilyPrefix, '')
+ .replace(fontFamilySuffix, '');
+}
+
+function parseFontString(font) {
+ if (cachedFontObjectsFromString.hasOwnProperty(font)) {
+ return cachedFontObjectsFromString[font];
+ }
+ let match = fontRegExp.exec(font);
+ if (!match) {
+ return null;
+ }
+ let fontFamily = extractSingleFontFamily(match[3]);
+ let fontSize = +match[2] || 12;
+ let isBold = /bold/.exec(match[1]);
+ let isItalic = /italic/.exec(match[1]);
+ cachedFontObjectsFromString[font] = {
+ fontFamily: fontFamily,
+ fontSize: fontSize,
+ fontWeight: isBold ? 'bold' : 'normal',
+ fontStyle: isItalic ? 'italic' : 'normal'
+ };
+ return cachedFontObjectsFromString[font];
+}
+
+function extractFont(font) {
+ if (font == null) {
+ return null;
+ }
+ if (typeof font === 'string') {
+ return parseFontString(font);
+ }
+ let fontFamily = extractSingleFontFamily(font.fontFamily);
+ let fontSize = +font.fontSize || 12;
+
+ return {
+ fontFamily: fontFamily,
+ fontSize: fontSize,
+ fontWeight: font.fontWeight,
+ fontStyle: font.fontStyle
+ };
+}
+
+const alignments = {
+ right: 1,
+ center: 2,
+ left: 0
+};
+
+export default function(props) {
+ let textPath = props.path ? new SerializablePath(props.path).toJSON() : null;
+ var textFrame = extractFontAndLines(
+ props,
+ childrenAsString(props.children)
+ );
+
+ return {
+ alignment: alignments[props.textAnchor] || 0,
+ frame: textFrame,
+ path: textPath
+ }
+}
diff --git a/lib/extractTransform.js b/lib/extractTransform.js
new file mode 100644
index 00000000..e4c5f5a3
--- /dev/null
+++ b/lib/extractTransform.js
@@ -0,0 +1,43 @@
+import Transform from 'art/core/transform';
+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;
+
+ pooledTransform
+ .transformTo(1, 0, 0, 1, 0, 0)
+ .move(props.x || 0, props.y || 0)
+ .rotate(props.rotation || 0, props.originX, props.originY)
+ .scale(scaleX, scaleY, props.originX, props.originY);
+
+ if (props.transform != null) {
+ pooledTransform.transform(props.transform);
+ }
+
+ return [
+ pooledTransform.xx, pooledTransform.yx,
+ pooledTransform.xy, pooledTransform.yy,
+ pooledTransform.x, pooledTransform.y
+ ];
+}
+
+export default function (props) {
+ let coords = props.origin ? props.origin.split(/\s*,\s*/) : [];
+
+ // TODO: support Percentage for originX,originY
+ let originX = coords.length === 2 ? coords[0] : props.originX;
+ let originY = coords.length === 2 ? coords[1] : props.originY;
+ return transformToMatrix({
+ rotation: +props.rotation / 2 || +props.rotate / 2 || 0,
+ scale: props.scale,
+ scaleX: props.scaleX,
+ scaleY: props.scaleY,
+ originX: +originX || 0,
+ originY: +originY || 0,
+ x: +props.x || 0,
+ y: +props.y || 0
+ });
+}
diff --git a/lib/insertProcessor.js b/lib/insertProcessor.js
new file mode 100644
index 00000000..d002049d
--- /dev/null
+++ b/lib/insertProcessor.js
@@ -0,0 +1,61 @@
+import Color from 'color';
+
+function insertColorIntoArray(color, targetArray, atIndex) {
+ var c = new Color(color).rgbaArray();
+ targetArray[atIndex + 0] = c[0] / 255;
+ targetArray[atIndex + 1] = c[1] / 255;
+ targetArray[atIndex + 2] = c[2] / 255;
+ targetArray[atIndex + 3] = c[3];
+}
+
+function insertColorsIntoArray(stops, targetArray, atIndex) {
+ var i = 0;
+ if ('length' in stops) {
+ while (i < stops.length) {
+ insertColorIntoArray(stops[i], targetArray, atIndex + i * 4);
+ i++;
+ }
+ } else {
+ for (var offset in stops) {
+ insertColorIntoArray(stops[offset], targetArray, atIndex + i * 4);
+ i++;
+ }
+ }
+ return atIndex + i * 4;
+}
+
+function insertColorStopsIntoArray(stops, targetArray, atIndex) {
+ var lastIndex = insertColorsIntoArray(stops, targetArray, atIndex);
+ insertOffsetsIntoArray(stops, targetArray, lastIndex, 1, false);
+}
+
+function insertOffsetsIntoArray(stops, targetArray, atIndex, multi, reverse) {
+ var offsetNumber;
+ var i = 0;
+ if ('length' in stops) {
+ while (i < stops.length) {
+ offsetNumber = i / (stops.length - 1) * multi;
+ targetArray[atIndex + i] = reverse ? 1 - offsetNumber : offsetNumber;
+ i++;
+ }
+ } else {
+ for (var offsetString in stops) {
+ offsetNumber = (+offsetString) * multi;
+ targetArray[atIndex + i] = reverse ? 1 - offsetNumber : offsetNumber;
+ i++;
+ }
+ }
+ return atIndex + i;
+}
+
+function insertDoubleColorStopsIntoArray(stops, targetArray, atIndex) {
+ var lastIndex = insertColorsIntoArray(stops, targetArray, atIndex);
+ lastIndex = insertColorsIntoArray(stops, targetArray, lastIndex);
+ lastIndex = insertOffsetsIntoArray(stops, targetArray, lastIndex, 0.5, false);
+ insertOffsetsIntoArray(stops, targetArray, lastIndex, 0.5, true);
+}
+
+export {
+ insertDoubleColorStopsIntoArray,
+ insertColorStopsIntoArray
+}
diff --git a/lib/numberProp.js b/lib/numberProp.js
new file mode 100644
index 00000000..9188cf19
--- /dev/null
+++ b/lib/numberProp.js
@@ -0,0 +1,4 @@
+import {
+ PropTypes
+} from 'react-native';
+export default PropTypes.oneOfType([PropTypes.string, PropTypes.number]);
diff --git a/lib/rgba.js b/lib/rgba.js
index bfa6318f..e4a69ffd 100644
--- a/lib/rgba.js
+++ b/lib/rgba.js
@@ -2,8 +2,8 @@ import Color from 'color';
let noneFill = ['transparent', 'none'];
export default function (color, opacity = 1) {
if (noneFill.indexOf(color) !== -1 || !color) {
- return null;
+ return Color('#000');
} else {
- return Color(color).alpha(+opacity).rgbaString();
+ return Color(color).alpha(+opacity);
}
}
diff --git a/lib/strokeFilter.js b/lib/strokeFilter.js
deleted file mode 100644
index 7225727b..00000000
--- a/lib/strokeFilter.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import rgba from './rgba';
-
-let separator = /\s*,\s*/;
-export default function (props) {
- let strokeDasharray = props.strokeDash || props.strokeDasharray;
-
- if (typeof strokeDasharray === 'string') {
- strokeDasharray = strokeDasharray.split(separator).map(dash => +dash);
- }
-
- return {
- stroke: rgba(props.stroke, props.strokeOpacity),
- strokeCap:props.strokeLinecap || props.strokeCap || 'square',
- strokeJoin:props.strokeLinejoin || props.strokeJoin || 'miter',
- strokeDash:strokeDasharray
- };
-}
diff --git a/lib/transformFilter.js b/lib/transformFilter.js
deleted file mode 100644
index 32eb777d..00000000
--- a/lib/transformFilter.js
+++ /dev/null
@@ -1,16 +0,0 @@
-export default function (props) {
- let coords = props.origin ? props.origin.split(/\s*,\s*/) : [];
-
- // TODO: support Percentage for originX,originY
- let originX = coords.length === 2 ? coords[0] : props.originX;
- let originY = coords.length === 2 ? coords[1] : props.originY;
- let scale = props.scale == 0 ? 0 : props.scale;
- return {
- rotation: +props.rotation / 2 || +props.rotate / 2 || 0,
- scale: isNaN(scale) ? 1 : scale,
- originX: +originX || 0,
- originY: +originY || 0,
- x: +props.x || 0,
- y: +props.y || 0
- }
-}