@supportworks/multi-imagepicker 8.4.5 → 8.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supportworks/multi-imagepicker",
3
- "version": "8.4.5",
3
+ "version": "8.4.6",
4
4
  "description": "Android and iOS customized multiple image picker. For react-native >= 0.60.",
5
5
  "main": "index.js",
6
6
  "author": {
@@ -1,5 +1,5 @@
1
1
  // Supportworks dependencies
2
- import { colors } from '@supportworks/app-styler'
2
+ import { colors, stdStyles } from '@supportworks/app-styler'
3
3
  import { SwipeModal } from '@supportworks/core-controls'
4
4
  import { Icons } from '@supportworks/icon-library'
5
5
  // Camera module
@@ -97,17 +97,17 @@ const SIDE_BUTTON_ICON_SIZE = Math.round(20 * RIGHT_CONTROL_SCALE)
97
97
  const SIDE_BUTTON_TEXT_SIZE = Math.round(14 * RIGHT_CONTROL_SCALE)
98
98
  const SIDE_BUTTON_GAP = 18
99
99
  const SIDE_ACTION_GROUP_MARGIN_BOTTOM = 28
100
- const GALLERY_PREVIEW_SIZE = Math.round(46 * RIGHT_CONTROL_SCALE)
101
- const GALLERY_PREVIEW_MARGIN_BOTTOM = 32
102
- const GALLERY_PREVIEW_BORDER_RADIUS = 14
103
- const GALLERY_PREVIEW_BADGE_SIZE = 28
104
- const SHUTTER_BUTTON_SIZE = 76
105
- const SHUTTER_BUTTON_MARGIN_BOTTOM = 20
106
- const DONE_BUTTON_HEIGHT = Math.round(36 * RIGHT_CONTROL_SCALE)
107
- const DONE_BUTTON_HORIZONTAL_PADDING = 24
108
- const DONE_BUTTON_TEXT_SIZE = 20
109
- const DONE_BUTTON_ICON_SIZE = 28
110
- const RIGHT_OVERLAY_WIDTH = 132
100
+ const GALLERY_PREVIEW_SIZE = 48
101
+ const GALLERY_PREVIEW_MARGIN_BOTTOM = 40
102
+ const GALLERY_PREVIEW_BORDER_RADIUS = 8
103
+ const GALLERY_PREVIEW_BADGE_SIZE = 20
104
+ const SHUTTER_BUTTON_SIZE = 72
105
+ const SHUTTER_BUTTON_MARGIN_BOTTOM = 40
106
+ const DONE_BUTTON_HEIGHT = 40
107
+ const DONE_BUTTON_HORIZONTAL_PADDING = 12
108
+ const DONE_BUTTON_TEXT_SIZE = 14
109
+ const DONE_BUTTON_ICON_SIZE = 18
110
+ const RIGHT_OVERLAY_WIDTH = 95
111
111
  const ZOOM_SLIDER_TRACK_LENGTH = 180
112
112
  const ZOOM_SLIDER_WIDTH = 60
113
113
  const ZOOM_SLIDER_THUMB_SIZE = 42
@@ -257,19 +257,19 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
257
257
  const sideButtonIconSize = scaleMetric(SIDE_BUTTON_ICON_SIZE, 20)
258
258
  const sideButtonTextSize = scaleMetric(SIDE_BUTTON_TEXT_SIZE, 12)
259
259
  const sideActionGroupMarginBottom = scaleMetric(SIDE_ACTION_GROUP_MARGIN_BOTTOM, 16)
260
- const galleryPreviewSize = scaleMetric(GALLERY_PREVIEW_SIZE, 34)
261
- const galleryPreviewMarginBottom = scaleMetric(GALLERY_PREVIEW_MARGIN_BOTTOM, 16)
262
- const galleryPreviewBorderRadius = scaleMetric(GALLERY_PREVIEW_BORDER_RADIUS, 10)
263
- const galleryPreviewBadgeSize = scaleMetric(GALLERY_PREVIEW_BADGE_SIZE, 22)
264
- const shutterButtonSize = scaleMetric(SHUTTER_BUTTON_SIZE, 58)
265
- const shutterButtonMarginBottom = scaleMetric(SHUTTER_BUTTON_MARGIN_BOTTOM, 12)
266
- const shutterInnerSize = scaleMetric(62, 46)
267
- const doneButtonHeight = scaleMetric(DONE_BUTTON_HEIGHT, 30)
268
- const doneButtonHorizontalPadding = scaleMetric(DONE_BUTTON_HORIZONTAL_PADDING, 16)
269
- const doneButtonTextSize = scaleMetric(DONE_BUTTON_TEXT_SIZE, 16)
270
- const doneButtonIconSize = scaleMetric(DONE_BUTTON_ICON_SIZE, 20)
271
- const doneButtonMarginBottom = scaleMetric(30, 18)
272
- const rightOverlayWidth = scaleMetric(RIGHT_OVERLAY_WIDTH, 96)
260
+ const galleryPreviewSize = GALLERY_PREVIEW_SIZE
261
+ const galleryPreviewMarginBottom = isPhoneSized ? 0 : GALLERY_PREVIEW_MARGIN_BOTTOM
262
+ const galleryPreviewBorderRadius = GALLERY_PREVIEW_BORDER_RADIUS
263
+ const galleryPreviewBadgeSize = GALLERY_PREVIEW_BADGE_SIZE
264
+ const shutterButtonSize = SHUTTER_BUTTON_SIZE
265
+ const shutterButtonMarginBottom = isPhoneSized ? 0 : SHUTTER_BUTTON_MARGIN_BOTTOM
266
+ const shutterInnerSize = 60
267
+ const doneButtonHeight = DONE_BUTTON_HEIGHT
268
+ const doneButtonHorizontalPadding = DONE_BUTTON_HORIZONTAL_PADDING
269
+ const doneButtonTextSize = DONE_BUTTON_TEXT_SIZE
270
+ const doneButtonIconSize = DONE_BUTTON_ICON_SIZE
271
+ const doneButtonMarginBottom = 0
272
+ const rightOverlayWidth = RIGHT_OVERLAY_WIDTH
273
273
  const topOverlayHorizontalInset = isTightLayout ? 10 : isPhoneSized ? 14 : 18
274
274
  const overlaySideInset = isTightLayout ? 8 : isPhoneSized ? 10 : 16
275
275
  const showFlashControl = !isTightLayout
@@ -660,20 +660,17 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
660
660
 
661
661
  const latestCapturedImage = capturedImages[capturedImages.length - 1]
662
662
  const hasCapturedImages = capturedImages.length > 0
663
- const shouldShowGalleryPreview = limit !== 1 && !isTightLayout
663
+ const shouldShowGalleryPreview = limit !== 1
664
664
  const shouldShowDoneButton = limit !== 1
665
665
  const shouldShowZoomSlider = isZoomAvailable && !isTightLayout
666
666
  const visibleSideControlCount = (showFlashControl ? 1 : 0) + (showCameraSwitchControl ? 1 : 0)
667
667
  const gallerySubtitle = `${capturedImages.length} ${capturedImages.length === 1 ? 'image' : 'images'}`
668
- const rightOverlayHeight =
669
- (visibleSideControlCount > 0
670
- ? sideButtonSize * visibleSideControlCount + sideButtonGap * Math.max(visibleSideControlCount - 1, 0) + sideActionGroupMarginBottom
671
- : 0) +
672
- (shouldShowGalleryPreview ? galleryPreviewSize + galleryPreviewMarginBottom : 0) +
673
- shutterButtonSize +
674
- shutterButtonMarginBottom +
675
- (shouldShowDoneButton ? doneButtonHeight + doneButtonMarginBottom : 0)
676
- const rightOverlayTop = Math.max(insets.top + (isTightLayout ? 64 : isPhoneSized ? 80 : 96), Math.round(windowHeight * 0.5 - rightOverlayHeight / 2))
668
+ const phoneControlsBottom = insets.bottom + (isLandscape ? 8 : insets.bottom > 0 ? 50 : 20)
669
+ const primaryControlsTop = Math.max(insets.top + 96, windowHeight / 2 - shutterButtonSize / 2)
670
+ const secondaryControlsHeight = sideButtonSize * visibleSideControlCount + sideButtonGap * Math.max(visibleSideControlCount - 1, 0)
671
+ const secondaryControlsTop = isPhoneSized
672
+ ? windowHeight - phoneControlsBottom - shutterButtonSize - sideActionGroupMarginBottom - secondaryControlsHeight
673
+ : primaryControlsTop - galleryPreviewSize - galleryPreviewMarginBottom - sideActionGroupMarginBottom - secondaryControlsHeight
677
674
  const zoomSliderHeight = ZOOM_SLIDER_TRACK_LENGTH + ZOOM_SLIDER_THUMB_SIZE
678
675
  const zoomSliderTop = Math.max(insets.top + (isPhoneSized ? 88 : 104), Math.round(windowHeight * 0.5 - zoomSliderHeight / 2))
679
676
 
@@ -830,7 +827,7 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
830
827
 
831
828
  <View
832
829
  pointerEvents="box-none"
833
- style={[styles.rightOverlay, { width: rightOverlayWidth, right: overlaySideInset + insets.right, top: rightOverlayTop }]}
830
+ style={[styles.rightOverlay, { width: rightOverlayWidth, right: overlaySideInset + insets.right, top: secondaryControlsTop }]}
834
831
  >
835
832
  {showSecondaryControls && (
836
833
  <View style={[styles.sideActionGroup, { marginBottom: sideActionGroupMarginBottom }]}>
@@ -859,7 +856,17 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
859
856
  )}
860
857
  </View>
861
858
  )}
