motorinc-gallery-picker-pro 1.0.2 → 1.0.4
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 +2 -2
- package/src/components/MainPhotoGallery.tsx +115 -102
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "motorinc-gallery-picker-pro",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
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": "^
|
|
38
|
+
"motorinc-global-components": "^3.9.5",
|
|
39
39
|
"react-native-worklets": "^0.4.1"
|
|
40
40
|
},
|
|
41
41
|
"repository": {
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
SPACING_24,
|
|
47
47
|
SPACING_4,
|
|
48
48
|
} from 'motorinc-global-components';
|
|
49
|
-
import {
|
|
49
|
+
import {ThemeContext, FontProvider, useTheme} from 'motorinc-global-components';
|
|
50
50
|
const {width: screenWidth, height: screenHeight} = Dimensions.get('window');
|
|
51
51
|
|
|
52
52
|
export interface CropParams {
|
|
@@ -83,7 +83,7 @@ interface props {
|
|
|
83
83
|
onCancel?: () => void; // Callback for cancel button
|
|
84
84
|
onNext?: (selectedAssets: PhotoAsset[]) => void; // Callback for next button
|
|
85
85
|
maxSelectionLimit?: number;
|
|
86
|
-
statusBarvalue?: number
|
|
86
|
+
statusBarvalue?: number;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
const MainPhotoGallery = React.forwardRef<MainPhotoGalleryRef, props>(
|
|
@@ -105,7 +105,7 @@ const MainPhotoGallery = React.forwardRef<MainPhotoGalleryRef, props>(
|
|
|
105
105
|
onCancel,
|
|
106
106
|
onNext,
|
|
107
107
|
maxSelectionLimit = 10,
|
|
108
|
-
statusBarvalue
|
|
108
|
+
statusBarvalue,
|
|
109
109
|
},
|
|
110
110
|
ref,
|
|
111
111
|
) => {
|
|
@@ -329,7 +329,11 @@ const MainPhotoGallery = React.forwardRef<MainPhotoGalleryRef, props>(
|
|
|
329
329
|
};
|
|
330
330
|
|
|
331
331
|
return (
|
|
332
|
-
<View
|
|
332
|
+
<View
|
|
333
|
+
style={[
|
|
334
|
+
styles.selectedAssetWrapper,
|
|
335
|
+
{height: 1.07 * screenWidth, width: screenWidth},
|
|
336
|
+
]}>
|
|
333
337
|
<ImageCropper
|
|
334
338
|
ref={getCropperRef(item.id)}
|
|
335
339
|
key={`${item.id}-${aspectRatio}`}
|
|
@@ -950,9 +954,9 @@ const MainPhotoGallery = React.forwardRef<MainPhotoGalleryRef, props>(
|
|
|
950
954
|
const handleSingleAssetSelection = (asset: PhotoAsset) => {
|
|
951
955
|
// For single selection mode - keep the selection persistent
|
|
952
956
|
console.log('Single asset selected:', asset);
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
957
|
+
translateY.value = withTiming(0, {
|
|
958
|
+
duration: 300,
|
|
959
|
+
});
|
|
956
960
|
|
|
957
961
|
// Set the selected asset and keep it selected
|
|
958
962
|
setSelectedAssetIds(new Set([asset.id]));
|
|
@@ -978,9 +982,9 @@ const MainPhotoGallery = React.forwardRef<MainPhotoGalleryRef, props>(
|
|
|
978
982
|
};
|
|
979
983
|
|
|
980
984
|
const handleMultiAssetSelection = (asset: PhotoAsset) => {
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
985
|
+
translateY.value = withTiming(0, {
|
|
986
|
+
duration: 300,
|
|
987
|
+
});
|
|
984
988
|
|
|
985
989
|
if (!isSelectionMode) {
|
|
986
990
|
// Start selection mode on long press
|
|
@@ -1121,10 +1125,9 @@ const MainPhotoGallery = React.forwardRef<MainPhotoGalleryRef, props>(
|
|
|
1121
1125
|
if (multiSelect) {
|
|
1122
1126
|
// Start multi-selection mode on long press
|
|
1123
1127
|
handleMultiAssetSelection(asset);
|
|
1124
|
-
|
|
1128
|
+
translateY.value = withTiming(0, {
|
|
1125
1129
|
duration: 300,
|
|
1126
1130
|
});
|
|
1127
|
-
|
|
1128
1131
|
}
|
|
1129
1132
|
};
|
|
1130
1133
|
|
|
@@ -1178,7 +1181,6 @@ const MainPhotoGallery = React.forwardRef<MainPhotoGalleryRef, props>(
|
|
|
1178
1181
|
if (selectedAssetIds.size === 0) return;
|
|
1179
1182
|
|
|
1180
1183
|
try {
|
|
1181
|
-
|
|
1182
1184
|
// Capture cropped images first
|
|
1183
1185
|
await captureAllCroppedImages();
|
|
1184
1186
|
const selectedAssets = assets.filter(asset =>
|
|
@@ -1514,8 +1516,18 @@ const MainPhotoGallery = React.forwardRef<MainPhotoGalleryRef, props>(
|
|
|
1514
1516
|
onPress={() => {
|
|
1515
1517
|
displayPreviousIndex();
|
|
1516
1518
|
}}>
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
+
<PlayyText
|
|
1520
|
+
BodyEmphasized
|
|
1521
|
+
color={
|
|
1522
|
+
!selectedAssets ||
|
|
1523
|
+
selectedAssets.length === 0 ||
|
|
1524
|
+
currentSelectedIndex === 0
|
|
1525
|
+
? 'rgba(235, 238, 245, 0.60)'
|
|
1526
|
+
: '#fff'
|
|
1527
|
+
}>
|
|
1528
|
+
{String.fromCharCode(60558)}
|
|
1529
|
+
</PlayyText>
|
|
1530
|
+
{/* <IconComponent
|
|
1519
1531
|
name={icons.leftArrow}
|
|
1520
1532
|
color={
|
|
1521
1533
|
!selectedAssets ||
|
|
@@ -1524,8 +1536,7 @@ const MainPhotoGallery = React.forwardRef<MainPhotoGalleryRef, props>(
|
|
|
1524
1536
|
? 'rgba(235, 238, 245, 0.60)'
|
|
1525
1537
|
: '#fff'
|
|
1526
1538
|
}
|
|
1527
|
-
/>
|
|
1528
|
-
|
|
1539
|
+
/> */}
|
|
1529
1540
|
</TouchableOpacity>
|
|
1530
1541
|
|
|
1531
1542
|
{/* <Text
|
|
@@ -1546,20 +1557,27 @@ const MainPhotoGallery = React.forwardRef<MainPhotoGalleryRef, props>(
|
|
|
1546
1557
|
onPress={() => {
|
|
1547
1558
|
displayNextIndex();
|
|
1548
1559
|
}}>
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1560
|
+
{/* <IconComponent
|
|
1561
|
+
name={icons.rightArrow}
|
|
1562
|
+
color={
|
|
1563
|
+
!selectedAssets ||
|
|
1564
|
+
selectedAssets.length === 0 ||
|
|
1565
|
+
currentSelectedIndex >= selectedAssets.length - 1
|
|
1566
|
+
? 'rgba(235, 238, 245, 0.60)'
|
|
1567
|
+
: '#fff'
|
|
1568
|
+
}
|
|
1569
|
+
/> */}
|
|
1570
|
+
<PlayyText
|
|
1571
|
+
BodyEmphasized
|
|
1572
|
+
color={
|
|
1573
|
+
!selectedAssets ||
|
|
1574
|
+
selectedAssets.length === 0 ||
|
|
1575
|
+
currentSelectedIndex >= selectedAssets.length - 1
|
|
1576
|
+
? 'rgba(235, 238, 245, 0.60)'
|
|
1577
|
+
: '#fff'
|
|
1578
|
+
}>
|
|
1579
|
+
{String.fromCharCode(60558)}
|
|
1580
|
+
</PlayyText>
|
|
1563
1581
|
</TouchableOpacity>
|
|
1564
1582
|
</View>
|
|
1565
1583
|
</View>
|
|
@@ -1677,19 +1695,19 @@ const MainPhotoGallery = React.forwardRef<MainPhotoGalleryRef, props>(
|
|
|
1677
1695
|
|
|
1678
1696
|
return (
|
|
1679
1697
|
<NavigationHeader
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
)
|
|
1698
|
+
backIcon
|
|
1699
|
+
statusBarvalue={statusBarvalue!}
|
|
1700
|
+
handleBack={onCancel}
|
|
1701
|
+
buttonTitle="Next"
|
|
1702
|
+
buttontextColor="#fff"
|
|
1703
|
+
backIconColor="#fff"
|
|
1704
|
+
isButton
|
|
1705
|
+
label="Back"
|
|
1706
|
+
labelColor="#fff"
|
|
1707
|
+
// @ts-ignore
|
|
1708
|
+
handlePressButton={onNext}
|
|
1709
|
+
/>
|
|
1710
|
+
);
|
|
1693
1711
|
};
|
|
1694
1712
|
|
|
1695
1713
|
const renderSelectedImagesModal = () => (
|
|
@@ -1973,70 +1991,64 @@ const MainPhotoGallery = React.forwardRef<MainPhotoGalleryRef, props>(
|
|
|
1973
1991
|
});
|
|
1974
1992
|
|
|
1975
1993
|
return (
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
bold: "Playy-Bold",
|
|
1982
|
-
|
|
1983
|
-
SemiCondensedExtraBold: Platform.OS === "android"
|
|
1984
|
-
|
|
1985
|
-
? "OpenSans_SemiCondensed-ExtraBold"
|
|
1986
|
-
|
|
1987
|
-
: "OpenSansSemiCondensed-ExtraBold"
|
|
1994
|
+
<FontProvider
|
|
1995
|
+
fonts={{
|
|
1996
|
+
regular: 'Playy-Regular',
|
|
1997
|
+
medium: 'Playy-Medium',
|
|
1988
1998
|
|
|
1989
|
-
|
|
1999
|
+
bold: 'Playy-Bold',
|
|
1990
2000
|
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
2001
|
+
SemiCondensedExtraBold:
|
|
2002
|
+
Platform.OS === 'android'
|
|
2003
|
+
? 'OpenSans_SemiCondensed-ExtraBold'
|
|
2004
|
+
: 'OpenSansSemiCondensed-ExtraBold',
|
|
1995
2005
|
}}>
|
|
2006
|
+
<View
|
|
2007
|
+
style={{
|
|
2008
|
+
backgroundColor: '#000',
|
|
2009
|
+
}}>
|
|
2010
|
+
{renderCancelNextButtons()}
|
|
2011
|
+
|
|
2012
|
+
<Animated.View
|
|
2013
|
+
style={[
|
|
2014
|
+
styles.container,
|
|
2015
|
+
animatedStyle,
|
|
2016
|
+
{
|
|
2017
|
+
height: screenHeight + (screenWidth * 1.07 + 44 - 140),
|
|
2018
|
+
},
|
|
2019
|
+
]}>
|
|
2020
|
+
<GestureHandlerRootView>
|
|
2021
|
+
{(permissionStatus === 'authorized' ||
|
|
2022
|
+
permissionStatus === 'limited') && (
|
|
2023
|
+
<>
|
|
2024
|
+
<GestureDetector gesture={selectedAssetGesture}>
|
|
2025
|
+
<View>{renderSelectedAssetsHeader()}</View>
|
|
2026
|
+
</GestureDetector>
|
|
2027
|
+
|
|
2028
|
+
<GestureDetector gesture={renderHeaderGesture}>
|
|
2029
|
+
<Animated.View>
|
|
2030
|
+
{renderCustomHeader()}
|
|
2031
|
+
{renderHeader()}
|
|
2032
|
+
</Animated.View>
|
|
2033
|
+
</GestureDetector>
|
|
2034
|
+
</>
|
|
2035
|
+
)}
|
|
1996
2036
|
|
|
1997
|
-
|
|
2037
|
+
<GestureDetector gesture={assetGesture}>
|
|
2038
|
+
{renderAssetsGrid()}
|
|
2039
|
+
</GestureDetector>
|
|
2040
|
+
</GestureHandlerRootView>
|
|
2041
|
+
{renderManageModal()}
|
|
1998
2042
|
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
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
|
-
</>
|
|
2043
|
+
{/* Loading overlay for album picker processing */}
|
|
2044
|
+
{loading && (
|
|
2045
|
+
<View style={styles.loadingOverlay}>
|
|
2046
|
+
<ActivityIndicator size="large" color="#fff" />
|
|
2047
|
+
</View>
|
|
2022
2048
|
)}
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
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
|
-
|
|
2049
|
+
</Animated.View>
|
|
2050
|
+
</View>
|
|
2051
|
+
</FontProvider>
|
|
2040
2052
|
);
|
|
2041
2053
|
},
|
|
2042
2054
|
);
|
|
@@ -2057,6 +2069,7 @@ const styles = StyleSheet.create({
|
|
|
2057
2069
|
flexDirection: 'row',
|
|
2058
2070
|
justifyContent: 'center',
|
|
2059
2071
|
alignItems: 'center',
|
|
2072
|
+
gap: 8,
|
|
2060
2073
|
},
|
|
2061
2074
|
simpleHeader: {
|
|
2062
2075
|
flexDirection: 'row',
|