diff --git a/ios/RNPhotoView.m b/ios/RNPhotoView.m index 6002408..2f0714f 100644 --- a/ios/RNPhotoView.m +++ b/ios/RNPhotoView.m @@ -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 { @@ -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; } @@ -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){ @@ -395,4 +396,11 @@ - (void)reactSetFrame:(CGRect)frame [self layoutIfNeeded]; } +- (void)didSetProps:(NSArray *)changedProps +{ + if (_photoImageView!=nil) { + [_photoImageView didSetProps:changedProps]; + } +} + @end diff --git a/package.json b/package.json index a0eb145..a684dce 100644 --- a/package.json +++ b/package.json @@ -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": {