Skip to content

Commit 1b9c160

Browse files
committed
doing fix example
1 parent 7f7c592 commit 1b9c160

File tree

11 files changed

+99
-116
lines changed

11 files changed

+99
-116
lines changed

android/build.gradle

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ buildscript {
88
}
99

1010
dependencies {
11-
classpath 'com.android.tools.build:gradle:4.1.1'
11+
classpath 'com.android.tools.build:gradle:7.1.1'
1212
// noinspection DifferentKotlinGradleVersion
1313
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1414
}
@@ -31,8 +31,6 @@ android {
3131
defaultConfig {
3232
minSdkVersion getExtOrIntegerDefault('minSdkVersion')
3333
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
34-
versionCode 1
35-
versionName "1.0"
3634

3735
}
3836

@@ -126,7 +124,8 @@ dependencies {
126124
// noinspection GradleDynamicVersion
127125
api 'com.facebook.react:react-native:+'
128126
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
129-
implementation 'io.github.lucksiege:pictureselector:v2.7.3-rc08'
127+
implementation 'io.github.lucksiege:pictureselector:v3.10.7'
128+
implementation 'io.github.lucksiege:compress:v3.10.7'
130129
implementation 'com.github.bumptech.glide:glide:4.12.0'
131130
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
132131
}
Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.reactnativemultipleimagepicker">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.reactnativemultipleimagepicker">
2+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
33
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
4+
<uses-permission android:name="android.permission.WRITE_MEDIA_STORAGE" />
5+
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
6+
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
7+
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
8+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
9+
<uses-permission android:name="android.permission.RECORD_AUDIO" />
10+
<uses-permission android:name="android.permission.CAMERA" />
11+
<uses-permission android:name="android.permission.VIBRATE" />
12+
<uses-permission android:name="android.permission.BLUETOOTH" />
13+
14+
<!-- Android 13 -->
15+
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
16+
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
17+
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
18+
419
<application android:requestLegacyExternalStorage="true" />
520
</manifest>

example/android/app/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,12 @@ dependencies {
188188
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
189189
exclude group:'com.facebook.fbjni'
190190
}
191+
191192
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
192193
exclude group:'com.facebook.flipper'
193194
exclude group:'com.squareup.okhttp3', module:'okhttp'
194195
}
196+
195197
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
196198
exclude group:'com.facebook.flipper'
197199
}

example/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip

example/ios/MultipleImagePickerExample.xcodeproj/project.pbxproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,6 @@
364364
"${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle",
365365
"${PODS_ROOT}/TLPhotoPicker/TLPhotoPicker/TLPhotoPickerController.bundle",
366366
"${PODS_CONFIGURATION_BUILD_DIR}/TLPhotoPicker/TLPhotoPicker.bundle",
367-
"${PODS_ROOT}/../../../ios/MultipleImagePicker.bundle",
368367
"${PODS_CONFIGURATION_BUILD_DIR}/react-native-multiple-image-picker/MultipleImagePicker.bundle",
369368
);
370369
name = "[CP] Copy Pods Resources";

example/ios/MultipleImagePickerExample/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<key>CFBundleDevelopmentRegion</key>
1010
<string>en</string>
1111
<key>CFBundleDisplayName</key>
12-
<string>Multiple Image Picker</string>
12+
<string>Picker</string>
1313
<key>CFBundleExecutable</key>
1414
<string>$(EXECUTABLE_NAME)</string>
1515
<key>CFBundleIdentifier</key>

example/ios/Podfile.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,9 @@ PODS:
185185
- React-cxxreact (= 0.63.4)
186186
- React-jsi (= 0.63.4)
187187
- React-jsinspector (0.63.4)
188-
- react-native-multiple-image-picker (0.4.6):
188+
- react-native-multiple-image-picker (0.4.13):
189189
- React-Core
190-
- TLPhotoPicker (= 2.1.4)
190+
- TLPhotoPicker (= 2.1.9)
191191
- React-RCTActionSheet (0.63.4):
192192
- React-Core/RCTActionSheetHeaders (= 0.63.4)
193193
- React-RCTAnimation (0.63.4):
@@ -248,7 +248,7 @@ PODS:
248248
- React-Core (= 0.63.4)
249249
- React-cxxreact (= 0.63.4)
250250
- React-jsi (= 0.63.4)
251-
- TLPhotoPicker (2.1.4)
251+
- TLPhotoPicker (2.1.9)
252252
- Yoga (1.14.0)
253253

