Authored by 孙凯

update image cache review by daiqiang

... ... @@ -137,6 +137,7 @@ android {
}
dependencies {
compile project(':react-native-fabric')
compile project(':react-native-device-info')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
... ...
rootProject.name = 'YH_RNComponent'
include ':react-native-fabric'
project(':react-native-fabric').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fabric/android')
include ':react-native-device-info'
project(':react-native-device-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-device-info/android')
... ...
... ... @@ -5,7 +5,6 @@
};
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 */; };
... ... @@ -26,6 +25,7 @@
5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; };
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */; };
2D0B16AF9549438E8B407348 /* libSMXCrashlytics.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F4443977C4A0449581D9F0CB /* libSMXCrashlytics.a */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
... ... @@ -338,6 +338,8 @@
ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTBlob.xcodeproj; path = "../node_modules/react-native/Libraries/Blob/RCTBlob.xcodeproj"; sourceTree = "<group>"; };
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>"; };
FA190B053440402E897258DD /* libRNDeviceInfo.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNDeviceInfo.a; sourceTree = "<group>"; };
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; };
F4443977C4A0449581D9F0CB /* libSMXCrashlytics.a */ = {isa = PBXFileReference; name = "libSMXCrashlytics.a"; path = "libSMXCrashlytics.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
... ... @@ -366,6 +368,7 @@
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
27693312177846EB9DBDDFEE /* libRNDeviceInfo.a in Frameworks */,
2D0B16AF9549438E8B407348 /* libSMXCrashlytics.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
... ... @@ -529,6 +532,7 @@
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
EEEADDF370C14F1B8EC1C866 /* RNDeviceInfo.xcodeproj */,
43E66576AEDD4CE09CF30864 /* SMXCrashlytics.xcodeproj */,
);
name = Libraries;
sourceTree = "<group>";
... ... @@ -1086,6 +1090,7 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/YH_RNComponent.app/YH_RNComponent";
... ... @@ -1103,6 +1108,7 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/YH_RNComponent.app/YH_RNComponent";
... ... @@ -1119,6 +1125,7 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../node_modules/react-native/React/**",
"$(SRCROOT)/../node_modules/react-native-device-info/ios/RNDeviceInfo",
"$(SRCROOT)/../node_modules/react-native-fabric/ios/SMXCrashlytics",
);
INFOPLIST_FILE = YH_RNComponent/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
... ... @@ -1140,6 +1147,7 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../node_modules/react-native/React/**",
"$(SRCROOT)/../node_modules/react-native-device-info/ios/RNDeviceInfo",
"$(SRCROOT)/../node_modules/react-native-fabric/ios/SMXCrashlytics",
);
INFOPLIST_FILE = YH_RNComponent/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
... ...
... ... @@ -14,7 +14,7 @@ const {
} = ReactNative;
const YH_ImageView = ReactNative.requireNativeComponent('YH_ImageView', null);
import {CachedImage} from "react-native-img-cache";
/**
* 原生图片
... ... @@ -40,7 +40,7 @@ export default class YH_Image extends Component {
// width = PixelRatio.getPixelSizeForLayoutSize(width);
// height = PixelRatio.getPixelSizeForLayoutSize(height);
width = Math.ceil(width * 2);
height = Math.ceil(height * 2);
... ... @@ -60,6 +60,9 @@ export default class YH_Image extends Component {
if (Platform.OS === 'ios') {
return (
// <CachedImage source={{ uri: this.props.url }} style = {this.props.style} mutable />
<YH_ImageView
{...this.props}
/>
... ...
... ... @@ -27,6 +27,8 @@
"react-native": "^0.54.4",
"react-native-device-info": "^0.21.5",
"react-native-fabric": "^0.5.1",
"react-native-fetch-blob": "^0.10.8",
"react-native-img-cache": "^1.5.3",
"react-native-progress": "^3.4.0",
"react-native-root-toast": "^3.0.1",
"react-native-scrollable-mixin": "^1.0.1",
... ...