From 305918c09a81346502ffb0d6a14394de91a11603 Mon Sep 17 00:00:00 2001 From: Mehdi Achour Date: Thu, 29 Mar 2018 17:05:58 +0100 Subject: [PATCH] feat: add support for SVG images in ImageZoom component --- android/app/build.gradle | 1 + .../java/com/gitpoint/MainApplication.java | 2 + android/settings.gradle | 2 + ios/GitPoint.xcodeproj/project.pbxproj | 116 +++++++++++++++++- package.json | 2 + src/components/image-zoom.component.js | 12 +- yarn.lock | 44 ++++++- 7 files changed, 172 insertions(+), 7 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index ddb2f4e8..9bb34ff7 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -148,6 +148,7 @@ android { } dependencies { + compile project(':react-native-svg') compile project(':react-native-vector-icons') compile project(':react-native-linear-gradient') compile project(':react-native-cookies') diff --git a/android/app/src/main/java/com/gitpoint/MainApplication.java b/android/app/src/main/java/com/gitpoint/MainApplication.java index c2e67bd6..afcd99f1 100644 --- a/android/app/src/main/java/com/gitpoint/MainApplication.java +++ b/android/app/src/main/java/com/gitpoint/MainApplication.java @@ -3,6 +3,7 @@ import android.app.Application; import com.facebook.react.ReactApplication; +import com.horcrux.svg.SvgPackage; import com.BV.LinearGradient.LinearGradientPackage; import com.psykar.cookiemanager.CookieManagerPackage; import com.AlexanderZaytsev.RNI18n.RNI18nPackage; @@ -37,6 +38,7 @@ public boolean getUseDeveloperSupport() { protected List getPackages() { return Arrays.asList( new MainReactPackage(), + new SvgPackage(), new LinearGradientPackage(), new CookieManagerPackage(), new RNI18nPackage(), diff --git a/android/settings.gradle b/android/settings.gradle index 5342e1ab..b115cc2d 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1,4 +1,6 @@ rootProject.name = 'GitPoint' +include ':react-native-svg' +project(':react-native-svg').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-svg/android') include ':react-native-linear-gradient' project(':react-native-linear-gradient').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-linear-gradient/android') include ':react-native-cookies' diff --git a/ios/GitPoint.xcodeproj/project.pbxproj b/ios/GitPoint.xcodeproj/project.pbxproj index fbdf7e9d..2d3871b9 100644 --- a/ios/GitPoint.xcodeproj/project.pbxproj +++ b/ios/GitPoint.xcodeproj/project.pbxproj @@ -5,6 +5,7 @@ }; 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 */; }; @@ -22,6 +23,7 @@ 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; 144E973F9DDE47E49CD95CF6 /* MaterialIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 46F938D083AA4418826C2383 /* MaterialIcons.ttf */; }; 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; + 16DAE21EEC0A42F882FDCC46 /* libLRDRCTSimpleToast.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8E64ADAF275545F7B9D7227F /* libLRDRCTSimpleToast.a */; }; 21B7C06027854E159BE31EE1 /* libCodePush.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A6AFB906F8A346D58CCA9258 /* libCodePush.a */; }; 24D143B2F7E8472D9E2CE7EF /* libBVLinearGradient.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6C17E03AEA7E44AAB78D224F /* libBVLinearGradient.a */; }; 2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; @@ -54,9 +56,9 @@ B8D599F61D2A4797A2F71CAA /* libRNVectorIcons.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AFDBB5669CAB4C5C8215B571 /* libRNVectorIcons.a */; }; BFF2C570004F4232B1F5CB1C /* Inconsolata-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = E648F057A2064CA08EED0BD1 /* Inconsolata-Regular.ttf */; }; D2C2FCD70676466EA8E466D6 /* Menlo.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 18487F5E165143648CF0950E /* Menlo.ttf */; }; + D96DE03CB0A04CA4B3FCFFBA /* libRNSVG.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78BF7760E82241E19CA20C85 /* libRNSVG.a */; }; DC5C35E71E37AD1800F3F526 /* FontAwesome.ttf in Resources */ = {isa = PBXBuildFile; fileRef = DC5C35DD1E37AD1800F3F526 /* FontAwesome.ttf */; }; EB0F176BE52B4561B9FF07AB /* libReactNativeConfig.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D7043BDB577E427391ECFBB0 /* libReactNativeConfig.a */; }; - 16DAE21EEC0A42F882FDCC46 /* libLRDRCTSimpleToast.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8E64ADAF275545F7B9D7227F /* libLRDRCTSimpleToast.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -284,6 +286,34 @@ remoteGlobalIDString = 9936F32F1F5F2E5B0010BF04; remoteInfo = "privatedata-tvOS"; }; + 486EE3AC206D41C300CE8C7A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = EE0605281E45441288EA9435 /* RNDeviceInfo.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = E72EC1401F7ABB5A0001BC90; + remoteInfo = "RNDeviceInfo-tvOS"; + }; + 486EE3B7206D41C300CE8C7A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = AEAB9C270A9F45B0A2617DC8 /* LRDRCTSimpleToast.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 15209BEF1D250F63000D0F44; + remoteInfo = LRDRCTSimpleToast; + }; + 486EE403206D425000CE8C7A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 35BE07ABB46146DEAA9C1627 /* RNSVG.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 0CF68AC11AF0540F00FF9E5C; + remoteInfo = RNSVG; + }; + 486EE405206D425000CE8C7A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 35BE07ABB46146DEAA9C1627 /* RNSVG.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 94DDAC5C1F3D024300EED511; + remoteInfo = "RNSVG-tvOS"; + }; 489690581FD58E4300D83DAD /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; @@ -446,6 +476,7 @@ 2D02E47B1E0B4A5D006451C7 /* GitPoint-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "GitPoint-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 2D02E4901E0B4A5D006451C7 /* GitPoint-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "GitPoint-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 2EDE7CCE93944444B4DFEFD8 /* libRNI18n.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNI18n.a; sourceTree = ""; }; + 35BE07ABB46146DEAA9C1627 /* RNSVG.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNSVG.xcodeproj; path = "../node_modules/react-native-svg/ios/RNSVG.xcodeproj"; sourceTree = ""; }; 394C0B413FB94A5B8EEAD410 /* FontAwesome.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = FontAwesome.ttf; path = "../node_modules/react-native-vector-icons/Fonts/FontAwesome.ttf"; sourceTree = ""; }; 3C1D4770D3964EF8B3F1CC22 /* Octicons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Octicons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Octicons.ttf"; sourceTree = ""; }; 46F938D083AA4418826C2383 /* MaterialIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = MaterialIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/MaterialIcons.ttf"; sourceTree = ""; }; @@ -457,15 +488,19 @@ 63E9496511C842FB976EC87B /* RNPhotoView.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNPhotoView.xcodeproj; path = "../node_modules/react-native-photo-view/ios/RNPhotoView.xcodeproj"; sourceTree = ""; }; 646DAC28E02143BEA99179AF /* libz.tbd */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; 651F5DC3BF71489BB193A32B /* libRNDeviceInfo.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNDeviceInfo.a; sourceTree = ""; }; + 670FF3C6FCCB448B96F9473B /* libRNSVG-tvOS.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = "libRNSVG-tvOS.a"; sourceTree = ""; }; 6C17E03AEA7E44AAB78D224F /* libBVLinearGradient.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libBVLinearGradient.a; sourceTree = ""; }; 78A0EE19E449476883F58020 /* CodePush.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = CodePush.xcodeproj; path = "../node_modules/react-native-code-push/ios/CodePush.xcodeproj"; sourceTree = ""; }; 78A9FAE6B34B4FAC9F27CBC3 /* Nunito-Regular.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Nunito-Regular.ttf"; path = "../src/assets/fonts/Nunito-Regular.ttf"; sourceTree = ""; }; + 78BF7760E82241E19CA20C85 /* libRNSVG.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNSVG.a; 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 = ""; }; 84EAF1F8EA7E4DA69245C813 /* ReactNativeConfig.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = ReactNativeConfig.xcodeproj; path = "../node_modules/react-native-config/ios/ReactNativeConfig.xcodeproj"; sourceTree = ""; }; 8ACE0FDF36F449A7A0C25B34 /* SafariViewManager.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = SafariViewManager.xcodeproj; path = "../node_modules/react-native-safari-view/SafariViewManager.xcodeproj"; sourceTree = ""; }; + 8E64ADAF275545F7B9D7227F /* libLRDRCTSimpleToast.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libLRDRCTSimpleToast.a; sourceTree = ""; }; A6AFB906F8A346D58CCA9258 /* libCodePush.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libCodePush.a; sourceTree = ""; }; A8F6224C4381464C95E22845 /* RNVectorIcons.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNVectorIcons.xcodeproj; path = "../node_modules/react-native-vector-icons/RNVectorIcons.xcodeproj"; sourceTree = ""; }; + AEAB9C270A9F45B0A2617DC8 /* LRDRCTSimpleToast.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = LRDRCTSimpleToast.xcodeproj; path = "../node_modules/react-native-simple-toast/ios/LRDRCTSimpleToast.xcodeproj"; sourceTree = ""; }; AFDBB5669CAB4C5C8215B571 /* libRNVectorIcons.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNVectorIcons.a; sourceTree = ""; }; B88D3A8C883A40A8A56A5FA1 /* RNI18n.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNI18n.xcodeproj; path = "../node_modules/react-native-i18n/ios/RNI18n.xcodeproj"; sourceTree = ""; }; D7043BDB577E427391ECFBB0 /* libReactNativeConfig.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libReactNativeConfig.a; sourceTree = ""; }; @@ -478,8 +513,6 @@ ED1B22A89E134AA89E251577 /* Nunito-Light.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Nunito-Light.ttf"; path = "../src/assets/fonts/Nunito-Light.ttf"; sourceTree = ""; }; EE0605281E45441288EA9435 /* RNDeviceInfo.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNDeviceInfo.xcodeproj; path = "../node_modules/react-native-device-info/RNDeviceInfo.xcodeproj"; sourceTree = ""; }; FBD0F4CBD299403498005E08 /* Nunito-SemiBold.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = "Nunito-SemiBold.ttf"; path = "../src/assets/fonts/Nunito-SemiBold.ttf"; sourceTree = ""; }; - AEAB9C270A9F45B0A2617DC8 /* LRDRCTSimpleToast.xcodeproj */ = {isa = PBXFileReference; name = "LRDRCTSimpleToast.xcodeproj"; path = "../node_modules/react-native-simple-toast/ios/LRDRCTSimpleToast.xcodeproj"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; - 8E64ADAF275545F7B9D7227F /* libLRDRCTSimpleToast.a */ = {isa = PBXFileReference; name = "libLRDRCTSimpleToast.a"; path = "libLRDRCTSimpleToast.a"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -518,6 +551,7 @@ 2DC1C633A0C24C4DAE02E60B /* libRNPhotoView.a in Frameworks */, 24D143B2F7E8472D9E2CE7EF /* libBVLinearGradient.a in Frameworks */, 16DAE21EEC0A42F882FDCC46 /* libLRDRCTSimpleToast.a in Frameworks */, + D96DE03CB0A04CA4B3FCFFBA /* libRNSVG.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -696,6 +730,23 @@ name = Products; sourceTree = ""; }; + 486EE3B4206D41C300CE8C7A /* Products */ = { + isa = PBXGroup; + children = ( + 486EE3B8206D41C300CE8C7A /* libLRDRCTSimpleToast.a */, + ); + name = Products; + sourceTree = ""; + }; + 486EE3CF206D425000CE8C7A /* Products */ = { + isa = PBXGroup; + children = ( + 486EE404206D425000CE8C7A /* libRNSVG.a */, + 486EE406206D425000CE8C7A /* libRNSVG-tvOS.a */, + ); + name = Products; + sourceTree = ""; + }; 489690691FD58E4300D83DAD /* Products */ = { isa = PBXGroup; children = ( @@ -751,6 +802,9 @@ 1ABB0D8AB2424B1595DABB16 /* libRNPhotoView.a */, 6C17E03AEA7E44AAB78D224F /* libBVLinearGradient.a */, 3DAD3EA31DF850E9000B6D8A /* libReact.a */, + 8E64ADAF275545F7B9D7227F /* libLRDRCTSimpleToast.a */, + 78BF7760E82241E19CA20C85 /* libRNSVG.a */, + 670FF3C6FCCB448B96F9473B /* libRNSVG-tvOS.a */, ); name = "Recovered References"; sourceTree = ""; @@ -797,6 +851,7 @@ 63E9496511C842FB976EC87B /* RNPhotoView.xcodeproj */, 292314143C1743648A44C564 /* BVLinearGradient.xcodeproj */, AEAB9C270A9F45B0A2617DC8 /* LRDRCTSimpleToast.xcodeproj */, + 35BE07ABB46146DEAA9C1627 /* RNSVG.xcodeproj */, ); name = Libraries; sourceTree = ""; @@ -878,6 +933,7 @@ isa = PBXGroup; children = ( DCD1C1521EEF193400E3B03D /* libRNDeviceInfo.a */, + 486EE3AD206D41C300CE8C7A /* libRNDeviceInfo-tvOS.a */, ); name = Products; sourceTree = ""; @@ -1006,6 +1062,10 @@ ProductGroup = 273F191C1F1E1AD5004B4410 /* Products */; ProjectRef = 78A0EE19E449476883F58020 /* CodePush.xcodeproj */; }, + { + ProductGroup = 486EE3B4206D41C300CE8C7A /* Products */; + ProjectRef = AEAB9C270A9F45B0A2617DC8 /* LRDRCTSimpleToast.xcodeproj */; + }, { ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */; ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; @@ -1074,6 +1134,10 @@ ProductGroup = 48F49F491F19026D0012FAD6 /* Products */; ProjectRef = 48F49F481F19026D0012FAD6 /* RNSearchBar.xcodeproj */; }, + { + ProductGroup = 486EE3CF206D425000CE8C7A /* Products */; + ProjectRef = 35BE07ABB46146DEAA9C1627 /* RNSVG.xcodeproj */; + }, { ProductGroup = DC9439F51EBF8CD30047BCBD /* Products */; ProjectRef = A8F6224C4381464C95E22845 /* RNVectorIcons.xcodeproj */; @@ -1304,6 +1368,34 @@ remoteRef = 48554898200E23A10020211B /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + 486EE3AD206D41C300CE8C7A /* libRNDeviceInfo-tvOS.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libRNDeviceInfo-tvOS.a"; + remoteRef = 486EE3AC206D41C300CE8C7A /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 486EE3B8206D41C300CE8C7A /* libLRDRCTSimpleToast.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libLRDRCTSimpleToast.a; + remoteRef = 486EE3B7206D41C300CE8C7A /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 486EE404206D425000CE8C7A /* libRNSVG.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libRNSVG.a; + remoteRef = 486EE403206D425000CE8C7A /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 486EE406206D425000CE8C7A /* libRNSVG-tvOS.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libRNSVG-tvOS.a"; + remoteRef = 486EE405206D425000CE8C7A /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; 489690591FD58E4300D83DAD /* libthird-party.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; @@ -1587,6 +1679,7 @@ "$(SRCROOT)/../node_modules/react-native-photo-view/ios/**", "$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient", "$(SRCROOT)/../node_modules/react-native-simple-toast/ios/LRDRCTSimpleToast", + "$(SRCROOT)/../node_modules/react-native-svg/ios/**", ); INFOPLIST_FILE = GitPointTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; @@ -1597,6 +1690,8 @@ "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); OTHER_LDFLAGS = ( "-ObjC", @@ -1626,6 +1721,7 @@ "$(SRCROOT)/../node_modules/react-native-photo-view/ios/**", "$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient", "$(SRCROOT)/../node_modules/react-native-simple-toast/ios/LRDRCTSimpleToast", + "$(SRCROOT)/../node_modules/react-native-svg/ios/**", ); INFOPLIST_FILE = GitPointTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; @@ -1636,6 +1732,8 @@ "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); OTHER_LDFLAGS = ( "-ObjC", @@ -1670,6 +1768,7 @@ "$(SRCROOT)/../node_modules/react-native-photo-view/ios/**", "$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient", "$(SRCROOT)/../node_modules/react-native-simple-toast/ios/LRDRCTSimpleToast", + "$(SRCROOT)/../node_modules/react-native-svg/ios/**", ); INFOPLIST_FILE = GitPoint/Info.plist; INFOPLIST_OTHER_PREPROCESSOR_FLAGS = "-traditional"; @@ -1713,6 +1812,7 @@ "$(SRCROOT)/../node_modules/react-native-photo-view/ios/**", "$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient", "$(SRCROOT)/../node_modules/react-native-simple-toast/ios/LRDRCTSimpleToast", + "$(SRCROOT)/../node_modules/react-native-svg/ios/**", ); INFOPLIST_FILE = GitPoint/Info.plist; INFOPLIST_OTHER_PREPROCESSOR_FLAGS = "-traditional"; @@ -1757,6 +1857,7 @@ "$(SRCROOT)/../node_modules/react-native-photo-view/ios/**", "$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient", "$(SRCROOT)/../node_modules/react-native-simple-toast/ios/LRDRCTSimpleToast", + "$(SRCROOT)/../node_modules/react-native-svg/ios/**", ); INFOPLIST_FILE = "GitPoint-tvOS/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -1766,6 +1867,8 @@ "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); OTHER_LDFLAGS = ( "-ObjC", @@ -1804,6 +1907,7 @@ "$(SRCROOT)/../node_modules/react-native-photo-view/ios/**", "$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient", "$(SRCROOT)/../node_modules/react-native-simple-toast/ios/LRDRCTSimpleToast", + "$(SRCROOT)/../node_modules/react-native-svg/ios/**", ); INFOPLIST_FILE = "GitPoint-tvOS/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -1813,6 +1917,8 @@ "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); OTHER_LDFLAGS = ( "-ObjC", @@ -1845,6 +1951,8 @@ "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.GitPoint-tvOSTests"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -1873,6 +1981,8 @@ "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.GitPoint-tvOSTests"; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/package.json b/package.json index 19f987ff..7cdfe60c 100644 --- a/package.json +++ b/package.json @@ -85,6 +85,8 @@ "react-native-safari-view": "^2.0.0", "react-native-search-bar": "^3.3.1", "react-native-simple-toast": "^0.0.8", + "react-native-svg": "^6.3.1", + "react-native-svg-from-uri": "^1.0.1", "react-native-swiper": "^1.5.13", "react-native-syntax-highlighter": "^1.2.1", "react-native-table-component": "^1.1.0", diff --git a/src/components/image-zoom.component.js b/src/components/image-zoom.component.js index cdb54299..fcf9e448 100644 --- a/src/components/image-zoom.component.js +++ b/src/components/image-zoom.component.js @@ -3,6 +3,7 @@ import { Image, Modal, Dimensions } from 'react-native'; import { Icon } from 'react-native-elements'; import styled from 'styled-components'; import PhotoView from 'react-native-photo-view'; +import SvgUri from 'react-native-svg-from-uri'; import { colors } from 'config'; @@ -52,6 +53,7 @@ export class ImageZoom extends Component { super(); this.state = { imgZoom: false, + imgFailed: false, }; this.openModal = this.openModal.bind(this); @@ -94,13 +96,21 @@ export class ImageZoom extends Component { ); } + if (this.state.imgFailed) { + return ; + } + return ( - + this.setState({ imgFailed: true })} + /> ); } diff --git a/yarn.lock b/yarn.lock index dd3b2fff..4378eb76 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1856,20 +1856,34 @@ collection-visit@^1.0.0: map-visit "^1.0.0" object-visit "^1.0.0" -color-convert@^1.9.0: +color-convert@^1.9.0, color-convert@^1.9.1: version "1.9.1" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.1.tgz#c1261107aeb2f294ebffec9ed9ecad529a6097ed" dependencies: color-name "^1.1.1" -color-name@^1.1.1: +color-name@^1.0.0, color-name@^1.1.1: version "1.1.3" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" +color-string@^1.5.2: + version "1.5.2" + resolved "https://registry.yarnpkg.com/color-string/-/color-string-1.5.2.tgz#26e45814bc3c9a7cbd6751648a41434514a773a9" + dependencies: + color-name "^1.0.0" + simple-swizzle "^0.2.2" + color-support@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2" +color@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color/-/color-2.0.1.tgz#e4ed78a3c4603d0891eba5430b04b86314f4c839" + dependencies: + color-convert "^1.9.1" + color-string "^1.5.2" + colors@0.5.x: version "0.5.1" resolved "https://registry.yarnpkg.com/colors/-/colors-0.5.1.tgz#7d0023eaeb154e8ee9fce75dcb923d0ed1667774" @@ -4079,6 +4093,10 @@ is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" +is-arrayish@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.3.1.tgz#c2dfc386abaa0c3e33c48db3fe87059e69065efd" + is-binary-path@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898" @@ -6758,6 +6776,20 @@ react-native-simple-toast@^0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/react-native-simple-toast/-/react-native-simple-toast-0.0.8.tgz#513f4add8d30e4c5109e536bfc6ea5825fea5d83" +react-native-svg-from-uri@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/react-native-svg-from-uri/-/react-native-svg-from-uri-1.0.1.tgz#1db9bb8a365c7cc4cf0ac67ca18a6ed2af4fb76d" + dependencies: + xmldom "^0.1.22" + +react-native-svg@^6.3.1: + version "6.3.1" + resolved "https://registry.yarnpkg.com/react-native-svg/-/react-native-svg-6.3.1.tgz#06a573f17c59ce953a56fd62e776fd79d632d765" + dependencies: + color "^2.0.1" + lodash "^4.16.6" + pegjs "^0.10.0" + react-native-swiper@^1.5.13: version "1.5.13" resolved "https://registry.yarnpkg.com/react-native-swiper/-/react-native-swiper-1.5.13.tgz#fa695cd4ab77b9a9df2d2bfee38ea7274dd07a2e" @@ -7706,6 +7738,12 @@ simple-plist@^0.2.1: bplist-parser "0.1.1" plist "2.0.1" +simple-swizzle@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a" + dependencies: + is-arrayish "^0.3.1" + slash@1.0.0, slash@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" @@ -8959,7 +8997,7 @@ xmldoc@^0.4.0: dependencies: sax "~1.1.1" -xmldom@0.1.x: +xmldom@0.1.x, xmldom@^0.1.22: version "0.1.27" resolved "https://registry.yarnpkg.com/xmldom/-/xmldom-0.1.27.tgz#d501f97b3bdb403af8ef9ecc20573187aadac0e9"