254254
DEPENDENCIES:
@@ -360,7 +360,7 @@ SPEC CHECKSUMS:
360360
React-jsi: a0418934cf48f25b485631deb27c64dc40fb4c31
361361
React-jsiexecutor: 93bd528844ad21dc07aab1c67cb10abae6df6949
362362
React-jsinspector: 58aef7155bc9a9683f5b60b35eccea8722a4f53a
363-
react-native-multiple-image-picker: 516d520a1672ff8177c2cd8a113553cbbe2939e9
363+
react-native-multiple-image-picker: 64b10e7f5f8431fbc726893d301d879cf2da4965
364364
React-RCTActionSheet: 89a0ca9f4a06c1f93c26067af074ccdce0f40336
365365
React-RCTAnimation: 1bde3ecc0c104c55df246eda516e0deb03c4e49b
366366
React-RCTBlob: a97d378b527740cc667e03ebfa183a75231ab0f0
@@ -371,9 +371,9 @@ SPEC CHECKSUMS:
371371
React-RCTText: 5c51df3f08cb9dedc6e790161195d12bac06101c
372372
React-RCTVibration: ae4f914cfe8de7d4de95ae1ea6cc8f6315d73d9d
373373
ReactCommon: 73d79c7039f473b76db6ff7c6b159c478acbbb3b
374-
TLPhotoPicker: f486e8499e1c3f464d0e886697635e25a72a52b8
374+
TLPhotoPicker: 939c40eaad130b69f9571e61e021e8120fa76329
375375
Yoga: 4bd86afe9883422a7c4028c00e34790f560923d6
376376

377377
PODFILE CHECKSUM: 739a34f1722633656d85522351accd0e9e63cc35
378378

379-
COCOAPODS: 1.10.2
379+
COCOAPODS: 1.11.3

example/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"start": "react-native start"
1010
},
1111
"dependencies": {
12+
"@baronha/react-native-image-grid": "^0.2.7",
1213
"react": "16.13.1",
1314
"react-native": "0.63.4"
1415
},

example/src/App.js

Lines changed: 62 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,132 +1,94 @@
11
/* eslint-disable react-native/no-inline-styles */
22
import React, { useState } from 'react';
3-
import { Dimensions, Image, SafeAreaView, FlatList } from 'react-native';
4-
import { StyleSheet, View, Text, TouchableOpacity } from 'react-native';
5-
import MultipleImagePicker from '@baronha/react-native-multiple-image-picker';
3+
import { Text } from 'react-native';
4+
import { TouchableOpacity } from 'react-native';
5+
import { ScrollView } from 'react-native';
6+
import { View } from 'react-native';
7+
import { Dimensions } from 'react-native';
8+
import { StatusBar } from 'react-native';
9+
import { SafeAreaView } from 'react-native';
10+
11+
import { StyleSheet } from 'react-native';
12+
import ImageGrid from '@baronha/react-native-image-grid';
13+
import ImagePicker from '@baronha/react-native-multiple-image-picker';
14+
15+
const { width } = Dimensions.get('window');
616

