Skip to content

Commit

Permalink
Finish iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
moonjava2005 committed May 23, 2019
1 parent 756252d commit b8a2d9f
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 185 deletions.
10 changes: 3 additions & 7 deletions PhotoView.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ export default class PhotoView extends Component {
console.warn('source.uri should not be an empty string');
}

if (this.props.src) {
console.warn('The <PhotoView> component requires a `source` property rather than `src`.');
}

if (source && source.uri) {
var {onLoadStart, onLoad, onLoadEnd, onProgress, onTap, onViewTap, onScale, ...props} = this.props;

Expand All @@ -61,7 +57,7 @@ export default class PhotoView extends Component {
onPhotoViewerViewTap: onViewTap,
onPhotoViewerScale: onScale,
...props,
src: source,
source,
loadingIndicatorSrc: loadingIndicatorSource ? loadingIndicatorSource.uri : null,
};

Expand All @@ -80,9 +76,9 @@ var cfg = {
onPhotoViewerTap: true,
onPhotoViewerViewTap: true,
onPhotoViewerScale: true,
src: true,
source: true,
loadingIndicatorSrc: true
}
};

const RNPhotoView = requireNativeComponent('RNPhotoView', PhotoView, cfg);
const RNPhotoView = requireNativeComponent('RNPinchZoomImage', PhotoView, cfg);
30 changes: 0 additions & 30 deletions ios/MWTapDetectingFastImageView.h

This file was deleted.

68 changes: 0 additions & 68 deletions ios/MWTapDetectingFastImageView.m

This file was deleted.

3 changes: 2 additions & 1 deletion ios/MWTapDetectingImageView.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <react-native-fast-image/FFFastImageView.h>

@protocol MWTapDetectingImageViewDelegate;

@interface MWTapDetectingImageView : UIImageView {}
@interface MWTapDetectingImageView : FFFastImageView {}

@property (nonatomic, weak) id <MWTapDetectingImageViewDelegate> tapDelegate;

Expand Down
7 changes: 7 additions & 0 deletions ios/MWTapDetectingImageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@

@implementation MWTapDetectingImageView

- (id)init {
if ((self = [super init])) {
self.userInteractionEnabled = YES;
}
return self;
}

- (id)initWithFrame:(CGRect)frame {
if ((self = [super initWithFrame:frame])) {
self.userInteractionEnabled = YES;
Expand Down
5 changes: 2 additions & 3 deletions ios/RNPhotoView.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@
#import <React/RCTComponent.h>
#import "MWTapDetectingImageView.h"
#import "MWTapDetectingView.h"
#import <react-native-fast-image/FFFastImageSource.h>

@class RCTBridge;

@interface RNPhotoView : UIScrollView <UIScrollViewDelegate, MWTapDetectingImageViewDelegate, MWTapDetectingViewDelegate>

#pragma mark - Data

@property (nonatomic, strong) NSDictionary *source;
@property (nonatomic, strong) NSDictionary *src;
@property (nonatomic, strong) FFFastImageSource *source;
@property (nonatomic, strong) NSString *loadingIndicatorSrc;
@property (nonatomic, assign) NSInteger scale;
@property (nonatomic, assign) CGFloat minZoomScale;
@property (nonatomic, assign) CGFloat maxZoomScale;
@property (nonatomic, assign) BOOL autoAdjustContentInset;

#pragma mark - Block

@property (nonatomic, copy) RCTDirectEventBlock onPhotoViewerScale;
Expand Down
Loading

0 comments on commit b8a2d9f

Please sign in to comment.