Authored by 孙凯

update image cache review by daiqiang

@@ -137,6 +137,7 @@ android { @@ -137,6 +137,7 @@ android {
137 } 137 }
138 138
139 dependencies { 139 dependencies {
  140 + compile project(':react-native-fabric')
140 compile project(':react-native-device-info') 141 compile project(':react-native-device-info')
141 compile fileTree(dir: "libs", include: ["*.jar"]) 142 compile fileTree(dir: "libs", include: ["*.jar"])
142 compile "com.android.support:appcompat-v7:23.0.1" 143 compile "com.android.support:appcompat-v7:23.0.1"
1 rootProject.name = 'YH_RNComponent' 1 rootProject.name = 'YH_RNComponent'
  2 +include ':react-native-fabric'
  3 +project(':react-native-fabric').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fabric/android')
2 include ':react-native-device-info' 4 include ':react-native-device-info'
3 project(':react-native-device-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-device-info/android') 5 project(':react-native-device-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-device-info/android')
4 6
@@ -5,7 +5,6 @@ @@ -5,7 +5,6 @@
5 }; 5 };
6 objectVersion = 46; 6 objectVersion = 46;
7 objects = { 7 objects = {
8 -  
9 /* Begin PBXBuildFile section */ 8 /* Begin PBXBuildFile section */
10 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; }; 9 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
11 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; }; 10 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
@@ -26,6 +25,7 @@ @@ -26,6 +25,7 @@
26 5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; }; 25 5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; };
27 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; 26 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
28 ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */; }; 27 ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */; };
  28 + 2D0B16AF9549438E8B407348 /* libSMXCrashlytics.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F4443977C4A0449581D9F0CB /* libSMXCrashlytics.a */; };
29 /* End PBXBuildFile section */ 29 /* End PBXBuildFile section */
30 30
31 /* Begin PBXContainerItemProxy section */ 31 /* Begin PBXContainerItemProxy section */
@@ -338,6 +338,8 @@ @@ -338,6 +338,8 @@
338 ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTBlob.xcodeproj; path = "../node_modules/react-native/Libraries/Blob/RCTBlob.xcodeproj"; sourceTree = "<group>"; }; 338 ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTBlob.xcodeproj; path = "../node_modules/react-native/Libraries/Blob/RCTBlob.xcodeproj"; sourceTree = "<group>"; };
339 EEEADDF370C14F1B8EC1C866 /* RNDeviceInfo.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNDeviceInfo.xcodeproj; path = "../node_modules/react-native-device-info/ios/RNDeviceInfo.xcodeproj"; sourceTree = "<group>"; }; 339 EEEADDF370C14F1B8EC1C866 /* RNDeviceInfo.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNDeviceInfo.xcodeproj; path = "../node_modules/react-native-device-info/ios/RNDeviceInfo.xcodeproj"; sourceTree = "<group>"; };
340 FA190B053440402E897258DD /* libRNDeviceInfo.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNDeviceInfo.a; sourceTree = "<group>"; }; 340 FA190B053440402E897258DD /* libRNDeviceInfo.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNDeviceInfo.a; sourceTree = "<group>"; };
  341 + 43E66576AEDD4CE09CF30864 /* SMXCrashlytics.xcodeproj */ = {isa = PBXFileReference; name = "SMXCrashlytics.xcodeproj"; path = "../node_modules/react-native-fabric/ios/SMXCrashlytics.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
  342 + F4443977C4A0449581D9F0CB /* libSMXCrashlytics.a */ = {isa = PBXFileReference; name = "libSMXCrashlytics.a"; path = "libSMXCrashlytics.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
341 /* End PBXFileReference section */ 343 /* End PBXFileReference section */
342 344
343 /* Begin PBXFrameworksBuildPhase section */ 345 /* Begin PBXFrameworksBuildPhase section */
@@ -366,6 +368,7 @@ @@ -366,6 +368,7 @@
366 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */, 368 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
367 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, 369 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
368 27693312177846EB9DBDDFEE /* libRNDeviceInfo.a in Frameworks */, 370 27693312177846EB9DBDDFEE /* libRNDeviceInfo.a in Frameworks */,
  371 + 2D0B16AF9549438E8B407348 /* libSMXCrashlytics.a in Frameworks */,
369 ); 372 );
370 runOnlyForDeploymentPostprocessing = 0; 373 runOnlyForDeploymentPostprocessing = 0;
371 }; 374 };
@@ -529,6 +532,7 @@ @@ -529,6 +532,7 @@
529 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, 532 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
530 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, 533 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
531 EEEADDF370C14F1B8EC1C866 /* RNDeviceInfo.xcodeproj */, 534 EEEADDF370C14F1B8EC1C866 /* RNDeviceInfo.xcodeproj */,
  535 + 43E66576AEDD4CE09CF30864 /* SMXCrashlytics.xcodeproj */,