717
export default function App() {
818
const [images, setImages] = useState([]);
19+
const onPressImage = (item, index) => {
20+
console.log(item, index);
21+
};
922

1023
const openPicker = async () => {
1124
try {
12-
const response = await MultipleImagePicker.openPicker({
25+
const response = await ImagePicker.openPicker({
1326
selectedAssets: images,
1427
isExportThumbnail: true,
1528
maxVideo: 1,
16-
usedCameraButton: false,
17-
isCrop: true,
18-
isCropCircle: true,
1929
});
20-
console.log('response: ', response);
30+
console.log(response);
2131
setImages(response);
22-
} catch (e) {
23-
console.log(e.code, e.message);
24-
}
25-
};
26-
27-
const onDelete = (value) => {
28-
const data = images.filter(
29-
(item) =>
30-
item?.localIdentifier &&
31-
item?.localIdentifier !== value?.localIdentifier
32-
);
33-
setImages(data);
34-
};
35-
36-
const renderItem = ({ item, index }) => {
37-
return (
38-
<View>
39-
<Image
40-
width={IMAGE_WIDTH}
41-
source={{
42-
uri:
43-
item?.type === 'video'
44-
? item?.thumbnail ?? ''
45-
: 'file://' + (item?.crop?.cropPath ?? item.path),
46-
}}
47-
style={style.media}
48-
/>
49-
<TouchableOpacity
50-
onPress={() => onDelete(item)}
51-
activeOpacity={0.9}
52-
style={style.buttonDelete}
53-
>
54-
<Text style={style.titleDelete}>Xoá</Text>
55-
</TouchableOpacity>
56-
</View>
57-
);
32+
} catch (e) {}
5833
};
5934

6035
return (
61-
<SafeAreaView style={style.container}>
62-
<FlatList
63-
style={[
64-
style.container,
65-
{
66-
paddingTop: 6,
67-
},
68-
]}
69-
data={images}
70-
keyExtractor={(item, index) => (item?.filename ?? item?.path) + index}
71-
renderItem={renderItem}
72-
numColumns={3}
73-
/>
74-
<View style={style.bottom}>
75-
<TouchableOpacity style={style.openPicker} onPress={openPicker}>
76-
<Text style={style.openText}>open</Text>
77-
</TouchableOpacity>
36+
<View style={style.container}>
37+
<ScrollView contentContainerStyle={{ paddingTop: 132 }}>
38+
<View style={{ alignItems: 'center' }}>
39+
<ImageGrid
40+
dataImage={images}
41+
onPressImage={onPressImage}
42+
// spaceSize={10}
43+
containerStyle={{ marginTop: 3 }}
44+
width={Dimensions.get('window').width - 6}
45+
sourceKey={'path'}
46+
videoKey={'type'}
47+
conditionCheckVideo={'video'}
48+
videoURLKey={'thumbnail'}
49+
/>
50+
<TouchableOpacity style={style.buttonOpen} onPress={openPicker}>
51+
<Text style={style.textOpen}>Open Gallery</Text>
52+
</TouchableOpacity>
53+
</View>
54+
</ScrollView>
55+
<View style={style.header}>
56+
<StatusBar barStyle={'light-content'} backgroundColor={'#000'} />
57+
<SafeAreaView />
58+
<Text style={style.title}>PICKER</Text>
7859
</View>
79-
</SafeAreaView>
60+
</View>
8061
);
8162
}
8263

83-
const { width } = Dimensions.get('window');
84-
85-
const IMAGE_WIDTH = (width - 24) / 3;
86-
8764
const style = StyleSheet.create({
8865
container: {
66+
backgroundColor: '#000',
8967
flex: 1,
9068
},
91-
imageView: {
92-
flex: 1,
93-
flexDirection: 'row',
94-
flexWrap: 'wrap',
69+
title: {
70+
fontWeight: '900',
71+
fontSize: 24,
9572
paddingVertical: 24,
73+
fontFamily: 'Avenir',
74+
color: '#cdac81',
75+
textAlign: 'center',
9676
},
97-
media: {
98-
marginLeft: 6,
99-
width: IMAGE_WIDTH,
100-
height: IMAGE_WIDTH,
101-
marginBottom: 6,
102-
backgroundColor: 'rgba(0,0,0,0.2)',
103-
},
104-
bottom: {
105-
padding: 24,
77+
buttonOpen: {
78+
margin: 24,
79+
backgroundColor: '#fff',
80+
padding: 12,
81+
alignItems: 'center',
82+
width: width - 48,
10683
},
107-
openText: {
84+
textOpen: {
10885
fontWeight: 'bold',
109-
fontSize: 16,
110-
color: '#fff',
111-
paddingVertical: 12,
11286
},
113-
openPicker: {
114-
justifyContent: 'center',
115-
alignItems: 'center',
116-
backgroundColor: '#000',
117-
},
118-
buttonDelete: {
119-
paddingHorizontal: 8,
120-
paddingVertical: 4,
87+
header: {
12188
position: 'absolute',
122-
top: 6,
123-
right: 6,
124-
backgroundColor: '#ffffff92',
125-
borderRadius: 4,
126-
},
127-
titleDelete: {
128-
fontWeight: 'bold',
129-
fontSize: 12,
130-
color: '#000',
89+
top: 0,
90+
left: 0,
91+
right: 0,
92+
backgroundColor: 'rgba(0,0,0,0.9)',
13193
},
13294
});

example/yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,11 @@
600600
lodash "^4.17.19"
601601
to-fast-properties "^2.0.0"
602602

603+
"@baronha/react-native-image-grid@^0.2.7":
604+
version "0.2.7"
605+
resolved "https://registry.yarnpkg.com/@baronha/react-native-image-grid/-/react-native-image-grid-0.2.7.tgz#a69df4d90605cf673a9f676bc4c0b7e95a38f0e7"
606+
integrity sha512-F5q+hJ1p0+hfWYhOK4uL2EgseG89hpiMu0rMIaiw7lMpEA3sKC1AUOhOTKS58LeX1xE/XoqZ0P7tzyntKN+EoQ==
607+
603608
"@cnakazawa/watch@^1.0.3":
604609
version "1.0.4"
605610
resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.4.tgz"

0 commit comments

Comments
 (0)