react-native-my-uploader-android 1.0.31 → 1.0.32

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/README.md CHANGED
@@ -1,73 +1,270 @@
1
- # react-native-my-uploader
1
+ # React Native My Uploader
2
2
 
3
- file uploader for android
3
+ Android için basit ve esnek bir dosya seçici. Bu paket, hem kullanıma hazır bir buton bileşeni hem de kendi arayüzünüzü oluşturmanız için bir `Promise` tabanlı fonksiyon sunar.
4
4
 
5
- ## Installation
5
+ ## Özellikler
6
6
 
7
+ - **Tekli ve Çoklu Dosya Seçimi:** `multipleFiles` prop'u ile kolayca geçiş yapın.
8
+ - **Dosya Tipi Filtreleme:** Sadece belirli MIME tiplerindeki (`image/*`, `application/pdf` vb.) dosyaların seçilmesine izin verin.
9
+ - **Limit Kontrolleri:** Seçilebilecek maksimum dosya sayısı (`maxFiles`) ve her bir dosya için maksimum boyut (`maxSize`) belirleyin.
10
+ - **Hariç Tutma:** Daha önce seçilmiş dosyaların tekrar seçilmesini engelleyin (`excludedUris`).
11
+ - **Base64 Çıktısı:** Seçilen dosyaların `base64` formatında verisini döndürür.
12
+ - **İki Farklı Kullanım:** Hızlı entegrasyon için `<MyUploader />` bileşeni veya tam kontrol için `pickFile()` fonksiyonu.
13
+
14
+ ## Kurulum
7
15
 
8
16
  ```sh
9
- npm install react-native-my-uploader-android
17
+ npm install react-native-my-uploader-android //"version": "1.0.32"
10
18
  ```
11
19
 
12
- ## Usage
20
+ veya
13
21
 
22
+ ```sh
23
+ yarn add react-native-my-uploader-android //"version": "1.0.32"
24
+ ```
14
25
 
