motorinc-gallery-picker-pro 1.0.2 → 1.0.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": "motorinc-gallery-picker-pro",
3
- "version": "1.0.2",
3
+ "version": "1.0.6",
4
4
  "description": "A comprehensive React Native media gallery picker with smooth animations, multi-select, single-select, crop functionality, and native iOS/Android support",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -35,7 +35,7 @@
35
35
  "react-native-view-shot": ">=4.0.0"
36
36
  },
37
37
  "dependencies": {
38
- "motorinc-global-components": "^2.1.5",
38
+ "motorinc-global-components": "^3.9.5",
39
39
  "react-native-worklets": "^0.4.1"
40
40
  },
41
41
  "repository": {
@@ -45,8 +45,9 @@ import {
45
45
  SPACING_16,
46
46
  SPACING_24,
47
47
  SPACING_4,
48
+ Header,
48
49
  } from 'motorinc-global-components';
49
- import { ThemeContext, FontProvider, useTheme } from 'motorinc-global-components';
50
+ import {ThemeContext, FontProvider, useTheme} from 'motorinc-global-components';
50
51
  const {width: screenWidth, height: screenHeight} = Dimensions.get('window');
51
52
 
52
53
  export interface CropParams {
@@ -83,7 +84,7 @@ interface props {
83
84
  onCancel?: () => void; // Callback for cancel button
84
85
  onNext?: (selectedAssets: PhotoAsset[]) => void; // Callback for next button
85
86
  maxSelectionLimit?: number;
86
- statusBarvalue?: number
87
+ statusBarvalue?: number;
87
88
  }
88
89
 
89
90
  const MainPhotoGallery = React.forwardRef<MainPhotoGalleryRef, props>(
@@ -105,7 +106,7 @@ const MainPhotoGallery = React.forwardRef<MainPhotoGalleryRef, props>(
105
106
  onCancel,
106
107
  onNext,
107
108
  maxSelectionLimit = 10,
108
- statusBarvalue
109
+ statusBarvalue,
109
110
  },
110
111
  ref,
111
112
  ) => {
@@ -329,7 +330,11 @@ const MainPhotoGallery = React.forwardRef<MainPhotoGalleryRef, props>(
329
330
  };
330
331
 
331
332
  return (
332
- <View style={[styles.selectedAssetWrapper, {height: 1.07 * screenWidth, width: screenWidth}]}>
333
+ <View
334
+ style={[
335
+ styles.selectedAssetWrapper,
336
+ {height: 1.07 * screenWidth, width: screenWidth},
337
+ ]}>
333
338
  <ImageCropper
334
339
  ref={getCropperRef(item.id)}
335
340
  key={`${item.id}-${aspectRatio}`}
@@ -950,9 +955,9 @@ const MainPhotoGallery = React.forwardRef<MainPhotoGalleryRef, props>(
950
955
  const handleSingleAssetSelection = (asset: PhotoAsset) => {
951
956
  // For single selection mode - keep the selection persistent
952
957
  console.log('Single asset selected:', asset);
953
- translateY.value = withTiming(0, {
954
- duration: 300,
955
- });
958
+ translateY.value = withTiming(0, {
959
+ duration: 300,
960
+ });
956
961
 
957
962
  // Set the selected asset and keep it selected
958
963
  setSelectedAssetIds(new Set([asset.id]));
@@ -978,9 +983,9 @@ const MainPhotoGallery = React.forwardRef<MainPhotoGalleryRef, props>(
978
983
  };
979
984
 
980
985
  const handleMultiAssetSelection = (asset: PhotoAsset) => {
981
- translateY.value = withTiming(0, {
982
- duration: 300,
983
- });
986
+ translateY.value = withTiming(0, {
987
+ duration: 300,
988
+ });
984
989
 
985
990
  if (!isSelectionMode) {
986
991
  // Start selection mode on long press
@@ -1121,10 +1126,9 @@ const MainPhotoGallery = React.forwardRef<MainPhotoGalleryRef, props>(
1121
1126
  if (multiSelect) {
1122
1127
  // Start multi-selection mode on long press
1123
1128
  handleMultiAssetSelection(asset);
1124
- translateY.value = withTiming(0, {
1129
+ translateY.value = withTiming(0, {
1125
1130
  duration: 300,
1126
1131
  });
1127
-
1128
1132
  }
1129
1133
  };
1130
1134
 
@@ -1178,7 +1182,6 @@ const MainPhotoGallery = React.forwardRef<MainPhotoGalleryRef, props>(
1178
1182
  if (selectedAssetIds.size === 0) return;
1179
1183
 
1180
1184
  try {
1181
-
1182
1185
  // Capture cropped images first
1183
1186
  await captureAllCroppedImages();
1184
1187
  const selectedAssets = assets.filter(asset =>
@@ -1473,7 +1476,7 @@ const MainPhotoGallery = React.forwardRef<MainPhotoGalleryRef, props>(
1473
1476
  <TouchableOpacity
1474
1477
  activeOpacity={0.8}
1475
1478
  key={ratio}
1476
- style={[styles.aspectRatioButton]}
1479
+ // style={[styles.aspectRatioButton]}
1477
1480
  onPress={() => setAspectRatio(ratio)}
1478
1481
  hitSlop={{top: 12, bottom: 12}}>
1479
1482
  <View
@@ -1514,8 +1517,18 @@ const MainPhotoGallery = React.forwardRef<MainPhotoGalleryRef, props>(
1514
1517
  onPress={() => {
1515
1518
  displayPreviousIndex();
1516
1519
  }}>
1517
-
1518
- <IconComponent
1520
+ <PlayyText
1521
+ BodyEmphasized
1522
+ color={
1523
+ !selectedAssets ||
1524
+ selectedAssets.length === 0 ||
1525
+ currentSelectedIndex === 0
1526
+ ? 'rgba(235, 238, 245, 0.60)'
1527
+ : '#fff'
1528
+ }>
1529
+ {String.fromCharCode(60558)}
1530
+ </PlayyText>
1531
+ {/* <IconComponent
1519
1532
  name={icons.leftArrow}
1520
1533
  color={
1521
1534
  !selectedAssets ||
@@ -1524,8 +1537,7 @@ const MainPhotoGallery = React.forwardRef<MainPhotoGalleryRef, props>(
1524
1537
  ? 'rgba(235, 238, 245, 0.60)'
1525
1538
  : '#fff'
1526
1539
  }
1527
- />
1528
-
1540
+ /> */}
1529
1541
  </TouchableOpacity>
1530
1542
 
1531
1543
  {/* <Text
@@ -1546,20 +1558,27 @@ const MainPhotoGallery = React.forwardRef<MainPhotoGalleryRef, props>(
1546
1558
  onPress={() => {
1547
1559
  displayNextIndex();
1548
1560
  }}>
1549
-
1550
-
1551
-
1552
- <IconComponent
1553
- name={icons.rightArrow}
1554
- color={
1555
- !selectedAssets ||
1556
- selectedAssets.length === 0 ||
1557
- currentSelectedIndex >= selectedAssets.length - 1
1558
- ? "rgba(235, 238, 245, 0.60)"
1559
- : "#fff"
1560
- }
1561
- />
1562
-
1561
+ {/* <IconComponent
1562
+ name={icons.rightArrow}
1563
+ color={
1564
+ !selectedAssets ||
1565
+ selectedAssets.length === 0 ||
1566
+ currentSelectedIndex >= selectedAssets.length - 1
1567
+ ? 'rgba(235, 238, 245, 0.60)'
1568
+ : '#fff'
1569
+ }
1570
+ /> */}
1571
+ <PlayyText
1572
+ BodyEmphasized
1573
+ color={
1574
+ !selectedAssets ||
1575
+ selectedAssets.length === 0 ||
1576
+ currentSelectedIndex >= selectedAssets.length - 1
1577
+ ? 'rgba(235, 238, 245, 0.60)'
1578
+ : '#fff'
1579
+ }>
1580
+ {String.fromCharCode(60559)}
1581
+ </PlayyText>
1563
1582
  </TouchableOpacity>
1564
1583
  </View>
1565
1584
  </View>
@@ -1667,6 +1686,12 @@ const MainPhotoGallery = React.forwardRef<MainPhotoGalleryRef, props>(
1667
1686
  );
1668
1687
  };
1669
1688
 
1689
+ const handleNextPress = useCallback(() => {
1690
+ if (onNext) {
1691
+ onNext(selectedAssets || []);
1692
+ }
1693
+ }, [onNext, selectedAssets]);
1694
+
1670
1695
  const renderCancelNextButtons = () => {
1671
1696
  // Only show buttons if we have the callbacks and are in multi-select mode
1672
1697
  if (!multiSelect || (!onCancel && !onNext)) {
@@ -1676,20 +1701,37 @@ const MainPhotoGallery = React.forwardRef<MainPhotoGalleryRef, props>(
1676
1701
  const currentSelectedAssets = selectedAssets || [];
1677
1702
 
1678
1703
  return (
1679
- <NavigationHeader
1680
- backIcon
1681
- statusBarvalue={statusBarvalue!}
1682
- handleBack={onCancel}
1683
- buttonTitle='Next'
1684
- buttontextColor='#fff'
1685
- backIconColor='#fff'
1686
- isButton
1687
- label='Back'
1688
- labelColor='#fff'
1689
- // @ts-ignore
1690
- handlePressButton={onNext}
1691
- />
1692
- )
1704
+ // <NavigationHeader
1705
+ // backIcon
1706
+ // statusBarvalue={statusBarvalue!}
1707
+ // handleBack={onCancel}
1708
+ // buttonTitle="Next"
1709
+ // buttontextColor="#fff"
1710
+ // backIconColor="#fff"
1711
+ // isButton
1712
+ // label="Back"
1713
+ // labelColor="#fff"
1714
+ // // @ts-ignore
1715
+ // handlePressButton={onNext}
1716
+ // />
1717
+ <Header
1718
+ statusBarValue={statusBarvalue}
1719
+ style={{backgroundColor: '#000'}}>
1720
+ <Header.Row>
1721
+ <Header.Left
1722
+ label="Back"
1723
+ labelColor="#fff"
1724
+ onBackPress={onCancel}
1725
+ />
1726
+ <Header.Right
1727
+ buttonTitle="Next"
1728
+ buttonTextColor="#008BF5"
1729
+ isButton
1730
+ onButtonPress={handleNextPress}
1731
+ />
1732
+ </Header.Row>
1733
+ </Header>
1734
+ );
1693
1735
  };
1694
1736
 
1695
1737
  const renderSelectedImagesModal = () => (
@@ -1973,70 +2015,64 @@ const MainPhotoGallery = React.forwardRef<MainPhotoGalleryRef, props>(
1973
2015
  });
1974
2016
 
1975
2017
  return (
1976
- <FontProvider
1977
- fonts={{
1978
- regular: "Playy-Regular",
1979
- medium: "Playy-Medium",
1980
-
1981
- bold: "Playy-Bold",
1982
-
1983
- SemiCondensedExtraBold: Platform.OS === "android"
1984
-
1985
- ? "OpenSans_SemiCondensed-ExtraBold"
2018
+ <FontProvider
2019
+ fonts={{
2020
+ regular: 'Playy-Regular',
2021
+ medium: 'Playy-Medium',
1986
2022
 
1987
- : "OpenSansSemiCondensed-ExtraBold"
2023
+ bold: 'Playy-Bold',
1988
2024
 
1989
- }}
1990
-
1991
- >
1992
- <View
1993
- style={{
1994
- backgroundColor: '#000',
2025
+ SemiCondensedExtraBold:
2026
+ Platform.OS === 'android'
2027
+ ? 'OpenSans_SemiCondensed-ExtraBold'
2028
+ : 'OpenSansSemiCondensed-ExtraBold',
1995
2029
  }}>
2030
+ <View
2031
+ style={{
2032
+ backgroundColor: '#000',
2033
+ }}>
2034
+ {renderCancelNextButtons()}
2035
+
2036
+ <Animated.View
2037
+ style={[
2038
+ styles.container,
2039
+ animatedStyle,
2040
+ {
2041
+ height: screenHeight + (screenWidth * 1.07 + 44 - 140),
2042
+ },
2043
+ ]}>
2044
+ <GestureHandlerRootView>
2045
+ {(permissionStatus === 'authorized' ||
2046
+ permissionStatus === 'limited') && (
2047
+ <>
2048
+ <GestureDetector gesture={selectedAssetGesture}>
2049
+ <View>{renderSelectedAssetsHeader()}</View>
2050
+ </GestureDetector>
2051
+
2052
+ <GestureDetector gesture={renderHeaderGesture}>
2053
+ <Animated.View>
2054
+ {renderCustomHeader()}
2055
+ {renderHeader()}
2056
+ </Animated.View>
2057
+ </GestureDetector>
2058
+ </>
2059
+ )}
1996
2060
 
1997
- {renderCancelNextButtons()}
2061
+ <GestureDetector gesture={assetGesture}>
2062
+ {renderAssetsGrid()}
2063
+ </GestureDetector>
2064
+ </GestureHandlerRootView>
2065
+ {renderManageModal()}
1998
2066
 
1999
- <Animated.View
2000
- style={[
2001
- styles.container,
2002
- animatedStyle,
2003
- {
2004
- height: screenHeight + (screenWidth * 1.07 + 44 - 140),
2005
- },
2006
- ]}>
2007
- <GestureHandlerRootView>
2008
- {(permissionStatus === 'authorized' ||
2009
- permissionStatus === 'limited') && (
2010
- <>
2011
- <GestureDetector gesture={selectedAssetGesture}>
2012
- <View>{renderSelectedAssetsHeader()}</View>
2013
- </GestureDetector>
2014
-
2015
- <GestureDetector gesture={renderHeaderGesture}>
2016
- <Animated.View>
2017
- {renderCustomHeader()}
2018
- {renderHeader()}
2019
- </Animated.View>
2020
- </GestureDetector>
2021
- </>
2067
+ {/* Loading overlay for album picker processing */}
2068
+ {loading && (
2069
+ <View style={styles.loadingOverlay}>
2070
+ <ActivityIndicator size="large" color="#fff" />
2071
+ </View>
2022
2072
  )}
2023
-
2024
- <GestureDetector gesture={assetGesture}>
2025
- {renderAssetsGrid()}
2026
- </GestureDetector>
2027
- </GestureHandlerRootView>
2028
- {renderManageModal()}
2029
-
2030
- {/* Loading overlay for album picker processing */}
2031
- {loading && (
2032
- <View style={styles.loadingOverlay}>
2033
- <ActivityIndicator size="large" color="#fff" />
2034
- </View>
2035
- )}
2036
- </Animated.View>
2037
- </View>
2038
- </FontProvider>
2039
-
2073
+ </Animated.View>
2074
+ </View>
2075
+ </FontProvider>
2040
2076
  );
2041
2077
  },
2042
2078
  );
@@ -2056,6 +2092,7 @@ const styles = StyleSheet.create({
2056
2092
  navControls: {
2057
2093
  flexDirection: 'row',
2058
2094
  justifyContent: 'center',
2095
+ gap: 16,
2059
2096
  alignItems: 'center',
2060
2097
  },
2061
2098
  simpleHeader: {
@@ -2595,6 +2632,7 @@ const styles = StyleSheet.create({
2595
2632
  aspectRatioContainer: {
2596
2633
  flexDirection: 'row',
2597
2634
  paddingHorizontal: 4,
2635
+ gap: 12,
2598
2636
  },
2599
2637
  aspectRatioButton: {
2600
2638
  paddingHorizontal: 12,