532 ); 536 );
533 name = Libraries; 537 name = Libraries;
534 sourceTree = "<group>"; 538 sourceTree = "<group>";
@@ -1086,6 +1090,7 @@ @@ -1086,6 +1090,7 @@
1086 LIBRARY_SEARCH_PATHS = ( 1090 LIBRARY_SEARCH_PATHS = (
1087 "$(inherited)", 1091 "$(inherited)",
1088 "\"$(SRCROOT)/$(TARGET_NAME)\"", 1092 "\"$(SRCROOT)/$(TARGET_NAME)\"",
  1093 + "\"$(SRCROOT)/$(TARGET_NAME)\"",
1089 ); 1094 );
1090 PRODUCT_NAME = "$(TARGET_NAME)"; 1095 PRODUCT_NAME = "$(TARGET_NAME)";
1091 TEST_HOST = "$(BUILT_PRODUCTS_DIR)/YH_RNComponent.app/YH_RNComponent"; 1096 TEST_HOST = "$(BUILT_PRODUCTS_DIR)/YH_RNComponent.app/YH_RNComponent";
@@ -1103,6 +1108,7 @@ @@ -1103,6 +1108,7 @@
1103 LIBRARY_SEARCH_PATHS = ( 1108 LIBRARY_SEARCH_PATHS = (
1104 "$(inherited)", 1109 "$(inherited)",
1105 "\"$(SRCROOT)/$(TARGET_NAME)\"", 1110 "\"$(SRCROOT)/$(TARGET_NAME)\"",
  1111 + "\"$(SRCROOT)/$(TARGET_NAME)\"",
1106 ); 1112 );
1107 PRODUCT_NAME = "$(TARGET_NAME)"; 1113 PRODUCT_NAME = "$(TARGET_NAME)";
1108 TEST_HOST = "$(BUILT_PRODUCTS_DIR)/YH_RNComponent.app/YH_RNComponent"; 1114 TEST_HOST = "$(BUILT_PRODUCTS_DIR)/YH_RNComponent.app/YH_RNComponent";
@@ -1119,6 +1125,7 @@ @@ -1119,6 +1125,7 @@
1119 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 1125 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
1120 "$(SRCROOT)/../node_modules/react-native/React/**", 1126 "$(SRCROOT)/../node_modules/react-native/React/**",
1121 "$(SRCROOT)/../node_modules/react-native-device-info/ios/RNDeviceInfo", 1127 "$(SRCROOT)/../node_modules/react-native-device-info/ios/RNDeviceInfo",
  1128 + "$(SRCROOT)/../node_modules/react-native-fabric/ios/SMXCrashlytics",
1122 ); 1129 );
1123 INFOPLIST_FILE = YH_RNComponent/Info.plist; 1130 INFOPLIST_FILE = YH_RNComponent/Info.plist;
1124 LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 1131 LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@@ -1140,6 +1147,7 @@ @@ -1140,6 +1147,7 @@
1140 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 1147 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
1141 "$(SRCROOT)/../node_modules/react-native/React/**", 1148 "$(SRCROOT)/../node_modules/react-native/React/**",
1142 "$(SRCROOT)/../node_modules/react-native-device-info/ios/RNDeviceInfo", 1149 "$(SRCROOT)/../node_modules/react-native-device-info/ios/RNDeviceInfo",
  1150 + "$(SRCROOT)/../node_modules/react-native-fabric/ios/SMXCrashlytics",
1143 ); 1151 );
1144 INFOPLIST_FILE = YH_RNComponent/Info.plist; 1152 INFOPLIST_FILE = YH_RNComponent/Info.plist;
1145 LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 1153 LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@@ -14,7 +14,7 @@ const { @@ -14,7 +14,7 @@ const {
14 } = ReactNative; 14 } = ReactNative;
15 15
16 const YH_ImageView = ReactNative.requireNativeComponent('YH_ImageView', null); 16 const YH_ImageView = ReactNative.requireNativeComponent('YH_ImageView', null);
17 - 17 +import {CachedImage} from "react-native-img-cache";
18 18
19 /** 19 /**
20 * 原生图片 20 * 原生图片
@@ -40,7 +40,7 @@ export default class YH_Image extends Component { @@ -40,7 +40,7 @@ export default class YH_Image extends Component {
40 40
41 // width = PixelRatio.getPixelSizeForLayoutSize(width); 41 // width = PixelRatio.getPixelSizeForLayoutSize(width);
42 // height = PixelRatio.getPixelSizeForLayoutSize(height); 42 // height = PixelRatio.getPixelSizeForLayoutSize(height);
43 - 43 +
44 width = Math.ceil(width * 2); 44 width = Math.ceil(width * 2);
45 height = Math.ceil(height * 2); 45 height = Math.ceil(height * 2);
46 46
@@ -60,6 +60,9 @@ export default class YH_Image extends Component { @@ -60,6 +60,9 @@ export default class YH_Image extends Component {
60 60
61 if (Platform.OS === 'ios') { 61 if (Platform.OS === 'ios') {
62 return ( 62 return (
  63 +
  64 + // <CachedImage source={{ uri: this.props.url }} style = {this.props.style} mutable />
  65 +
63 <YH_ImageView 66 <YH_ImageView
64 {...this.props} 67 {...this.props}
65 /> 68 />
@@ -27,6 +27,8 @@ @@ -27,6 +27,8 @@
27 "react-native": "^0.54.4", 27 "react-native": "^0.54.4",
28 "react-native-device-info": "^0.21.5", 28 "react-native-device-info": "^0.21.5",
29 "react-native-fabric": "^0.5.1", 29 "react-native-fabric": "^0.5.1",
  30 + "react-native-fetch-blob": "^0.10.8",
  31 + "react-native-img-cache": "^1.5.3",
30 "react-native-progress": "^3.4.0", 32 "react-native-progress": "^3.4.0",
31 "react-native-root-toast": "^3.0.1", 33 "react-native-root-toast": "^3.0.1",
32 "react-native-scrollable-mixin": "^1.0.1", 34 "react-native-scrollable-mixin": "^1.0.1",