15
- ```js
16
- import MyUploader,{FileInfo} from 'react-native-my-uploader-android';
26
+ ## Kullanım
17
27
 
28
+ Bu paketi kullanmanın iki ana yolu vardır:
18
29
 
19
- const [selectedFiles, setSelectedFiles] = useState<FileInfo[]>([]); // response= base64,fileName,fileSize,fileType,FileUri
30
+ ### Yöntem 1: Hazır Buton `<MyUploader />` (Önerilen ve Kolay Yol)
20
31
 
21
- //for "react-native-my-uploader-android": "^1.0.25" version
22
- <MyUploader
23
- multipleFiles={false}
24
- // maxFiles={3}
25
- maxSize={5} // 5MB
26
- fileTypes={["*/*"]}
27
- buttonPlaceHolder="Dosya Seç (En Fazla 3)"
28
- ButtonStyle={styles.customButton}
29
- ButtonTextStyle={styles.customButtonText}
30
- onSelect={(files) => {
31
- console.log('Dosyalar seçildi:', files);
32
- // Yeni seçilenleri mevcut listeye ekle
33
- setSelectedFiles(prevFiles => [...prevFiles, ...files]);
34
- }}
35
- onError={(error) => {
36
- Alert.alert(`Bir hata oluştu: ${error.message}`);
37
- }}
38
- />
32
+ Hızlıca bir "Dosya Seç" butonu eklemek için idealdir. Tüm mantık bileşenin kendi içindedir.
39
33
 
40
- <MyUploader
41
- multipleFiles={true}
42
- maxFiles={3}
43
- maxSize={5} // 5MB
44
- fileTypes={['application/pdf', 'image/jpeg']}
45
- buttonPlaceHolder="Dosya Seç (En Fazla 3)"
34
+ ```jsx
35
+ import React,{useState} from 'react';
36
+ import { Text,View, Alert, StyleSheet } from 'react-native';
37
+ import MyUploader, { FileInfo } from 'react-native-my-uploader-android';
38
+
39
+ export default function App() {
40
+
41
+ const [files,setFiles]=useState<FileInfo[] |null>(null);
42
+
43
+ const handleFilesSelected = (files: FileInfo[]) => {
44
+ console.log('Seçilen Dosyalar:', files);
45
+ setFiles(prev => prev ? [...prev, ...files] : [...files]);
46
+ };
47
+
48
+ return (
49
+ <View style={styles.container}>
50
+ <MyUploader
51
+ onSelect={handleFilesSelected}
52
+ onError={(error)=>{ Alert.alert('Bir Hata Oluştu', error.message)}}
53
+ buttonPlaceHolder="En Fazla 3 Resim Seç (Max 2MB)"
46
54
  ButtonStyle={styles.customButton}
47
55
  ButtonTextStyle={styles.customButtonText}
48
- onSelect={(files) => {
49
- console.log('Dosyalar seçildi:', files);
50
- // Yeni seçilenleri mevcut listeye ekle
51
- setSelectedFiles(prevFiles => [...prevFiles, ...files]);
52
- }}
53
- onError={(error) => {
54
- Alert.alert(`Bir hata oluştu: ${error.message}`);
55
- }}
56
+ multipleFiles={true}
57
+ fileTypes={['image/*']}
58
+ maxSize={2}
59
+ maxFiles={3}
56
60
  />
57
61
 
62
+ {files ? (
63
+ <View style={styles.fileListContainer}>
64
+ <Text style={styles.fileListTitle}>Seçilen Dosyalar:</Text>
65
+
66
+ {files.map((file, index) => (
67
+ <Text key={index} style={styles.fileName}>
68
+ {file.fileName} ({file.fileSize} KB)
69
+ </Text>
70
+ ))}
71
+ </View>
72
+ ) : (
73
+ <View style={styles.fileListContainer}>
74
+ <Text>Dosya Bulunmamaktadır</Text>
75
+ </View>
76
+ )}
77
+ </View>
78
+ );
79
+ }
80
+
81
+ const styles = StyleSheet.create({
82
+ container: {
83
+ flex: 1,
84
+ justifyContent: 'center',
85
+ alignItems: 'center',
86
+ padding: 20,
87
+ },
88
+ customButton: {
89
+ backgroundColor: '#00796B',
90
+ paddingVertical: 15,
91
+ paddingHorizontal: 30,
92
+ borderRadius: 30,
93
+ },
94
+ customButtonText: {
95
+ color: '#FFFFFF',
96
+ fontSize: 14,
97
+ },
98
+ fileListContainer: {
99
+ marginTop: 20,
100
+ padding: 15,
101
+ backgroundColor: '#f0f0f0',
102
+ borderRadius: 8,
103
+ width: '100%',
104
+ },
105
+ fileListTitle: {
106
+ fontSize: 16,
107
+ fontWeight: 'bold',
108
+ marginBottom: 10,
109
+ },
110
+ fileName: {
111
+ fontSize: 14,
112
+ color: '#333',
113
+ marginBottom: 5,
114
+ },
115
+ });
116
+
117
+ ```
118
+
119
+ ### Yöntem 2: Fonksiyon `pickFile()` (Tam Kontrol İçin)
120
+
121
+ Kendi özel butonunuzu veya dokunma alanınızı tasarlamak istediğinizde bu yöntemi kullanın. `async/await` ile çalışır ve size tam kontrol sağlar.
122
+
123
+ ```jsx
124
+ import React,{useState} from 'react';
125
+ import { Text,View, Alert, StyleSheet ,TouchableOpacity} from 'react-native';
126
+ import { pickFile ,FileInfo} from 'react-native-my-uploader-android';
127
+
128
+ export default function App() {
129
+ const [pickFiles,setPickFiles]=useState<FileInfo[] |null>(null)
130
+
131
+ const handlePress = async () => {
132
+ try {
133
+ // Dosya seçiciyi aç ve sonucu bekle
134
+ const files = await pickFile({
135
+ multipleFiles: true,
136
+ fileTypes: ['application/pdf', 'application/vnd.ms-excel'], // Sadece PDF ve Excel
137
+ maxFiles: 5,
138
+ maxSize: 10, // 10MB
139
+ });
140
+ setPickFiles(prev => prev ? [...prev, ...files] : [...files]);
141
+ console.log(files);
142
+
143
+ } catch (error: any) {
144
+ Alert.alert('Hata', error.message);
145
+ }
146
+ };
147
+
148
+ return (
149
+ <View style={styles.container}>
150
+ <TouchableOpacity style={styles.fancyButton} onPress={handlePress}>
151
+ <Text style={styles.fancyButtonText}>PDF veya Excel Yükle</Text>
152
+ </TouchableOpacity>
153
+ {pickFiles ?(
154
+ <View style={styles.fileListContainer}>
155
+ <Text style={styles.fileListTitle}>Seçilen Dosyalar:</Text>
156
+ {pickFiles.map((file, index) => (
157
+ <View key={index}>
158
+ <Text style={styles.fileName}>{file.fileName} ({file.fileSize} KB)</Text>
159
+ </View>
160
+ ))}
161
+ </View>
162
+ ):(
163
+ <View>
164
+ <Text>Dosya bulunmamaktadır.</Text>
165
+ </View>
166
+ )};
167
+ </View>
168
+ )
169
+ }
170
+
171
+ const styles = StyleSheet.create({
172
+ container: {
173
+ flex: 1,
174
+ justifyContent: 'center',
175
+ alignItems: 'center',
176
+ padding: 20,
177
+ },
178
+ customButton: {
179
+ backgroundColor: '#00796B',
180
+ paddingVertical: 15,
181
+ paddingHorizontal: 30,
182
+ borderRadius: 30,
183
+ },
184
+ customButtonText: {
185
+ color: '#FFFFFF',
186
+ fontSize: 14,
187
+ },
188
+ fileListContainer: {
189
+ marginTop: 20,
190
+ padding: 15,
191
+ backgroundColor: '#f0f0f0',
192
+ borderRadius: 8,
193
+ width: '100%',
194
+ },
195
+ fileListTitle: {
196
+ fontSize: 16,
197
+ fontWeight: 'bold',
198
+ marginBottom: 10,
199
+ },
200
+ fileName: {
201
+ fontSize: 14,
202
+ color: '#333',
203
+ marginBottom: 15,
204
+ borderBottomWidth:1,
205
+ paddingBottom:10
206
+ },
207
+ fancyButton: {
208
+ borderWidth: 2,
209
+ borderColor: '#6200EE',
210
+ padding: 15,
211
+ borderRadius: 10,
212
+ },
213
+ fancyButtonText: {
214
+ color: '#6200EE',
215
+ fontWeight: 'bold',
216
+ fontSize: 16,
217
+ },
218
+ });
219
+
58
220
  ```
59
221
 
222
+ ## Prop'lar
223
+
224
+ ### `<MyUploader />` & `pickFile()` Ortak Prop'ları (`DocumentPickerOptions`)
225
+
226
+ | Prop | Tip | Varsayılan | Açıklama |
227
+ |----------------|-------------|------------|-------------------------------------------------------------------------|
228
+ | `multipleFiles`| `boolean` | `false` | `true` ise birden fazla dosya seçimine izin verir. |
229
+ | `maxFiles` | `number` | `3` | `multipleFiles` `true` iken seçilebilecek maksimum dosya sayısı. `0` ise limitsiz. |
230
+ | `maxSize` | `number` | `0` | Her bir dosya için MB cinsinden maksimum boyut. `0` ise limitsiz. |
231
+ | `fileTypes` | `string[]` | `['*/*']` | Seçilebilecek dosya tipleri (MIME). Örn: `['image/jpeg', 'image/png']`. |
232
+ | `excludedUris` | `string[]` | `[]` | Seçim sonuçlarından hariç tutulacak dosyaların `fileUri` listesi. |
233
+
234
+
235
+ ### `<MyUploader />` Özel Prop'ları
236
+
237
+ | Prop | Tip | Varsayılan | Açıklama |
238
+ |---------------------|-----------------------|-------------|----------------------------------------|
239
+ | `onSelect` | `(files: FileInfo[]) => void` | **Zorunlu** | Dosyalar başarıyla seçildiğinde tetiklenir. |
240
+ | `onError` | `(error: Error) => void` | `undefined` | Bir hata oluştuğunda tetiklenir. |
241
+ | `buttonPlaceHolder` | `string` | `"Dosya Seç"`| Buton üzerinde görünecek metin. |
242
+ | `ButtonStyle` | `ViewStyle` | `undefined` | Butonun `TouchableOpacity` stili. |
243
+ | `ButtonTextStyle` | `TextStyle` | `undefined` | Buton metninin `Text` stili. |
244
+ | `disabled` | `boolean` | `false` | `true` ise buton devre dışı kalır. |
245
+
246
+ ## Dönen Değer (`FileInfo` objesi)
247
+
248
+ Her iki yöntem de `FileInfo` objelerinden oluşan bir dizi döndürür:
249
+
250
+ ```typescript
251
+ interface FileInfo {
252
+ fileName: string; // Dosyanın adı
253
+ fileSize: number; // Dosyanın boyutu (byte cinsinden)
254
+ fileType: string; // Dosyanın MIME tipi
255
+ fileUri: string; // Dosyanın cihazdaki URI'si (Content URI)
256
+ base64: string | null; // Dosyanın Base64 kodlanmış verisi
257
+ }
258
+ ```
60
259
 
61
- ## Contributing
260
+ ## Katkıda Bulunma (Contributing)
62
261
 
63
- - [Development workflow](CONTRIBUTING.md#development-workflow)
64
- - [Sending a pull request](CONTRIBUTING.md#sending-a-pull-request)
65
- - [Code of conduct](CODE_OF_CONDUCT.md)
262
+ Katkılarınız için her zaman açığız! Lütfen [CONTRIBUTING.md](CONTRIBUTING.md) dosyasını inceleyin.
66
263
 
67
- ## License
264
+ ## Lisans
68
265
 
69
266
  MIT
70
267
 
71
268
  ---
72
269
 
73
- Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
270
+ Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
@@ -28,7 +28,6 @@ class MyUploaderModule(private val reactContext: ReactApplicationContext) :
28
28
  companion object {
29
29
  private const val REQUEST_CODE = 9900
30
30
  private const val E_ACTIVITY_DOES_NOT_EXIST = "E_ACTIVITY_DOES_NOT_EXIST"
31
- private const val E_PICKER_CANCELLED = "E_PICKER_CANCELLED"
32
31
  private const val E_FAILED_TO_OPEN_DOCUMENT = "E_FAILED_TO_OPEN_DOCUMENT"
33
32
  private const val E_FILE_TOO_LARGE = "E_FILE_TOO_LARGE"
34
33
  private const val E_MAX_FILES_EXCEEDED = "E_MAX_FILES_EXCEEDED"
@@ -137,7 +136,7 @@ class MyUploaderModule(private val reactContext: ReactApplicationContext) :
137
136
  }
138
137
  }.start()
139
138
  } else {
140
- currentPromise?.reject(E_PICKER_CANCELLED, "Dosya seçimi iptal edildi.")
139
+
141
140
  }
142
141
  }
143
142
 
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["// import type { StyleProp, TextStyle, ViewStyle } from 'react-native';\r\n\r\n// export interface FileInfo {\r\n// fileName: string;\r\n// fileSize: number; \r\n// fileType: string | null;\r\n// fileUri: string;\r\n// base64: string;\r\n// }\r\n\r\n// export interface MyUploaderProps{\r\n// onSelect: (files: FileInfo[]) => void;\r\n// onError?: (error: Error) => void;\r\n// buttonPlaceHolder?: string;\r\n// ButtonStyle?: StyleProp<ViewStyle>;\r\n// ButtonTextStyle?: StyleProp<TextStyle>;\r\n// disabled?: boolean; \r\n// multipleFiles?: boolean;\r\n// fileTypes?: string[];\r\n// maxSize?: number;\r\n// maxFiles?: number;\r\n// excludedUris?: string[];\r\n// }\r\n\r\n// export interface DownloadedFileInfo {\r\n// originalUrl: string;\r\n// localUri: string;\r\n// }\r\n\r\n// export interface SkippedFileInfo {\r\n// originalUrl: string;\r\n// reason: string; \r\n// }\r\n\r\n\r\n\r\n// export interface UploadFileProps {\r\n// files: string[];\r\n// multipleLoad?: boolean;\r\n// disabled?: boolean;\r\n// debug?: boolean; \r\n// maxSize?: number;\r\n// fileTypes?: string[];\r\n// buttonPlaceHolder?: string;\r\n// buttonIcon?: React.ReactNode;\r\n// ButtonStyle?: StyleProp<ViewStyle>;\r\n// ButtonTextStyle?: StyleProp<TextStyle>;\r\n// onSuccess?: (result: DownloadResult) => void;\r\n// onError?: (error: Error) => void;\r\n// }\r\n\r\n// export interface DownloadFileProps {\r\n// files: string[];\r\n// multipleDownload?: boolean;\r\n// disabled?: boolean;\r\n// debug?: boolean;\r\n// maxSize?: number; // MB\r\n// fileTypes?: string[];\r\n// buttonPlaceHolder?: string;\r\n// buttonIcon?: React.ReactNode;\r\n// ButtonStyle?: ViewStyle;\r\n// ButtonTextStyle?: TextStyle;\r\n// onSuccess?: (result: DownloadResult) => void;\r\n// onError?: (error: any) => void;\r\n// }\r\n// export interface DownloadResult {\r\n// successful: { originalUrl: string; localUri: string | null }[];\r\n// skipped: { originalUrl: string; reason: string }[];\r\n// }\r\n\r\n\r\nimport type { ViewStyle, TextStyle } from 'react-native';\r\n\r\nexport interface FileInfo {\r\n uri: string;\r\n name: string;\r\n type: string;\r\n size: number;\r\n base64?: string | null;\r\n}\r\n\r\n\r\n// ----- MyUploader & pickFile Props -----\r\nexport interface DocumentPickerOptions {\r\n multipleFiles?: boolean;\r\n fileTypes?: string[]; // örn: ['image/*', 'application/pdf']\r\n maxSize?: number; // MB cinsinden\r\n maxFiles?: number;\r\n excludedUris?: string[];\r\n}\r\n\r\nexport interface MyUploaderProps extends DocumentPickerOptions {\r\n onSelect: (files: FileInfo[]) => void;\r\n onError?: (error: Error) => void;\r\n buttonPlaceHolder?: string;\r\n ButtonStyle?: ViewStyle;\r\n ButtonTextStyle?: TextStyle;\r\n disabled?: boolean;\r\n}\r\n\r\n// ----- DownloadFile Props -----\r\nexport interface DownloadFileProps {\r\n files: string[];\r\n multipleDownload?: boolean; // multipleFiles yerine multipleDownload (İsim karışmaması için)\r\n disabled?: boolean;\r\n debug?: boolean;\r\n maxSize?: number; // MB\r\n fileTypes?: string[]; // İndirilecek dosyanın Content-Type kontrolü\r\n buttonPlaceHolder?: string;\r\n buttonIcon?: React.ReactNode;\r\n ButtonStyle?: ViewStyle;\r\n ButtonTextStyle?: TextStyle;\r\n onSuccess?: (result: DownloadResult) => void;\r\n onError?: (error: any) => void;\r\n}\r\n\r\n\r\nexport interface DownloadResult {\r\n successful: { originalUrl: string; localUri: string | null }[];\r\n skipped: { originalUrl: string; reason: string }[];\r\n}"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["// import type { StyleProp, TextStyle, ViewStyle } from 'react-native';\r\n\r\n// export interface FileInfo {\r\n// fileName: string;\r\n// fileSize: number; \r\n// fileType: string | null;\r\n// fileUri: string;\r\n// base64: string;\r\n// }\r\n\r\n// export interface MyUploaderProps{\r\n// onSelect: (files: FileInfo[]) => void;\r\n// onError?: (error: Error) => void;\r\n// buttonPlaceHolder?: string;\r\n// ButtonStyle?: StyleProp<ViewStyle>;\r\n// ButtonTextStyle?: StyleProp<TextStyle>;\r\n// disabled?: boolean; \r\n// multipleFiles?: boolean;\r\n// fileTypes?: string[];\r\n// maxSize?: number;\r\n// maxFiles?: number;\r\n// excludedUris?: string[];\r\n// }\r\n\r\n// export interface DownloadedFileInfo {\r\n// originalUrl: string;\r\n// localUri: string;\r\n// }\r\n\r\n// export interface SkippedFileInfo {\r\n// originalUrl: string;\r\n// reason: string; \r\n// }\r\n\r\n\r\n\r\n// export interface UploadFileProps {\r\n// files: string[];\r\n// multipleLoad?: boolean;\r\n// disabled?: boolean;\r\n// debug?: boolean; \r\n// maxSize?: number;\r\n// fileTypes?: string[];\r\n// buttonPlaceHolder?: string;\r\n// buttonIcon?: React.ReactNode;\r\n// ButtonStyle?: StyleProp<ViewStyle>;\r\n// ButtonTextStyle?: StyleProp<TextStyle>;\r\n// onSuccess?: (result: DownloadResult) => void;\r\n// onError?: (error: Error) => void;\r\n// }\r\n\r\n// export interface DownloadFileProps {\r\n// files: string[];\r\n// multipleDownload?: boolean;\r\n// disabled?: boolean;\r\n// debug?: boolean;\r\n// maxSize?: number; // MB\r\n// fileTypes?: string[];\r\n// buttonPlaceHolder?: string;\r\n// buttonIcon?: React.ReactNode;\r\n// ButtonStyle?: ViewStyle;\r\n// ButtonTextStyle?: TextStyle;\r\n// onSuccess?: (result: DownloadResult) => void;\r\n// onError?: (error: any) => void;\r\n// }\r\n// export interface DownloadResult {\r\n// successful: { originalUrl: string; localUri: string | null }[];\r\n// skipped: { originalUrl: string; reason: string }[];\r\n// }\r\n\r\n\r\nimport type { ViewStyle, TextStyle } from 'react-native';\r\n\r\nexport interface FileInfo {\r\n fileUri: string;\r\n fileName: string;\r\n fileType: string;\r\n fileSize: number;\r\n base64?: string | null;\r\n}\r\n\r\n\r\n// ----- MyUploader & pickFile Props -----\r\nexport interface DocumentPickerOptions {\r\n multipleFiles?: boolean;\r\n fileTypes?: string[]; // örn: ['image/*', 'application/pdf']\r\n maxSize?: number; // MB cinsinden\r\n maxFiles?: number;\r\n excludedUris?: string[];\r\n}\r\n\r\nexport interface MyUploaderProps extends DocumentPickerOptions {\r\n onSelect: (files: FileInfo[]) => void;\r\n onError?: (error: Error) => void;\r\n buttonPlaceHolder?: string;\r\n ButtonStyle?: ViewStyle;\r\n ButtonTextStyle?: TextStyle;\r\n disabled?: boolean;\r\n}\r\n\r\n// ----- DownloadFile Props -----\r\nexport interface DownloadFileProps {\r\n files: string[];\r\n multipleDownload?: boolean; // multipleFiles yerine multipleDownload (İsim karışmaması için)\r\n disabled?: boolean;\r\n debug?: boolean;\r\n maxSize?: number; // MB\r\n fileTypes?: string[]; // İndirilecek dosyanın Content-Type kontrolü\r\n buttonPlaceHolder?: string;\r\n buttonIcon?: React.ReactNode;\r\n ButtonStyle?: ViewStyle;\r\n ButtonTextStyle?: TextStyle;\r\n onSuccess?: (result: DownloadResult) => void;\r\n onError?: (error: any) => void;\r\n}\r\n\r\n\r\nexport interface DownloadResult {\r\n successful: { originalUrl: string; localUri: string | null }[];\r\n skipped: { originalUrl: string; reason: string }[];\r\n}"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["// import type { StyleProp, TextStyle, ViewStyle } from 'react-native';\r\n\r\n// export interface FileInfo {\r\n// fileName: string;\r\n// fileSize: number; \r\n// fileType: string | null;\r\n// fileUri: string;\r\n// base64: string;\r\n// }\r\n\r\n// export interface MyUploaderProps{\r\n// onSelect: (files: FileInfo[]) => void;\r\n// onError?: (error: Error) => void;\r\n// buttonPlaceHolder?: string;\r\n// ButtonStyle?: StyleProp<ViewStyle>;\r\n// ButtonTextStyle?: StyleProp<TextStyle>;\r\n// disabled?: boolean; \r\n// multipleFiles?: boolean;\r\n// fileTypes?: string[];\r\n// maxSize?: number;\r\n// maxFiles?: number;\r\n// excludedUris?: string[];\r\n// }\r\n\r\n// export interface DownloadedFileInfo {\r\n// originalUrl: string;\r\n// localUri: string;\r\n// }\r\n\r\n// export interface SkippedFileInfo {\r\n// originalUrl: string;\r\n// reason: string; \r\n// }\r\n\r\n\r\n\r\n// export interface UploadFileProps {\r\n// files: string[];\r\n// multipleLoad?: boolean;\r\n// disabled?: boolean;\r\n// debug?: boolean; \r\n// maxSize?: number;\r\n// fileTypes?: string[];\r\n// buttonPlaceHolder?: string;\r\n// buttonIcon?: React.ReactNode;\r\n// ButtonStyle?: StyleProp<ViewStyle>;\r\n// ButtonTextStyle?: StyleProp<TextStyle>;\r\n// onSuccess?: (result: DownloadResult) => void;\r\n// onError?: (error: Error) => void;\r\n// }\r\n\r\n// export interface DownloadFileProps {\r\n// files: string[];\r\n// multipleDownload?: boolean;\r\n// disabled?: boolean;\r\n// debug?: boolean;\r\n// maxSize?: number; // MB\r\n// fileTypes?: string[];\r\n// buttonPlaceHolder?: string;\r\n// buttonIcon?: React.ReactNode;\r\n// ButtonStyle?: ViewStyle;\r\n// ButtonTextStyle?: TextStyle;\r\n// onSuccess?: (result: DownloadResult) => void;\r\n// onError?: (error: any) => void;\r\n// }\r\n// export interface DownloadResult {\r\n// successful: { originalUrl: string; localUri: string | null }[];\r\n// skipped: { originalUrl: string; reason: string }[];\r\n// }\r\n\r\n\r\nimport type { ViewStyle, TextStyle } from 'react-native';\r\n\r\nexport interface FileInfo {\r\n uri: string;\r\n name: string;\r\n type: string;\r\n size: number;\r\n base64?: string | null;\r\n}\r\n\r\n\r\n// ----- MyUploader & pickFile Props -----\r\nexport interface DocumentPickerOptions {\r\n multipleFiles?: boolean;\r\n fileTypes?: string[]; // örn: ['image/*', 'application/pdf']\r\n maxSize?: number; // MB cinsinden\r\n maxFiles?: number;\r\n excludedUris?: string[];\r\n}\r\n\r\nexport interface MyUploaderProps extends DocumentPickerOptions {\r\n onSelect: (files: FileInfo[]) => void;\r\n onError?: (error: Error) => void;\r\n buttonPlaceHolder?: string;\r\n ButtonStyle?: ViewStyle;\r\n ButtonTextStyle?: TextStyle;\r\n disabled?: boolean;\r\n}\r\n\r\n// ----- DownloadFile Props -----\r\nexport interface DownloadFileProps {\r\n files: string[];\r\n multipleDownload?: boolean; // multipleFiles yerine multipleDownload (İsim karışmaması için)\r\n disabled?: boolean;\r\n debug?: boolean;\r\n maxSize?: number; // MB\r\n fileTypes?: string[]; // İndirilecek dosyanın Content-Type kontrolü\r\n buttonPlaceHolder?: string;\r\n buttonIcon?: React.ReactNode;\r\n ButtonStyle?: ViewStyle;\r\n ButtonTextStyle?: TextStyle;\r\n onSuccess?: (result: DownloadResult) => void;\r\n onError?: (error: any) => void;\r\n}\r\n\r\n\r\nexport interface DownloadResult {\r\n successful: { originalUrl: string; localUri: string | null }[];\r\n skipped: { originalUrl: string; reason: string }[];\r\n}"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["// import type { StyleProp, TextStyle, ViewStyle } from 'react-native';\r\n\r\n// export interface FileInfo {\r\n// fileName: string;\r\n// fileSize: number; \r\n// fileType: string | null;\r\n// fileUri: string;\r\n// base64: string;\r\n// }\r\n\r\n// export interface MyUploaderProps{\r\n// onSelect: (files: FileInfo[]) => void;\r\n// onError?: (error: Error) => void;\r\n// buttonPlaceHolder?: string;\r\n// ButtonStyle?: StyleProp<ViewStyle>;\r\n// ButtonTextStyle?: StyleProp<TextStyle>;\r\n// disabled?: boolean; \r\n// multipleFiles?: boolean;\r\n// fileTypes?: string[];\r\n// maxSize?: number;\r\n// maxFiles?: number;\r\n// excludedUris?: string[];\r\n// }\r\n\r\n// export interface DownloadedFileInfo {\r\n// originalUrl: string;\r\n// localUri: string;\r\n// }\r\n\r\n// export interface SkippedFileInfo {\r\n// originalUrl: string;\r\n// reason: string; \r\n// }\r\n\r\n\r\n\r\n// export interface UploadFileProps {\r\n// files: string[];\r\n// multipleLoad?: boolean;\r\n// disabled?: boolean;\r\n// debug?: boolean; \r\n// maxSize?: number;\r\n// fileTypes?: string[];\r\n// buttonPlaceHolder?: string;\r\n// buttonIcon?: React.ReactNode;\r\n// ButtonStyle?: StyleProp<ViewStyle>;\r\n// ButtonTextStyle?: StyleProp<TextStyle>;\r\n// onSuccess?: (result: DownloadResult) => void;\r\n// onError?: (error: Error) => void;\r\n// }\r\n\r\n// export interface DownloadFileProps {\r\n// files: string[];\r\n// multipleDownload?: boolean;\r\n// disabled?: boolean;\r\n// debug?: boolean;\r\n// maxSize?: number; // MB\r\n// fileTypes?: string[];\r\n// buttonPlaceHolder?: string;\r\n// buttonIcon?: React.ReactNode;\r\n// ButtonStyle?: ViewStyle;\r\n// ButtonTextStyle?: TextStyle;\r\n// onSuccess?: (result: DownloadResult) => void;\r\n// onError?: (error: any) => void;\r\n// }\r\n// export interface DownloadResult {\r\n// successful: { originalUrl: string; localUri: string | null }[];\r\n// skipped: { originalUrl: string; reason: string }[];\r\n// }\r\n\r\n\r\nimport type { ViewStyle, TextStyle } from 'react-native';\r\n\r\nexport interface FileInfo {\r\n fileUri: string;\r\n fileName: string;\r\n fileType: string;\r\n fileSize: number;\r\n base64?: string | null;\r\n}\r\n\r\n\r\n// ----- MyUploader & pickFile Props -----\r\nexport interface DocumentPickerOptions {\r\n multipleFiles?: boolean;\r\n fileTypes?: string[]; // örn: ['image/*', 'application/pdf']\r\n maxSize?: number; // MB cinsinden\r\n maxFiles?: number;\r\n excludedUris?: string[];\r\n}\r\n\r\nexport interface MyUploaderProps extends DocumentPickerOptions {\r\n onSelect: (files: FileInfo[]) => void;\r\n onError?: (error: Error) => void;\r\n buttonPlaceHolder?: string;\r\n ButtonStyle?: ViewStyle;\r\n ButtonTextStyle?: TextStyle;\r\n disabled?: boolean;\r\n}\r\n\r\n// ----- DownloadFile Props -----\r\nexport interface DownloadFileProps {\r\n files: string[];\r\n multipleDownload?: boolean; // multipleFiles yerine multipleDownload (İsim karışmaması için)\r\n disabled?: boolean;\r\n debug?: boolean;\r\n maxSize?: number; // MB\r\n fileTypes?: string[]; // İndirilecek dosyanın Content-Type kontrolü\r\n buttonPlaceHolder?: string;\r\n buttonIcon?: React.ReactNode;\r\n ButtonStyle?: ViewStyle;\r\n ButtonTextStyle?: TextStyle;\r\n onSuccess?: (result: DownloadResult) => void;\r\n onError?: (error: any) => void;\r\n}\r\n\r\n\r\nexport interface DownloadResult {\r\n successful: { originalUrl: string; localUri: string | null }[];\r\n skipped: { originalUrl: string; reason: string }[];\r\n}"],"mappings":"","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-my-uploader-android",
3
- "version": "1.0.31",
3
+ "version": "1.0.32",
4
4
  "description": "file uploader for android",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./src/index.d.ts",
package/src/types.ts CHANGED
@@ -72,10 +72,10 @@
72
72
  import type { ViewStyle, TextStyle } from 'react-native';
73
73
 
74
74
  export interface FileInfo {
75
- uri: string;
76
- name: string;
77
- type: string;
78
- size: number;
75
+ fileUri: string;
76
+ fileName: string;
77
+ fileType: string;
78
+ fileSize: number;
79
79
  base64?: string | null;
80
80
  }
81
81