859
+ </View>
862
860
 
861
+ <View
862
+ pointerEvents="box-none"
863
+ style={[
864
+ styles.rightOverlay,
865
+ isPhoneSized
866
+ ? { left: 24 + insets.left, right: 24 + insets.right, bottom: phoneControlsBottom, height: shutterButtonSize, width: undefined, flexDirection: 'row', alignItems: 'center' }
867
+ : { width: rightOverlayWidth, right: 16 + insets.right, top: primaryControlsTop - (shouldShowGalleryPreview ? galleryPreviewSize + galleryPreviewMarginBottom : 0), alignItems: 'flex-end' }
868
+ ]}
869
+ >
863
870
  {shouldShowGalleryPreview ? (
864
871
  <TouchableOpacity
865
872
  style={[
@@ -868,7 +875,8 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
868
875
  width: galleryPreviewSize,
869
876
  height: galleryPreviewSize,
870
877
  borderRadius: galleryPreviewBorderRadius,
871
- marginBottom: galleryPreviewMarginBottom
878
+ marginBottom: galleryPreviewMarginBottom,
879
+ marginRight: isPhoneSized ? 0 : 12
872
880
  },
873
881
  !hasCapturedImages && styles.galleryPreviewButtonEmpty
874
882
  ]}
@@ -885,7 +893,8 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
885
893
  style={[
886
894
  styles.galleryPreviewBadge,
887
895
  {
888
- right: Math.round(-8 * controlScale),
896
+ right: -9,
897
+ top: -9,
889
898
  minWidth: galleryPreviewBadgeSize,
890
899
  height: galleryPreviewBadgeSize,
891
900
  borderRadius: galleryPreviewBadgeSize / 2
@@ -903,6 +912,7 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
903
912
  style={[
904
913
  styles.shutterButton,
905
914
  { width: shutterButtonSize, height: shutterButtonSize, borderRadius: shutterButtonSize / 2, marginBottom: shutterButtonMarginBottom },
915
+ isPhoneSized && { position: 'absolute', left: '50%', marginLeft: -shutterButtonSize / 2 },
906
916
  isShutterDisabled && styles.shutterButtonDisabled
907
917
  ]}
908
918
  onPress={capturePhoto}
@@ -928,7 +938,8 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
928
938
  <TouchableOpacity
929
939
  style={[
930
940
  styles.doneButton,
931
- { height: doneButtonHeight, paddingHorizontal: doneButtonHorizontalPadding, borderRadius: doneButtonHeight / 2, marginBottom: doneButtonMarginBottom },
941
+ { width: 95, height: doneButtonHeight, paddingHorizontal: doneButtonHorizontalPadding, borderRadius: doneButtonHeight / 2, marginBottom: doneButtonMarginBottom },
942
+ isPhoneSized && { position: 'absolute', right: 0 },
932
943
  isDoneDisabled && styles.doneButtonDisabled
933
944
  ]}
934
945
  onPress={handleDonePress}
@@ -981,7 +992,7 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
981
992
  height={228}
982
993
  propagateSwipe
983
994
  showTopNav={false}
984
- backgroundColor="#151515"
995
+ backgroundColor="#121212"
985
996
  >
986
997
  <View style={styles.gallerySheet}>
987
998
  <View style={styles.gallerySheetHeader}>
@@ -1021,7 +1032,8 @@ const CameraModal: React.FC<CameraTestModalProps> = ({ onDone, onCancel, cameraR
1021
1032
  onPress={() => removeImage(capturedImages.findIndex(item => item.uri === image.uri))}
1022
1033
  hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}
1023
1034
  >
1024
- <Icons.IconClose_WithPad size={16} fill={colors.black} fillOpacity={0.72} />
1035
+ <View pointerEvents="none" style={[styles.removeButtonBackground, stdStyles.Shadow03dp]} />
1036
+ <Icons.IconCancel_WithPad size={18} fill={colors.white} fillOpacity={1} />
1025
1037
  </TouchableOpacity>
1026
1038
  </View>
1027
1039
  )}
@@ -1245,7 +1257,7 @@ const styles = StyleSheet.create({
1245
1257
  right: -8,
1246
1258
  minWidth: GALLERY_PREVIEW_BADGE_SIZE,
1247
1259
  height: GALLERY_PREVIEW_BADGE_SIZE,
1248
- paddingHorizontal: 6,
1260
+ paddingHorizontal: 3,
1249
1261
  borderRadius: GALLERY_PREVIEW_BADGE_SIZE / 2,
1250
1262
  backgroundColor: colors.blue,
1251
1263
  alignItems: 'center',
@@ -1253,7 +1265,7 @@ const styles = StyleSheet.create({
1253
1265
  },
1254
1266
  galleryPreviewBadgeText: {
1255
1267
  color: colors.white,
1256
- fontSize: 15,
1268
+ fontSize: 12,
1257
1269
  fontWeight: 'bold'
1258
1270
  },
1259
1271
  zoomSliderContainer: {
@@ -1396,17 +1408,17 @@ const styles = StyleSheet.create({
1396
1408
  alignItems: 'center'
1397
1409
  },
1398
1410
  galleryImageItem: {
1399
- width: 46,
1400
- height: 62,
1411
+ width: 54,
1412
+ height: 72,
1401
1413
  marginRight: 8,
1402
1414
  borderRadius: 8,
1403
- overflow: 'hidden',
1404
1415
  position: 'relative',
1405
1416
  backgroundColor: 'rgba(255,255,255,0.08)'
1406
1417
  },
1407
1418
  galleryModalImage: {
1408
1419
  width: '100%',
1409
- height: '100%'
1420
+ height: '100%',
1421
+ borderRadius: 8
1410
1422
  },
1411
1423
  removeButton: {
1412
1424
  position: 'absolute',
@@ -1414,11 +1426,15 @@ const styles = StyleSheet.create({
1414
1426
  left: 3,
1415
1427
  width: 18,
1416
1428
  height: 18,
1417
- borderRadius: 9,
1418
- backgroundColor: colors.white,
1419
1429
  alignItems: 'center',
1420
- justifyContent: 'center',
1421
- opacity: 0.95
1430
+ justifyContent: 'center'
1431
+ },
1432
+ removeButtonBackground: {
1433
+ position: 'absolute',
1434
+ width: 15,
1435
+ height: 15,
1436
+ borderRadius: 7.5,
1437
+ backgroundColor: colors.black62
1422
1438
  },
1423
1439
  shutterFlashOverlay: {
1424
1440
  position: 'absolute',