Skip to content

Commit

Permalink
Upgrade to react-native-fast-image 6.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
moonjava2005 committed Jul 3, 2019
1 parent 180cc35 commit 7bf670c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
26 changes: 17 additions & 9 deletions ios/RNPhotoView.m
Original file line number Diff line number Diff line change
Expand Up @@ -153,19 +153,19 @@ - (CGFloat)initialZoomScaleWithMinScale {
return _minZoomScale;
}
CGSize imageSize = _photoImageView.image.size;
// CGFloat boundRatio = boundSize.width / boundSize.height;
// CGFloat imageRatio = imageSize.width / imageSize.height;
// CGFloat boundRatio = boundSize.width / boundSize.height;
// CGFloat imageRatio = imageSize.width / imageSize.height;
CGFloat xScale = boundSize.width / imageSize.width; // the scale needed to perfectly fit the image width-wise
CGFloat yScale = boundSize.height / imageSize.height; // the scale needed to perfectly fit the image height-wise
// Zooms standard portrait images on a 3.5in screen but not on a 4in screen.

zoomScale = MIN(xScale, yScale);
// Ensure we don't zoom in or out too far, just in case
zoomScale = MIN(MAX(self.minimumZoomScale, zoomScale), self.maximumZoomScale);

zoomScale = MIN(xScale, yScale);
// Ensure we don't zoom in or out too far, just in case
zoomScale = MIN(MAX(self.minimumZoomScale, zoomScale), self.maximumZoomScale);
}
return zoomScale;
// return 0.5;
// return 0.5;
}

- (void)setMaxMinZoomScalesForCurrentBounds {
Expand Down Expand Up @@ -298,12 +298,12 @@ - (void)initView {
_maxZoomScale = 3.0;

// Setup
// self.backgroundColor = [UIColor redColor];
self.backgroundColor = [UIColor clearColor];
self.delegate = self;
self.decelerationRate = UIScrollViewDecelerationRateFast;
self.showsVerticalScrollIndicator = NO;
self.showsHorizontalScrollIndicator = NO;
self.scrollsToTop = NO;
if (@available(iOS 11.0, *)) {
self.contentInsetAdjustmentBehavior=UIScrollViewContentInsetAdjustmentNever;
}
Expand All @@ -319,6 +319,7 @@ - (void)initView {
_photoImageView = [[MWTapDetectingImageView alloc] init];
CGRect _photoFrame= CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height);
_photoImageView.frame=_photoFrame;
// _photoImageView.backgroundColor = [UIColor greenColor];
_photoImageView.backgroundColor = [UIColor clearColor];
__block RNPhotoView * blockSelf=self;
[_photoImageView setOnFastImageLoad:^(NSDictionary *body){
Expand Down Expand Up @@ -395,4 +396,11 @@ - (void)reactSetFrame:(CGRect)frame
[self layoutIfNeeded];
}

- (void)didSetProps:(NSArray<NSString *> *)changedProps
{
if (_photoImageView!=nil) {
[_photoImageView didSetProps:changedProps];
}
}

@end
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-pinch-zoom-image",
"version": "0.0.7",
"version": "0.0.8",
"description": "Pinch to zoom and pan image",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 7bf670c

Please sign in to comment.