diff --git a/README.md b/README.md index 1a1f45e..aa9ddb0 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/ios/lib/ReactNativeCameraKit/CKGalleryCollectionViewCell.h b/ios/lib/ReactNativeCameraKit/CKGalleryCollectionViewCell.h index b151758..4474b9e 100644 --- a/ios/lib/ReactNativeCameraKit/CKGalleryCollectionViewCell.h +++ b/ios/lib/ReactNativeCameraKit/CKGalleryCollectionViewCell.h @@ -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; diff --git a/ios/lib/ReactNativeCameraKit/CKGalleryCollectionViewCell.m b/ios/lib/ReactNativeCameraKit/CKGalleryCollectionViewCell.m index c7122c4..e31f12b 100644 --- a/ios/lib/ReactNativeCameraKit/CKGalleryCollectionViewCell.m +++ b/ios/lib/ReactNativeCameraKit/CKGalleryCollectionViewCell.m @@ -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; } diff --git a/ios/lib/ReactNativeCameraKit/CKGalleryViewManager.m b/ios/lib/ReactNativeCameraKit/CKGalleryViewManager.m index 6bba60f..31ba415 100644 --- a/ios/lib/ReactNativeCameraKit/CKGalleryViewManager.m +++ b/ios/lib/ReactNativeCameraKit/CKGalleryViewManager.m @@ -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);