Merge pull request #106 from wix/image_stroke_width_ios

[iOS] Add Image stroke width
This commit is contained in:
Ran Greenberg 2017-12-31 10:18:17 +02:00 committed by GitHub
commit 4403017767
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 5 deletions

View File

@ -166,6 +166,7 @@ Attribute | Values | Description
`minimumInteritemSpacing` | Float | Minimum inner Item spacing
`minimumLineSpacing` | Float | Minimum line spacing
`imageStrokeColor` | Color | Image stroke color
`imageStrokeColorWidth` | Number > 0 | Image stroke color width
`albumName` | String | Album name to show
`columnCount` | Integer | How many clumns in one row
`onTapImage` | Function | Callback when image tapped

View File

@ -25,6 +25,7 @@
+(void)setUnSlectedImageIcon:(UIImage*)image;
+(void)setSupported:(NSDictionary*)newSupported;
+(void)setImageStrokeColor:(UIColor*)strokeColor;
+(void)setImageStrokeColorWidth:(NSNumber*)width;
+(void)setSelection:(NSDictionary*)selectionDict;
+(void)setRemoteDownloadIndicatorColor:(UIColor*)color;
+(void)setRemoteDownloadIndicatorType:(NSString*)type;

View File

@ -21,9 +21,9 @@
#define BADGE_MARGIN 5
#define BADGE_COLOR 0x00ADF5
#define IMAGE_OVERLAY_ALPHA 0.5
#define BADGE_MARGIN 5
#define BADGE_COLOR 0x00ADF5
#define IMAGE_OVERLAY_ALPHA 0.5
#define SELECTION_SELECTED_IMAGE @"selectedImage"
#define SELECTION_UNSELECTED_IMAGE @"unselectedImage"
@ -42,6 +42,7 @@ static UIImage *selectedImageIcon = nil;
static UIImage *unSelectedImageIcon = nil;
static NSDictionary *supported = nil;
static UIColor *imageStrokeColor = nil;
static NSNumber *imageStrokeColorWidth = nil;
static NSDictionary *selection = nil;
static NSString *imagePosition = nil;
static UIColor *selectionOverlayColor = nil;
@ -84,6 +85,11 @@ static NSString *remoteDownloadIndicatorType = REMOTE_DOWNLOAD_INDICATOR_TYPE_SP
if (strokeColor) imageStrokeColor = strokeColor;
}
+(void)setImageStrokeColorWidth:(NSNumber*)width {
if (width) imageStrokeColorWidth = width;
}
+(void)setSelection:(NSDictionary*)selectionDict {
if (selectionDict) selection = selectionDict;
}
@ -94,6 +100,7 @@ static NSString *remoteDownloadIndicatorType = REMOTE_DOWNLOAD_INDICATOR_TYPE_SP
unSelectedImageIcon = nil;
supported = nil;
imageStrokeColor = nil;
imageStrokeColorWidth = nil;
selection = nil;
imagePosition = nil;
selectionOverlayColor = nil;
@ -163,8 +170,10 @@ static NSString *remoteDownloadIndicatorType = REMOTE_DOWNLOAD_INDICATOR_TYPE_SP
CGRect imageViewFrame = self.bounds;
if(imageStrokeColor) {
imageViewFrame.size.height -= 2;
imageViewFrame.size.width -= 2;
if (imageStrokeColorWidth && imageStrokeColorWidth.floatValue > 0) {
imageViewFrame.size.height -= imageStrokeColorWidth.floatValue;
imageViewFrame.size.width -= imageStrokeColorWidth.floatValue;
}
self.backgroundColor = imageStrokeColor;
}

View File

@ -56,6 +56,7 @@ typedef void (^CompletionBlock)(BOOL success);
@property (nonatomic, strong) UIImage *selectedImageIcon;
@property (nonatomic, strong) UIImage *unSelectedImageIcon;
@property (nonatomic, strong) UIColor *imageStrokeColor;
@property (nonatomic, strong) NSNumber *imageStrokeColorWidth;
@property (nonatomic, strong) NSNumber *disableSelectionIcons;
@property (nonatomic, strong) NSDictionary *selection;
@property (nonatomic) UIEdgeInsets contentInset;
@ -220,6 +221,10 @@ static NSString * const CustomCellReuseIdentifier = @"CustomCell";
[CKGalleryCollectionViewCell setImageStrokeColor:imageStrokeColor];
}
-(void)setImageStrokeColorWidth:(NSNumber *)imageStrokeColorWidth {
[CKGalleryCollectionViewCell setImageStrokeColorWidth:imageStrokeColorWidth];
}
-(void)setSelection:(NSDictionary *)selection {
[CKGalleryCollectionViewCell setSelection:selection];
}
@ -706,6 +711,7 @@ RCT_EXPORT_VIEW_PROPERTY(unSelectedImageIcon, UIImage);
RCT_EXPORT_VIEW_PROPERTY(selectedImages, NSArray);
RCT_EXPORT_VIEW_PROPERTY(fileTypeSupport, NSDictionary);
RCT_EXPORT_VIEW_PROPERTY(imageStrokeColor, UIColor);
RCT_EXPORT_VIEW_PROPERTY(imageStrokeColorWidth, NSNumber);
RCT_EXPORT_VIEW_PROPERTY(disableSelectionIcons, NSNumber);
RCT_EXPORT_VIEW_PROPERTY(customButtonStyle, NSDictionary);
RCT_EXPORT_VIEW_PROPERTY(onCustomButtonPress, RCTDirectEventBlock);