Skip to content

Commit ef532a3

Browse files
Support react-native 0.60+ and bug fixes (#194)
* Fix android build warning. * Fix gradle build. * Fix photodraweeview version. * rollback photodraweeview version. * Update photodraweeview:1.1.3 * replaced deprecated bridge.imageLoader calls with moduleForClass API * Rollback minSdkVersion. * fix: Xcode 12 compatibility
1 parent e28f541 commit ef532a3

File tree

6 files changed

+50
-30
lines changed

6 files changed

+50
-30
lines changed

android/build.gradle

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,23 @@
22

33
buildscript {
44
repositories {
5+
google()
56
jcenter()
67
}
78
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.1.0'
9-
10-
// NOTE: Do not place your application dependencies here; they belong
11-
// in the individual module build.gradle files
9+
classpath 'com.android.tools.build:gradle:3.3.2'
1210
}
1311
}
1412

1513
apply plugin: 'com.android.library'
1614

1715
android {
18-
compileSdkVersion 23
19-
buildToolsVersion "25.0.0"
16+
compileSdkVersion 28
17+
buildToolsVersion "28.0.3"
2018

2119
defaultConfig {
2220
minSdkVersion 16
23-
targetSdkVersion 22
21+
targetSdkVersion 28
2422
versionCode 1
2523
}
2624
lintOptions {
@@ -30,11 +28,12 @@ android {
3028

3129
repositories {
3230
mavenCentral()
31+
google()
3332
jcenter()
3433
}
3534

3635
dependencies {
37-
compile 'com.facebook.react:react-native:+'
38-
compile 'com.facebook.fresco:fresco:0.11.0'
39-
compile 'me.relex:photodraweeview:1.0.0'
36+
implementation 'com.facebook.react:react-native:+'
37+
implementation 'com.facebook.fresco:fresco:1.12.1'
38+
implementation 'me.relex:photodraweeview:1.1.3'
4039
}

example/android/app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
88

99
<uses-sdk
10-
android:minSdkVersion="16"
11-
android:targetSdkVersion="22" />
10+
android:minSdkVersion="18"
11+
android:targetSdkVersion="28" />
1212

1313
<application
1414
android:name=".MainApplication"

ios/RNPhotoView.m

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ - (void)view:(UIView *)view doubleTapDetected:(UITouch *)touch {
140140
#pragma mark - Setup
141141

142142
- (CGFloat)initialZoomScaleWithMinScale {
143+
CGFloat minZoom = self.minimumZoomScale;
143144
CGFloat zoomScale = self.minimumZoomScale;
144145
if (_photoImageView) {
145146
// Zoom image to fill if the aspect ratios are fairly similar
@@ -153,7 +154,7 @@ - (CGFloat)initialZoomScaleWithMinScale {
153154
if (ABS(boundsAR - imageAR) < 0.17) {
154155
zoomScale = MAX(xScale, yScale);
155156
// Ensure we don't zoom in or out too far, just in case
156-
zoomScale = MIN(MAX(self.minimumZoomScale, zoomScale), self.maximumZoomScale);
157+
zoomScale = MIN(MAX(minZoom, zoomScale), minZoom);
157158
}
158159
}
159160
return zoomScale;
@@ -295,7 +296,7 @@ - (void)setSource:(NSDictionary *)source {
295296
}
296297
_source = source;
297298
NSURL *imageURL = [NSURL URLWithString:uri];
298-
299+
299300
if (![[uri substringToIndex:4] isEqualToString:@"http"]) {
300301
@try {
301302
UIImage *image = RCTImageFromLocalAssetURL(imageURL);
@@ -316,10 +317,10 @@ - (void)setSource:(NSDictionary *)source {
316317
}
317318

318319
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:imageURL];
319-
320+
320321
if (source[@"headers"]) {
321322
NSMutableURLRequest *mutableRequest = [request mutableCopy];
322-
323+
323324
NSDictionary *headers = source[@"headers"];
324325
NSEnumerator *enumerator = [headers keyEnumerator];
325326
id key;
@@ -334,7 +335,7 @@ - (void)setSource:(NSDictionary *)source {
334335
}
335336

336337
// use default values from [imageLoader loadImageWithURLRequest:request callback:callback] method
337-
[_bridge.imageLoader loadImageWithURLRequest:request
338+
[[_bridge moduleForClass:[RCTImageLoader class]] loadImageWithURLRequest:request
338339
size:CGSizeZero
339340
scale:1
340341
clipped:YES

package-lock.json

Lines changed: 30 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-photo-view",
3-
"version": "1.5.2",
3+
"version": "1.5.3",
44
"description": "Displaying photos with pinch-to-zoom",
55
"main": "index.js",
66
"author": {

react-native-photo-view.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ Pod::Spec.new do |s|
66
s.name = "react-native-photo-view"
77
s.version = package["version"]
88
s.summary = package['description']
9-
s.author = package['author']
9+
s.author = package['author']
1010
s.homepage = package['homepage']
1111
s.license = package['license']
1212
s.ios.deployment_target = "7.0"
1313
s.tvos.deployment_target = "9.0"
1414
s.source = { :git => "https://github.com/alwx/react-native-photo-view.git", :tag => "v#{s.version}" }
1515
s.source_files = "ios/*.{h,m}"
16-
s.dependency "React"
16+
s.dependency "React-Core"
1717
end

0 commit comments

Comments
 (0)