react-native-my-uploader-android 1.0.27 → 1.0.29

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.
Files changed (38) hide show
  1. package/android/src/main/java/com/myuploaderandroid/DownloadFileModule.kt +91 -58
  2. package/android/src/main/java/com/myuploaderandroid/MyUploaderModule.kt +71 -87
  3. package/android/src/main/java/com/myuploaderandroid/MyUploaderPackage.kt +1 -1
  4. package/lib/commonjs/NativeModules.js +16 -0
  5. package/lib/commonjs/NativeModules.js.map +1 -0
  6. package/lib/commonjs/components/DownloadFile.js +37 -49
  7. package/lib/commonjs/components/DownloadFile.js.map +1 -1
  8. package/lib/commonjs/components/MyUploader.js +54 -80
  9. package/lib/commonjs/components/MyUploader.js.map +1 -1
  10. package/lib/commonjs/index.d.js.map +1 -1
  11. package/lib/commonjs/index.js +4 -4
  12. package/lib/commonjs/index.js.map +1 -1
  13. package/lib/commonjs/types.js.map +1 -1
  14. package/lib/module/NativeModules.js +10 -0
  15. package/lib/module/NativeModules.js.map +1 -0
  16. package/lib/module/components/DownloadFile.js +38 -50
  17. package/lib/module/components/DownloadFile.js.map +1 -1
  18. package/lib/module/components/MyUploader.js +52 -79
  19. package/lib/module/components/MyUploader.js.map +1 -1
  20. package/lib/module/index.d.js +6 -0
  21. package/lib/module/index.d.js.map +1 -1
  22. package/lib/module/index.js +7 -6
  23. package/lib/module/index.js.map +1 -1
  24. package/lib/module/types.js.map +1 -1
  25. package/package.json +1 -1
  26. package/src/NativeModules.ts +9 -0
  27. package/src/components/DownloadFile.tsx +38 -62
  28. package/src/components/MyUploader.tsx +59 -90
  29. package/src/index.d.ts +13 -4
  30. package/src/index.ts +11 -6
  31. package/src/types.ts +96 -41
  32. package/android/src/main/java/com/myuploader/MyUploaderModule.kt +0 -173
  33. package/android/src/main/java/com/myuploader/MyUploaderPackage.kt +0 -16
  34. package/lib/commonjs/NativeMyUploader.js +0 -15
  35. package/lib/commonjs/NativeMyUploader.js.map +0 -1
  36. package/lib/module/NativeMyUploader.js +0 -9
  37. package/lib/module/NativeMyUploader.js.map +0 -1
  38. package/src/NativeMyUploader.ts +0 -25
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","DownloadFile","DownloadFileModule","NativeModules","files","multipleLoad","disabled","debug","maxSize","fileTypes","buttonPlaceHolder","buttonIcon","ButtonStyle","ButtonTextStyle","onSuccess","onError","error","console","isLoading","setIsLoading","useState","handlePress","Error","downloadOptions","filesToProcess","slice","downloadPromises","map","url","downloadFile","settledResults","Promise","allSettled","finalResult","successful","skipped","forEach","result","index","originalUrl","status","push","localUri","value","reason","message","content","createElement","ActivityIndicator","color","Text","style","styles","buttonText","TouchableOpacity","button","disabledButton","onPress","StyleSheet","create","backgroundColor","paddingHorizontal","paddingVertical","borderRadius","alignItems","justifyContent","flexDirection","fontSize","fontWeight","_default","exports"],"sources":["DownloadFile.tsx"],"sourcesContent":["import React, { useState } from 'react';\r\nimport { NativeModules, TouchableOpacity, Text, StyleSheet, ActivityIndicator } from 'react-native';\r\nimport type { DownloadFileProps, DownloadResult } from '../types';\r\n\r\nconst { DownloadFile: DownloadFileModule } = NativeModules;\r\n\r\nconst DownloadFile: React.FC<DownloadFileProps> = ({\r\n files,\r\n multipleLoad = false,\r\n disabled = false,\r\n debug = false,\r\n maxSize = 0,\r\n fileTypes = ['*/*'],\r\n buttonPlaceHolder = 'Dosyaları İndir',\r\n buttonIcon,\r\n ButtonStyle,\r\n ButtonTextStyle,\r\n onSuccess = () => {},\r\n onError = (error) => console.error('DownloadFile Error:', error),\r\n}) => {\r\n const [isLoading, setIsLoading] = useState(false);\r\n\r\n const handlePress = async () => {\r\n if (!DownloadFileModule) {\r\n onError(new Error(\"DownloadFile native module is not available.\"));\r\n return;\r\n }\r\n\r\n setIsLoading(true);\r\n const downloadOptions = { maxSize, fileTypes, debug };\r\n\r\n try {\r\n const filesToProcess = multipleLoad ? files : files.slice(0, 1);\r\n const downloadPromises = filesToProcess.map(url => \r\n DownloadFileModule.downloadFile(url, downloadOptions)\r\n );\r\n\r\n const settledResults = await Promise.allSettled(downloadPromises);\r\n\r\n const finalResult: DownloadResult = { successful: [], skipped: [] };\r\n\r\n settledResults.forEach((result, index) => {\r\n // DÜZELTME: `filesToProcess[index]` ifadesinin sonuna `!` ekleyerek\r\n // TypeScript'e bu değerin asla undefined olmayacağını bildiriyoruz.\r\n const originalUrl = filesToProcess[index]!;\r\n\r\n if (result.status === 'fulfilled') {\r\n finalResult.successful.push({\r\n originalUrl, // Artık hata vermeyecek\r\n localUri: result.value,\r\n });\r\n } else {\r\n finalResult.skipped.push({\r\n originalUrl, // Artık hata vermeyecek\r\n reason: result.reason.message,\r\n });\r\n }\r\n });\r\n \r\n onSuccess(finalResult);\r\n\r\n } catch (error: any) {\r\n onError(error);\r\n } finally {\r\n setIsLoading(false);\r\n }\r\n };\r\n\r\n const content = isLoading ? (\r\n <ActivityIndicator color=\"#FFFFFF\" />\r\n ) : (\r\n buttonIcon || <Text style={[styles.buttonText, ButtonTextStyle]}>{buttonPlaceHolder}</Text>\r\n );\r\n\r\n return (\r\n <TouchableOpacity\r\n style={[styles.button, ButtonStyle, (disabled || isLoading) && styles.disabledButton]}\r\n onPress={handlePress}\r\n disabled={disabled || isLoading}\r\n >\r\n {content}\r\n </TouchableOpacity>\r\n );\r\n};\r\n\r\nconst styles = StyleSheet.create({\r\n button: {\r\n backgroundColor: '#008CBA',\r\n paddingHorizontal: 20,\r\n paddingVertical: 10,\r\n borderRadius: 8,\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n flexDirection: 'row',\r\n },\r\n buttonText: {\r\n color: '#FFFFFF',\r\n fontSize: 16,\r\n fontWeight: 'bold',\r\n },\r\n disabledButton: {\r\n backgroundColor: '#A9A9A9',\r\n },\r\n});\r\n\r\nexport default DownloadFile;"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xBC,aAAa,EAAE;EACjB,CAAC;EACDb,UAAU,EAAE;IACVJ,KAAK,EAAE,SAAS;IAChBkB,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE;EACd,CAAC;EACDZ,cAAc,EAAE;IACdI,eAAe,EAAE;EACnB;AACJ,CAAC,CAAC;AAAC,IAAAS,QAAA,GAAAC,OAAA,CAAA9E,OAAA,GAEYS,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_NativeModules","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","DownloadFile","files","multipleDownload","disabled","debug","maxSize","fileTypes","buttonPlaceHolder","buttonIcon","ButtonStyle","ButtonTextStyle","onSuccess","onError","isLoading","setIsLoading","useState","handlePress","length","options","targetFiles","promises","map","url","NativeDownload","downloadFile","results","Promise","allSettled","final","successful","skipped","forEach","res","index","_targetFiles$index","originalUrl","status","push","localUri","value","_res$reason","reason","message","console","error","createElement","TouchableOpacity","style","styles","button","onPress","ActivityIndicator","color","Text","text","StyleSheet","create","backgroundColor","padding","borderRadius","alignItems","fontWeight","_default","exports"],"sources":["DownloadFile.tsx"],"sourcesContent":["import React, { useState } from 'react';\r\nimport { TouchableOpacity, Text, StyleSheet, ActivityIndicator } from 'react-native';\r\nimport { NativeDownload } from '../NativeModules';\r\nimport type { DownloadFileProps, DownloadResult } from '../types';\r\n\r\nconst DownloadFile: React.FC<DownloadFileProps> = ({\r\n files,\r\n multipleDownload = false,\r\n disabled = false,\r\n debug = false,\r\n maxSize = 0,\r\n fileTypes = ['*/*'],\r\n buttonPlaceHolder = 'Dosyaları İndir',\r\n buttonIcon,\r\n ButtonStyle,\r\n ButtonTextStyle,\r\n onSuccess,\r\n onError,\r\n}) => {\r\n const [isLoading, setIsLoading] = useState(false);\r\n\r\n const handlePress = async () => {\r\n if (disabled || isLoading || !files.length) return;\r\n setIsLoading(true);\r\n\r\n const options = { debug, maxSize, fileTypes };\r\n const targetFiles = multipleDownload ? files : [files[0]];\r\n\r\n try {\r\n const promises = targetFiles.map(url => NativeDownload.downloadFile(url, options));\r\n const results = await Promise.allSettled(promises);\r\n \r\n const final: DownloadResult = { successful: [], skipped: [] };\r\n\r\n results.forEach((res, index) => {\r\n const originalUrl = targetFiles[index] ?? \"\";\r\n if (res.status === 'fulfilled') {\r\n final.successful.push({ originalUrl, localUri: res.value });\r\n } else {\r\n final.skipped.push({ \r\n originalUrl, \r\n reason: res.reason?.message || \"Bilinmeyen Hata\" \r\n });\r\n }\r\n });\r\n\r\n if (onSuccess) onSuccess(final);\r\n } catch (e) {\r\n if (onError) onError(e);\r\n else console.error(e);\r\n } finally {\r\n setIsLoading(false);\r\n }\r\n };\r\n\r\n return (\r\n <TouchableOpacity\r\n style={[styles.button, ButtonStyle, (disabled || isLoading) && styles.disabled]}\r\n onPress={handlePress}\r\n disabled={disabled || isLoading}\r\n >\r\n {isLoading ? (\r\n <ActivityIndicator color=\"#FFF\" />\r\n ) : (\r\n buttonIcon ? buttonIcon : <Text style={[styles.text, ButtonTextStyle]}>{buttonPlaceHolder}</Text>\r\n )}\r\n </TouchableOpacity>\r\n );\r\n};\r\n\r\nconst styles = StyleSheet.create({\r\n button: {\r\n backgroundColor: '#03DAC6',\r\n padding: 12,\r\n borderRadius: 8,\r\n alignItems: 'center',\r\n },\r\n text: { color: '#000', fontWeight: 'bold' },\r\n disabled: { backgroundColor: '#AAA' }\r\n});\r\n\r\nexport default DownloadFile;"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAAkD,SAAAD,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA,YAAAA,CAAAI,CAAA,EAAAC,CAAA,SAAAA,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,EAAEA,OAAO,CAAC/B,CAAC,CAAC,CAAC,KACnB8D,OAAO,CAACC,KAAK,CAAC/D,CAAC,CAAC;IACvB,CAAC,SAAS;MACRiC,YAAY,CAAC,KAAK,CAAC;IACrB;EACF,CAAC;EAED,oBACEtC,MAAA,CAAAe,OAAA,CAAAsD,aAAA,CAAClE,YAAA,CAAAmE,gBAAgB;IACfC,KAAK,EAAE,CAACC,MAAM,CAACC,MAAM,EAAExC,WAAW,EAAE,CAACN,QAAQ,IAAIU,SAAS,KAAKmC,MAAM,CAAC7C,QAAQ,CAAE;IAChF+C,OAAO,EAAElC,WAAY;IACrBb,QAAQ,EAAEA,QAAQ,IAAIU;EAAU,GAE/BA,SAAS,gBACRrC,MAAA,CAAAe,OAAA,CAAAsD,aAAA,CAAClE,YAAA,CAAAwE,iBAAiB;IAACC,KAAK,EAAC;EAAM,CAAE,CAAC,GAElC5C,UAAU,GAAGA,UAAU,gBAAGhC,MAAA,CAAAe,OAAA,CAAAsD,aAAA,CAAClE,YAAA,CAAA0E,IAAI;IAACN,KAAK,EAAE,CAACC,MAAM,CAACM,IAAI,EAAE5C,eAAe;EAAE,GAAEH,iBAAwB,CAElF,CAAC;AAEvB,CAAC;AAED,MAAMyC,MAAM,GAAGO,uBAAU,CAACC,MAAM,CAAC;EAC/BP,MAAM,EAAE;IACNQ,eAAe,EAAE,SAAS;IAC1BC,OAAO,EAAE,EAAE;IACXC,YAAY,EAAE,CAAC;IACfC,UAAU,EAAE;EACd,CAAC;EACDN,IAAI,EAAE;IAAEF,KAAK,EAAE,MAAM;IAAES,UAAU,EAAE;EAAO,CAAC;EAC3C1D,QAAQ,EAAE;IAAEsD,eAAe,EAAE;EAAO;AACtC,CAAC,CAAC;AAAC,IAAAK,QAAA,GAAAC,OAAA,CAAAxE,OAAA,GAEYS,YAAY","ignoreList":[]}
@@ -3,117 +3,91 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
7
- exports.pickFile = pickFile;
8
- var _react = _interopRequireDefault(require("react"));
6
+ exports.pickFile = exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
9
8
  var _reactNative = require("react-native");
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
- const LINKING_ERROR = `The package 'react-native-my-uploader' doesn't seem to be linked.`;
12
- const DocumentPicker = _reactNative.NativeModules.DocumentPicker ? _reactNative.NativeModules.DocumentPicker : new Proxy({}, {
13
- get() {
14
- throw new Error(LINKING_ERROR);
15
- }
16
- });
9
+ var _NativeModules = require("../NativeModules");
10
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
11
+ // 1. Standalone pickFile Fonksiyonu
12
+ const pickFile = async (options = {}) => {
13
+ var _options$multipleFile, _options$maxFiles, _options$maxSize, _options$fileTypes, _options$excludedUris;
14
+ if (!_NativeModules.NativePicker) throw new Error("DocumentPicker module is not linked.");
17
15
 
18
- // Mevcut pickFile fonksiyonunu dahili (internal) olarak kullanmak üzere saklayalım.
19
- // İsterseniz bunu dışa aktarmaya devam edebilirsiniz.
20
- async function pickFile(options = {}) {
21
- var _options$excludedUris, _options$fileTypes, _options$maxSize;
22
- const {
23
- multipleFiles = false,
24
- maxFiles = 0,
25
- ...rest
26
- } = options;
27
- if (!multipleFiles && maxFiles > 1) {
28
- throw new Error('`maxFiles` cannot be greater than 1 when `multipleFiles` is false.');
29
- }
30
- let effectiveMaxFiles = maxFiles;
31
- if (multipleFiles && maxFiles === 0) {
32
- effectiveMaxFiles = 3;
33
- }
34
- const finalOptions = {
35
- ...rest,
36
- multipleFiles,
37
- maxFiles: effectiveMaxFiles,
38
- excludedUris: (_options$excludedUris = options.excludedUris) !== null && _options$excludedUris !== void 0 ? _options$excludedUris : [],
16
+ // Native tarafa gönderilecek options
17
+ const nativeOptions = {
18
+ multipleFiles: (_options$multipleFile = options.multipleFiles) !== null && _options$multipleFile !== void 0 ? _options$multipleFile : false,
19
+ maxFiles: (_options$maxFiles = options.maxFiles) !== null && _options$maxFiles !== void 0 ? _options$maxFiles : 0,
20
+ maxSize: (_options$maxSize = options.maxSize) !== null && _options$maxSize !== void 0 ? _options$maxSize : 0,
39
21
  fileTypes: (_options$fileTypes = options.fileTypes) !== null && _options$fileTypes !== void 0 ? _options$fileTypes : ['*/*'],
40
- maxSize: (_options$maxSize = options.maxSize) !== null && _options$maxSize !== void 0 ? _options$maxSize : 0
22
+ excludedUris: (_options$excludedUris = options.excludedUris) !== null && _options$excludedUris !== void 0 ? _options$excludedUris : []
41
23
  };
42
- return DocumentPicker.openDocument(finalOptions);
43
- }
24
+ return await _NativeModules.NativePicker.openDocument(nativeOptions);
25
+ };
44
26
 
45
- // YENİ: MyUploader Component'i
46
- const MyUploaderAndroid = ({
47
- // DocumentPickerOptions
48
- multipleFiles = false,
49
- maxFiles = 0,
50
- fileTypes = ['*/*'],
51
- maxSize = 0,
52
- excludedUris = [],
53
- // UI Props with defaults
54
- buttonPlaceHolder = 'Dosya Seçin...',
27
+ // 2. MyUploader Bileşeni
28
+ exports.pickFile = pickFile;
29
+ const MyUploader = ({
30
+ onSelect,
31
+ onError,
32
+ buttonPlaceHolder = "Dosya Seç",
55
33
  ButtonStyle,
56
34
  ButtonTextStyle,
57
35
  disabled = false,
58
- // Callbacks
59
- onSelect,
60
- onError = error => console.error('MyUploader Error:', error)
36
+ multipleFiles = false,
37
+ fileTypes = ['*/*'],
38
+ maxSize = 0,
39
+ maxFiles = 0,
40
+ excludedUris = []
61
41
  }) => {
42
+ const [isLoading, setIsLoading] = (0, _react.useState)(false);
62
43
  const handlePress = async () => {
44
+ if (disabled || isLoading) return;
45
+ setIsLoading(true);
63
46
  try {
64
- const options = {
47
+ const files = await pickFile({
65
48
  multipleFiles,
66
- maxFiles,
67
49
  fileTypes,
68
50
  maxSize,
51
+ maxFiles,
69
52
  excludedUris
70
- };
71
- const selectedFiles = await pickFile(options);
72
-
73
- // Eğer kullanıcı seçim yapmadan kapatırsa bazı sistemler boş array dönebilir.
74
- // Sadece doluysa callback'i tetikleyelim.
75
- if (selectedFiles && selectedFiles.length > 0) {
76
- onSelect(selectedFiles);
77
- }
53
+ });
54
+ onSelect(files);
78
55
  } catch (error) {
79
- // Kullanıcının seçimi iptal etmesi bir "hata" sayılmamalı,
80
- // bu yüzden sadece konsola yazdırıp onError'ı tetiklemeyebiliriz.
81
- // Native kodunuz "E_PICKER_CANCELLED" koduyla reject ediyor.
82
- if (error.code !== 'E_PICKER_CANCELLED') {
56
+ if (onError) {
83
57
  onError(error);
58
+ } else {
59
+ console.error("MyUploader Error:", error);
84
60
  }
61
+ } finally {
62
+ setIsLoading(false);
85
63
  }
86
64
  };
87
65
  return /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
88
- style: [styles.button, ButtonStyle, disabled && styles.disabledButton],
66
+ style: [styles.button, ButtonStyle, (disabled || isLoading) && styles.disabled],
89
67
  onPress: handlePress,
90
- disabled: disabled
91
- }, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
92
- style: [styles.buttonText, ButtonTextStyle]
68
+ disabled: disabled || isLoading
69
+ }, isLoading ? /*#__PURE__*/_react.default.createElement(_reactNative.ActivityIndicator, {
70
+ color: "#FFF"
71
+ }) : /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
72
+ style: [styles.text, ButtonTextStyle]
93
73
  }, buttonPlaceHolder));
94
74
  };
95
-
96
- // Varsayılan stiller
97
75
  const styles = _reactNative.StyleSheet.create({
98
76
  button: {
99
- backgroundColor: '#007AFF',
100
- paddingHorizontal: 20,
101
- paddingVertical: 10,
77
+ backgroundColor: '#6200EE',
78
+ padding: 12,
102
79
  borderRadius: 8,
103
80
  alignItems: 'center',
104
81
  justifyContent: 'center'
105
82
  },
106
- buttonText: {
107
- color: '#FFFFFF',
108
- fontSize: 16,
109
- fontWeight: 'bold'
83
+ text: {
84
+ color: '#FFF',
85
+ fontWeight: '600',
86
+ fontSize: 16
110
87
  },
111
- disabledButton: {
112
- backgroundColor: '#A9A9A9'
88
+ disabled: {
89
+ backgroundColor: '#B0B0B0'
113
90
  }
114
91
  });
115
-
116
- // İhtiyaca göre pickFile'ı da export edebilirsiniz.
117
- // Component'i varsayılan olarak export ediyoruz.
118
- var _default = exports.default = MyUploaderAndroid;
92
+ var _default = exports.default = MyUploader;
119
93
  //# sourceMappingURL=MyUploader.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","e","__esModule","default","LINKING_ERROR","DocumentPicker","NativeModules","Proxy","get","Error","pickFile","options","_options$excludedUris","_options$fileTypes","_options$maxSize","multipleFiles","maxFiles","rest","effectiveMaxFiles","finalOptions","excludedUris","fileTypes","maxSize","openDocument","MyUploaderAndroid","buttonPlaceHolder","ButtonStyle","ButtonTextStyle","disabled","onSelect","onError","error","console","handlePress","selectedFiles","length","code","createElement","TouchableOpacity","style","styles","button","disabledButton","onPress","Text","buttonText","StyleSheet","create","backgroundColor","paddingHorizontal","paddingVertical","borderRadius","alignItems","justifyContent","color","fontSize","fontWeight","_default","exports"],"sources":["MyUploader.tsx"],"sourcesContent":["import React from 'react';\r\nimport {NativeModules,TouchableOpacity,Text,StyleSheet} from 'react-native';\r\nimport type {FileInfo,DocumentPickerOptions, MyUploaderProps} from '../types';\r\n\r\nconst LINKING_ERROR = `The package 'react-native-my-uploader' doesn't seem to be linked.`;\r\n\r\nconst DocumentPicker = NativeModules.DocumentPicker\r\n ? NativeModules.DocumentPicker\r\n : new Proxy(\r\n {},\r\n {\r\n get() {\r\n throw new Error(LINKING_ERROR);\r\n },\r\n }\r\n );\r\n\r\n// Mevcut pickFile fonksiyonunu dahili (internal) olarak kullanmak üzere saklayalım.\r\n// İsterseniz bunu dışa aktarmaya devam edebilirsiniz.\r\nasync function pickFile(\r\n options: DocumentPickerOptions = {}\r\n): Promise<FileInfo[]> {\r\n const { multipleFiles = false, maxFiles = 0, ...rest } = options;\r\n\r\n if (!multipleFiles && maxFiles > 1) {\r\n throw new Error(\r\n '`maxFiles` cannot be greater than 1 when `multipleFiles` is false.'\r\n );\r\n }\r\n let effectiveMaxFiles = maxFiles;\r\n if (multipleFiles && maxFiles === 0) {\r\n effectiveMaxFiles = 3;\r\n }\r\n const finalOptions: DocumentPickerOptions = {\r\n ...rest,\r\n multipleFiles,\r\n maxFiles: effectiveMaxFiles,\r\n excludedUris: options.excludedUris ?? [],\r\n fileTypes: options.fileTypes ?? ['*/*'],\r\n maxSize: options.maxSize ?? 0,\r\n };\r\n return DocumentPicker.openDocument(finalOptions);\r\n}\r\n\r\n// YENİ: MyUploader Component'i\r\nconst MyUploaderAndroid: React.FC<MyUploaderProps> = ({\r\n // DocumentPickerOptions\r\n multipleFiles = false,\r\n maxFiles = 0,\r\n fileTypes = ['*/*'],\r\n maxSize = 0,\r\n excludedUris = [],\r\n // UI Props with defaults\r\n buttonPlaceHolder = 'Dosya Seçin...',\r\n ButtonStyle,\r\n ButtonTextStyle,\r\n disabled = false,\r\n // Callbacks\r\n onSelect,\r\n onError = (error) => console.error('MyUploader Error:', error),\r\n}) => {\r\n const handlePress = async () => {\r\n try {\r\n const options: DocumentPickerOptions = {\r\n multipleFiles,\r\n maxFiles,\r\n fileTypes,\r\n maxSize,\r\n excludedUris,\r\n };\r\n const selectedFiles = await pickFile(options);\r\n \r\n // Eğer kullanıcı seçim yapmadan kapatırsa bazı sistemler boş array dönebilir.\r\n // Sadece doluysa callback'i tetikleyelim.\r\n if (selectedFiles && selectedFiles.length > 0) {\r\n onSelect(selectedFiles);\r\n }\r\n\r\n } catch (error: any) {\r\n // Kullanıcının seçimi iptal etmesi bir \"hata\" sayılmamalı,\r\n // bu yüzden sadece konsola yazdırıp onError'ı tetiklemeyebiliriz.\r\n // Native kodunuz \"E_PICKER_CANCELLED\" koduyla reject ediyor.\r\n if (error.code !== 'E_PICKER_CANCELLED') {\r\n onError(error);\r\n }\r\n }\r\n };\r\n\r\n return (\r\n <TouchableOpacity\r\n style={[styles.button, ButtonStyle, disabled && styles.disabledButton]}\r\n onPress={handlePress}\r\n disabled={disabled}\r\n >\r\n <Text style={[styles.buttonText, ButtonTextStyle]}>\r\n {buttonPlaceHolder}\r\n </Text>\r\n </TouchableOpacity>\r\n );\r\n};\r\n\r\n// Varsayılan stiller\r\nconst styles = StyleSheet.create({\r\n button: {\r\n backgroundColor: '#007AFF',\r\n paddingHorizontal: 20,\r\n paddingVertical: 10,\r\n borderRadius: 8,\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n },\r\n buttonText: {\r\n color: '#FFFFFF',\r\n fontSize: 16,\r\n fontWeight: 'bold',\r\n },\r\n disabledButton: {\r\n backgroundColor: '#A9A9A9',\r\n },\r\n});\r\n\r\n// İhtiyaca göre pickFile'ı da export edebilirsiniz.\r\nexport { pickFile };\r\nexport type { FileInfo, DocumentPickerOptions, MyUploaderProps } from \"../types\";\r\n\r\n// Component'i varsayılan olarak export ediyoruz.\r\nexport default MyUploaderAndroid;"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAA4E,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAG5E,MAAMG,aAAa,GAAG,mEAAmE;AAEzF,MAAMC,cAAc,GAAGC,0BAAa,CAACD,cAAc,GAC/CC,0BAAa,CAACD,cAAc,GAC5B,IAAIE,KAAK,CACP,CAAC,CAAC,EACF;EACEC,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;EAClB,CAAC;EACDR,UAAU,EAAE;IACVS,KAAK,EAAE,SAAS;IAChBC,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE;EACd,CAAC;EACDd,cAAc,EAAE;IACdM,eAAe,EAAE;EACnB;AACF,CAAC,CAAC;;AAEF;AAIA;AAAA,IAAAS,QAAA,GAAAC,OAAA,CAAAvD,OAAA,GACeqB,iBAAiB","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_NativeModules","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","pickFile","options","_options$multipleFile","_options$maxFiles","_options$maxSize","_options$fileTypes","_options$excludedUris","NativePicker","Error","nativeOptions","multipleFiles","maxFiles","maxSize","fileTypes","excludedUris","openDocument","exports","MyUploader","onSelect","onError","buttonPlaceHolder","ButtonStyle","ButtonTextStyle","disabled","isLoading","setIsLoading","useState","handlePress","files","error","console","createElement","TouchableOpacity","style","styles","button","onPress","ActivityIndicator","color","Text","text","StyleSheet","create","backgroundColor","padding","borderRadius","alignItems","justifyContent","fontWeight","fontSize","_default"],"sources":["MyUploader.tsx"],"sourcesContent":["import React, { useState } from 'react';\r\nimport { TouchableOpacity, Text, StyleSheet, ActivityIndicator } from 'react-native';\r\nimport { NativePicker } from '../NativeModules';\r\nimport type { MyUploaderProps, DocumentPickerOptions, FileInfo } from '../types';\r\n\r\n// 1. Standalone pickFile Fonksiyonu\r\nexport const pickFile = async (options: DocumentPickerOptions = {}): Promise<FileInfo[]> => {\r\n if (!NativePicker) throw new Error(\"DocumentPicker module is not linked.\");\r\n \r\n // Native tarafa gönderilecek options\r\n const nativeOptions = {\r\n multipleFiles: options.multipleFiles ?? false,\r\n maxFiles: options.maxFiles ?? 0,\r\n maxSize: options.maxSize ?? 0,\r\n fileTypes: options.fileTypes ?? ['*/*'],\r\n excludedUris: options.excludedUris ?? [],\r\n };\r\n\r\n return await NativePicker.openDocument(nativeOptions);\r\n};\r\n\r\n// 2. MyUploader Bileşeni\r\nconst MyUploader: React.FC<MyUploaderProps> = ({\r\n onSelect,\r\n onError,\r\n buttonPlaceHolder = \"Dosya Seç\",\r\n ButtonStyle,\r\n ButtonTextStyle,\r\n disabled = false,\r\n multipleFiles = false,\r\n fileTypes = ['*/*'],\r\n maxSize = 0,\r\n maxFiles = 0,\r\n excludedUris = [],\r\n}) => {\r\n const [isLoading, setIsLoading] = useState(false);\r\n\r\n const handlePress = async () => {\r\n if (disabled || isLoading) return;\r\n setIsLoading(true);\r\n\r\n try {\r\n const files = await pickFile({\r\n multipleFiles,\r\n fileTypes,\r\n maxSize,\r\n maxFiles,\r\n excludedUris\r\n });\r\n \r\n onSelect(files);\r\n } catch (error: any) {\r\n if (onError) {\r\n onError(error);\r\n } else {\r\n console.error(\"MyUploader Error:\", error);\r\n }\r\n } finally {\r\n setIsLoading(false);\r\n }\r\n };\r\n\r\n return (\r\n <TouchableOpacity\r\n style={[styles.button, ButtonStyle, (disabled || isLoading) && styles.disabled]}\r\n onPress={handlePress}\r\n disabled={disabled || isLoading}\r\n >\r\n {isLoading ? (\r\n <ActivityIndicator color=\"#FFF\" />\r\n ) : (\r\n <Text style={[styles.text, ButtonTextStyle]}>{buttonPlaceHolder}</Text>\r\n )}\r\n </TouchableOpacity>\r\n );\r\n};\r\n\r\nconst styles = StyleSheet.create({\r\n button: {\r\n backgroundColor: '#6200EE',\r\n padding: 12,\r\n borderRadius: 8,\r\n alignItems: 'center',\r\n justifyContent: 'center'\r\n },\r\n text: {\r\n color: '#FFF',\r\n fontWeight: '600',\r\n fontSize: 16\r\n },\r\n disabled: {\r\n backgroundColor: '#B0B0B0'\r\n }\r\n});\r\n\r\nexport default MyUploader;"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAAgD,SAAAD,wBAAAI,CAA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 -1 +1 @@
1
- {"version":3,"names":["_types","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["index.d.ts"],"sourcesContent":["import * as React from 'react';\r\nimport type { DocumentPickerOptions, MyUploaderProps,FileInfo,DownloadFileProps } from './types';\r\n\r\nexport * from './types';\r\n\r\ndeclare const MyUploader: React.FC<MyUploaderProps>;\r\nexport default MyUploader;\r\n\r\nexport declare const DownloadFile: React.FC<DownloadFileProps>;\r\nexport function pickFile(options?: DocumentPickerOptions): Promise<FileInfo[]>;"],"mappings":";;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["_types","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["index.d.ts"],"sourcesContent":["import * as React from 'react';\r\nimport type { \r\n DocumentPickerOptions, \r\n MyUploaderProps, \r\n FileInfo,\r\n DownloadFileProps } from './types';\r\n\r\nexport * from './types';\r\n\r\nexport declare const MyUploader: React.FC<MyUploaderProps>;\r\n\r\n// DownloadFile Component Tanımı (3. Bunu ekledik)\r\nexport declare const DownloadFile: React.FC<DownloadFileProps>;\r\n\r\n// pickFile Fonksiyon Tanımı\r\nexport function pickFile(options?: DocumentPickerOptions): Promise<FileInfo[]>;\r\n\r\n// Varsayılan dışa aktarım (İsteğe bağlı, genellikle ana bileşen verilir)\r\nexport default MyUploader;"],"mappings":";;;;;AAOA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  var _exportNames = {
7
7
  pickFile: true,
8
- DownloadFileAndroid: true
8
+ DownloadFile: true
9
9
  };
10
- Object.defineProperty(exports, "DownloadFileAndroid", {
10
+ Object.defineProperty(exports, "DownloadFile", {
11
11
  enumerable: true,
12
12
  get: function () {
13
13
  return _DownloadFile.default;
@@ -36,6 +36,6 @@ Object.keys(_types).forEach(function (key) {
36
36
  });
37
37
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
38
38
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
39
- // Component'leri ve fonksiyonları dışa aktar
40
- var _default = exports.default = _MyUploader.default;
39
+ // 1. MyUploader'ı DEFAULT olarak dışa aktar (import MyUploader from ... için)
40
+ var _default = exports.default = _MyUploader.default; // 2. Diğerlerini NAMED olarak dışa aktar (import { DownloadFile, pickFile } ... için)
41
41
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_MyUploader","_interopRequireWildcard","require","_DownloadFile","_interopRequireDefault","_types","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","set","getOwnPropertyDescriptor","_default","MyUploaderAndroid"],"sources":["index.ts"],"sourcesContent":["import MyUploaderAndroid from \"./components/MyUploader\";\r\nimport DownloadFileAndroid from \"./components/DownloadFile\";\r\nimport { pickFile } from './components/MyUploader';\r\n\r\n// Component'leri ve fonksiyonları dışa aktar\r\nexport { DownloadFileAndroid, pickFile };\r\nexport * from './types';\r\nexport default MyUploaderAndroid;\r\n\r\n\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AAAAI,MAAA,CAAAC,IAAA,CAAAF,MAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,MAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,MAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAAwB,SAAAL,uBAAAc,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAjB,wBAAAiB,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAArB,uBAAA,YAAAA,CAAAiB,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,CAAAI,GAAA,CAAAX,CAAA,UAAAO,CAAA,CAAAR,GAAA,CAAAC,CAAA,GAAAO,CAAA,CAAAK,GAAA,CAAAZ,CAAA,EAAAS,CAAA,gBAAAN,CAAA,IAAAH,CAAA,gBAAAG,CAAA,OAAAV,cAAA,CAAAC,IAAA,CAAAM,CAAA,EAAAG,CAAA,OAAAK,CAAA,IAAAD,CAAA,GAAAnB,MAAA,CAAAS,cAAA,KAAAT,MAAA,CAAAyB,wBAAA,CAAAb,CAAA,EAAAG,CAAA,OAAAK,CAAA,CAAAT,GAAA,IAAAS,CAAA,CAAAI,GAAA,IAAAL,CAAA,CAAAE,CAAA,EAAAN,CAAA,EAAAK,CAAA,IAAAC,CAAA,CAAAN,CAAA,IAAAH,CAAA,CAAAG,CAAA,WAAAM,CAAA,KAAAT,CAAA,EAAAG,CAAA;AAFxB;AAAA,IAAAW,QAAA,GAAAlB,OAAA,CAAAM,OAAA,GAGea,mBAAiB","ignoreList":[]}
1
+ {"version":3,"names":["_MyUploader","_interopRequireWildcard","require","_DownloadFile","_interopRequireDefault","_types","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","set","getOwnPropertyDescriptor","_default","MyUploader"],"sources":["index.ts"],"sourcesContent":["import MyUploader,{pickFile} from \"./components/MyUploader\";\r\nimport DownloadFile from \"./components/DownloadFile\";\r\n\r\n\r\n// 1. MyUploader'ı DEFAULT olarak dışa aktar (import MyUploader from ... için)\r\nexport default MyUploader;\r\n\r\n// 2. Diğerlerini NAMED olarak dışa aktar (import { DownloadFile, pickFile } ... için)\r\nexport { DownloadFile, pickFile };\r\n\r\n\r\nexport * from './types';\r\n\r\n\r\n\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAC,sBAAA,CAAAF,OAAA;AAUA,IAAAG,MAAA,GAAAH,OAAA;AAAAI,MAAA,CAAAC,IAAA,CAAAF,MAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,MAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,MAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAAwB,SAAAL,uBAAAc,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAjB,wBAAAiB,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAArB,uBAAA,YAAAA,CAAAiB,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,CAAAI,GAAA,CAAAX,CAAA,UAAAO,CAAA,CAAAR,GAAA,CAAAC,CAAA,GAAAO,CAAA,CAAAK,GAAA,CAAAZ,CAAA,EAAAS,CAAA,gBAAAN,CAAA,IAAAH,CAAA,gBAAAG,CAAA,OAAAV,cAAA,CAAAC,IAAA,CAAAM,CAAA,EAAAG,CAAA,OAAAK,CAAA,IAAAD,CAAA,GAAAnB,MAAA,CAAAS,cAAA,KAAAT,MAAA,CAAAyB,wBAAA,CAAAb,CAAA,EAAAG,CAAA,OAAAK,CAAA,CAAAT,GAAA,IAAAS,CAAA,CAAAI,GAAA,IAAAL,CAAA,CAAAE,CAAA,EAAAN,CAAA,EAAAK,CAAA,IAAAC,CAAA,CAAAN,CAAA,IAAAH,CAAA,CAAAG,CAAA,WAAAM,CAAA,KAAAT,CAAA,EAAAG,CAAA;AAPxB;AAAA,IAAAW,QAAA,GAAAlB,OAAA,CAAAM,OAAA,GACea,mBAAU,EAEzB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { StyleProp, TextStyle, ViewStyle } from 'react-native';\r\n\r\nexport interface FileInfo {\r\n fileName: string;\r\n fileSize: number; // in bytes\r\n fileType: string | null;\r\n fileUri: string;\r\n base64: string;\r\n}\r\n\r\nexport interface DocumentPickerOptions {\r\n multipleFiles?: boolean;\r\n fileTypes?: string[];\r\n maxSize?: number;\r\n maxFiles?: number;\r\n excludedUris?: string[];\r\n}\r\nexport interface MyUploaderProps extends DocumentPickerOptions {\r\n // Geri bildirim (callback) fonksiyonları\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}\r\n\r\n//download File Module Props\r\nexport interface DownloadedFileInfo {\r\n originalUrl: string;\r\n localUri: string; // Cihazdaki dosyanın URI'si\r\n}\r\n\r\n// YENİ: Atlanan dosyalar hakkında bilgi vermek için arayüz\r\nexport interface SkippedFileInfo {\r\n originalUrl: string;\r\n reason: string; // Neden atlandığı (örn: \"Dosya çok büyük\")\r\n}\r\n\r\n// YENİ: onSUCCESS callback'inin döndüreceği sonuç nesnesi\r\nexport interface DownloadResult {\r\n successful: DownloadedFileInfo[];\r\n skipped: SkippedFileInfo[];\r\n}\r\n\r\n// GÜNCELLENDİ: DownloadFileProps arayüzü\r\nexport interface DownloadFileProps {\r\n files: string[];\r\n // YENİ PROPLAR\r\n multipleLoad?: boolean;\r\n disabled?: boolean;\r\n debug?: boolean; // Mevcut debug prop'u\r\n\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 \r\n // GÜNCELLENDİ: Callback daha zengin bir nesne döndürecek\r\n onSuccess?: (result: DownloadResult) => void;\r\n onError?: (error: Error) => void;\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 uri: string;\r\n name: string;\r\n type: string;\r\n size: number;\r\n base64?: string;\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}\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}"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ import { NativeModules } from 'react-native';
2
+ const {
3
+ DownloadFile,
4
+ DocumentPicker
5
+ } = NativeModules;
6
+ if (!DownloadFile) console.warn("MyUploader: DownloadFile native module not found.");
7
+ if (!DocumentPicker) console.warn("MyUploader: DocumentPicker native module not found.");
8
+ export const NativeDownload = DownloadFile;
9
+ export const NativePicker = DocumentPicker;
10
+ //# sourceMappingURL=NativeModules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeModules","DownloadFile","DocumentPicker","console","warn","NativeDownload","NativePicker"],"sources":["NativeModules.ts"],"sourcesContent":["import { NativeModules } from 'react-native';\r\n\r\nconst { DownloadFile, DocumentPicker } = NativeModules;\r\n\r\nif (!DownloadFile) console.warn(\"MyUploader: DownloadFile native module not found.\");\r\nif (!DocumentPicker) console.warn(\"MyUploader: DocumentPicker native module not found.\");\r\n\r\nexport const NativeDownload = DownloadFile;\r\nexport const NativePicker = DocumentPicker;"],"mappings":"AAAA,SAASA,aAAa,QAAQ,cAAc;AAE5C,MAAM;EAAEC,YAAY;EAAEC;AAAe,CAAC,GAAGF,aAAa;AAEtD,IAAI,CAACC,YAAY,EAAEE,OAAO,CAACC,IAAI,CAAC,mDAAmD,CAAC;AACpF,IAAI,CAACF,cAAc,EAAEC,OAAO,CAACC,IAAI,CAAC,qDAAqD,CAAC;AAExF,OAAO,MAAMC,cAAc,GAAGJ,YAAY;AAC1C,OAAO,MAAMK,YAAY,GAAGJ,cAAc","ignoreList":[]}
@@ -1,11 +1,9 @@
1
1
  import React, { useState } from 'react';
2
- import { NativeModules, TouchableOpacity, Text, StyleSheet, ActivityIndicator } from 'react-native';
3
- const {
4
- DownloadFile: DownloadFileModule
5
- } = NativeModules;
2
+ import { TouchableOpacity, Text, StyleSheet, ActivityIndicator } from 'react-native';
3
+ import { NativeDownload } from '../NativeModules';
6
4
  const DownloadFile = ({
7
5
  files,
8
- multipleLoad = false,
6
+ multipleDownload = false,
9
7
  disabled = false,
10
8
  debug = false,
11
9
  maxSize = 0,
@@ -14,82 +12,72 @@ const DownloadFile = ({
14
12
  buttonIcon,
15
13
  ButtonStyle,
16
14
  ButtonTextStyle,
17
- onSuccess = () => {},
18
- onError = error => console.error('DownloadFile Error:', error)
15
+ onSuccess,
16
+ onError
19
17
  }) => {
20
18
  const [isLoading, setIsLoading] = useState(false);
21
19
  const handlePress = async () => {
22
- if (!DownloadFileModule) {
23
- onError(new Error("DownloadFile native module is not available."));
24
- return;
25
- }
20
+ if (disabled || isLoading || !files.length) return;
26
21
  setIsLoading(true);
27
- const downloadOptions = {
22
+ const options = {
23
+ debug,
28
24
  maxSize,
29
- fileTypes,
30
- debug
25
+ fileTypes
31
26
  };
27
+ const targetFiles = multipleDownload ? files : [files[0]];
32
28
  try {
33
- const filesToProcess = multipleLoad ? files : files.slice(0, 1);
34
- const downloadPromises = filesToProcess.map(url => DownloadFileModule.downloadFile(url, downloadOptions));
35
- const settledResults = await Promise.allSettled(downloadPromises);
36
- const finalResult = {
29
+ const promises = targetFiles.map(url => NativeDownload.downloadFile(url, options));
30
+ const results = await Promise.allSettled(promises);
31
+ const final = {
37
32
  successful: [],
38
33
  skipped: []
39
34
  };
40
- settledResults.forEach((result, index) => {
41
- // DÜZELTME: `filesToProcess[index]` ifadesinin sonuna `!` ekleyerek
42
- // TypeScript'e bu değerin asla undefined olmayacağını bildiriyoruz.
43
- const originalUrl = filesToProcess[index];
44
- if (result.status === 'fulfilled') {
45
- finalResult.successful.push({
35
+ results.forEach((res, index) => {
36
+ var _targetFiles$index;
37
+ const originalUrl = (_targetFiles$index = targetFiles[index]) !== null && _targetFiles$index !== void 0 ? _targetFiles$index : "";
38
+ if (res.status === 'fulfilled') {
39
+ final.successful.push({
46
40
  originalUrl,
47
- // Artık hata vermeyecek
48
- localUri: result.value
41
+ localUri: res.value
49
42
  });
50
43
  } else {
51
- finalResult.skipped.push({
44
+ var _res$reason;
45
+ final.skipped.push({
52
46
  originalUrl,
53
- // Artık hata vermeyecek
54
- reason: result.reason.message
47
+ reason: ((_res$reason = res.reason) === null || _res$reason === void 0 ? void 0 : _res$reason.message) || "Bilinmeyen Hata"
55
48
  });
56
49
  }
57
50
  });
58
- onSuccess(finalResult);
59
- } catch (error) {
60
- onError(error);
51
+ if (onSuccess) onSuccess(final);
52
+ } catch (e) {
53
+ if (onError) onError(e);else console.error(e);
61
54
  } finally {
62
55
  setIsLoading(false);
63
56
  }
64
57
  };
65
- const content = isLoading ? /*#__PURE__*/React.createElement(ActivityIndicator, {
66
- color: "#FFFFFF"
67
- }) : buttonIcon || /*#__PURE__*/React.createElement(Text, {
68
- style: [styles.buttonText, ButtonTextStyle]
69
- }, buttonPlaceHolder);
70
58
  return /*#__PURE__*/React.createElement(TouchableOpacity, {
71
- style: [styles.button, ButtonStyle, (disabled || isLoading) && styles.disabledButton],
59
+ style: [styles.button, ButtonStyle, (disabled || isLoading) && styles.disabled],
72
60
  onPress: handlePress,
73
61
  disabled: disabled || isLoading
74
- }, content);
62
+ }, isLoading ? /*#__PURE__*/React.createElement(ActivityIndicator, {
63
+ color: "#FFF"
64
+ }) : buttonIcon ? buttonIcon : /*#__PURE__*/React.createElement(Text, {
65
+ style: [styles.text, ButtonTextStyle]
66
+ }, buttonPlaceHolder));
75
67
  };
76
68
  const styles = StyleSheet.create({
77
69
  button: {
78
- backgroundColor: '#008CBA',
79
- paddingHorizontal: 20,
80
- paddingVertical: 10,
70
+ backgroundColor: '#03DAC6',
71
+ padding: 12,
81
72
  borderRadius: 8,
82
- alignItems: 'center',
83
- justifyContent: 'center',
84
- flexDirection: 'row'
73
+ alignItems: 'center'
85
74
  },
86
- buttonText: {
87
- color: '#FFFFFF',
88
- fontSize: 16,
75
+ text: {
76
+ color: '#000',
89
77
  fontWeight: 'bold'
90
78
  },
91
- disabledButton: {
92
- backgroundColor: '#A9A9A9'
79
+ disabled: {
80
+ backgroundColor: '#AAA'
93
81
  }
94
82
  });
95
83
  export default DownloadFile;
@@ -1 +1 @@
1
- {"version":3,"names":["React","useState","NativeModules","TouchableOpacity","Text","StyleSheet","ActivityIndicator","DownloadFile","DownloadFileModule","files","multipleLoad","disabled","debug","maxSize","fileTypes","buttonPlaceHolder","buttonIcon","ButtonStyle","ButtonTextStyle","onSuccess","onError","error","console","isLoading","setIsLoading","handlePress","Error","downloadOptions","filesToProcess","slice","downloadPromises","map","url","downloadFile","settledResults","Promise","allSettled","finalResult","successful","skipped","forEach","result","index","originalUrl","status","push","localUri","value","reason","message","content","createElement","color","style","styles","buttonText","button","disabledButton","onPress","create","backgroundColor","paddingHorizontal","paddingVertical","borderRadius","alignItems","justifyContent","flexDirection","fontSize","fontWeight"],"sources":["DownloadFile.tsx"],"sourcesContent":["import React, { useState } from 'react';\r\nimport { NativeModules, TouchableOpacity, Text, StyleSheet, ActivityIndicator } from 'react-native';\r\nimport type { DownloadFileProps, DownloadResult } from '../types';\r\n\r\nconst { DownloadFile: DownloadFileModule } = NativeModules;\r\n\r\nconst DownloadFile: React.FC<DownloadFileProps> = ({\r\n files,\r\n multipleLoad = false,\r\n disabled = false,\r\n debug = false,\r\n maxSize = 0,\r\n fileTypes = ['*/*'],\r\n buttonPlaceHolder = 'Dosyaları İndir',\r\n buttonIcon,\r\n ButtonStyle,\r\n ButtonTextStyle,\r\n onSuccess = () => {},\r\n onError = (error) => console.error('DownloadFile Error:', error),\r\n}) => {\r\n const [isLoading, setIsLoading] = useState(false);\r\n\r\n const handlePress = async () => {\r\n if (!DownloadFileModule) {\r\n onError(new Error(\"DownloadFile native module is not available.\"));\r\n return;\r\n }\r\n\r\n setIsLoading(true);\r\n const downloadOptions = { maxSize, fileTypes, debug };\r\n\r\n try {\r\n const filesToProcess = multipleLoad ? files : files.slice(0, 1);\r\n const downloadPromises = filesToProcess.map(url => \r\n DownloadFileModule.downloadFile(url, downloadOptions)\r\n );\r\n\r\n const settledResults = await Promise.allSettled(downloadPromises);\r\n\r\n const finalResult: DownloadResult = { successful: [], skipped: [] };\r\n\r\n settledResults.forEach((result, index) => {\r\n // DÜZELTME: `filesToProcess[index]` ifadesinin sonuna `!` ekleyerek\r\n // TypeScript'e bu değerin asla undefined olmayacağını bildiriyoruz.\r\n const originalUrl = filesToProcess[index]!;\r\n\r\n if (result.status === 'fulfilled') {\r\n finalResult.successful.push({\r\n originalUrl, // Artık hata vermeyecek\r\n localUri: result.value,\r\n });\r\n } else {\r\n finalResult.skipped.push({\r\n originalUrl, // Artık hata vermeyecek\r\n reason: result.reason.message,\r\n });\r\n }\r\n });\r\n \r\n onSuccess(finalResult);\r\n\r\n } catch (error: any) {\r\n onError(error);\r\n } finally {\r\n setIsLoading(false);\r\n }\r\n };\r\n\r\n const content = isLoading ? (\r\n <ActivityIndicator color=\"#FFFFFF\" />\r\n ) : (\r\n buttonIcon || <Text style={[styles.buttonText, ButtonTextStyle]}>{buttonPlaceHolder}</Text>\r\n );\r\n\r\n return (\r\n <TouchableOpacity\r\n style={[styles.button, ButtonStyle, (disabled || isLoading) && styles.disabledButton]}\r\n onPress={handlePress}\r\n disabled={disabled || isLoading}\r\n >\r\n {content}\r\n </TouchableOpacity>\r\n );\r\n};\r\n\r\nconst styles = StyleSheet.create({\r\n button: {\r\n backgroundColor: '#008CBA',\r\n paddingHorizontal: 20,\r\n paddingVertical: 10,\r\n borderRadius: 8,\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n flexDirection: 'row',\r\n },\r\n buttonText: {\r\n color: '#FFFFFF',\r\n fontSize: 16,\r\n fontWeight: 'bold',\r\n },\r\n disabledButton: {\r\n backgroundColor: '#A9A9A9',\r\n },\r\n});\r\n\r\nexport default DownloadFile;"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,aAAa,EAAEC,gBAAgB,EAAEC,IAAI,EAAEC,UAAU,EAAEC,iBAAiB,QAAQ,cAAc;AAGnG,MAAM;EAAEC,YAAY,EAAEC;AAAmB,CAAC,GAAGN,aAAa;AAE1D,MAAMK,YAAyC,GAAGA,CAAC;EACjDE,KAAK;EACLC,YAAY,GAAG,KAAK;EACpBC,QAAQ,GAAG,KAAK;EAChBC,KAAK,GAAG,KAAK;EACbC,OAAO,GAAG,CAAC;EACXC,SAAS,GAAG,CAAC,KAAK,CAAC;EACnBC,iBAAiB,GAAG,iBAAiB;EACrCC,UAAU;EACVC,WAAW;EACXC,eAAe;EACfC,SAAS,GAAGA,CAAA,KAAM,CAAC,CAAC;EACpBC,OAAO,GAAIC,KAAK,IAAKC,OAAO,CAACD,KAAK,CAAC,qBAAqB,EAAEA,KAAK;AACjE,CAAC,KAAK;EACJ,MAAM,CAACE,SAAS,EAAEC,YAAY,CAAC,GAAGvB,QAAQ,CAAC,KAAK,CAAC;EAEjD,MAAMwB,WAAW,GAAG,MAAAA,CAAA,KAAY;IAC9B,IAAI,CAACjB,kBAAkB,EAAE;MACvBY,OAAO,CAAC,IAAIM,KAAK,CAAC,8CAA8C,CAAC,CAAC;MAClE;IACF;IAEAF,YAAY,CAAC,IAAI,CAAC;IAClB,MAAMG,eAAe,GAAG;MAAEd,OAAO;MAAEC,SAAS;MAAEF;IAAM,CAAC;IAErD,IAAI;MACF,MAAMgB,cAAc,GAAGlB,YAAY,GAAGD,KAA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ACEf,KAAA,CAAAmD,aAAA,CAAChD,gBAAgB;IACfkD,KAAK,EAAE,CAACC,MAAM,CAACE,MAAM,EAAEvC,WAAW,EAAE,CAACN,QAAQ,IAAIY,SAAS,KAAK+B,MAAM,CAACG,cAAc,CAAE;IACtFC,OAAO,EAAEjC,WAAY;IACrBd,QAAQ,EAAEA,QAAQ,IAAIY;EAAU,GAE/B2B,OACe,CAAC;AAEvB,CAAC;AAED,MAAMI,MAAM,GAAGjD,UAAU,CAACsD,MAAM,CAAC;EAC7BH,MAAM,EAAE;IACNI,eAAe,EAAE,SAAS;IAC1BC,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,EAAE;IACnBC,YAAY,EAAE,CAAC;IACfC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,QAAQ;IACxBC,aAAa,EAAE;EACjB,CAAC;EACDX,UAAU,EAAE;IACVH,KAAK,EAAE,SAAS;IAChBe,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE;EACd,CAAC;EACDX,cAAc,EAAE;IACdG,eAAe,EAAE;EACnB;AACJ,CAAC,CAAC;AAEF,eAAerD,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["React","useState","TouchableOpacity","Text","StyleSheet","ActivityIndicator","NativeDownload","DownloadFile","files","multipleDownload","disabled","debug","maxSize","fileTypes","buttonPlaceHolder","buttonIcon","ButtonStyle","ButtonTextStyle","onSuccess","onError","isLoading","setIsLoading","handlePress","length","options","targetFiles","promises","map","url","downloadFile","results","Promise","allSettled","final","successful","skipped","forEach","res","index","_targetFiles$index","originalUrl","status","push","localUri","value","_res$reason","reason","message","e","console","error","createElement","style","styles","button","onPress","color","text","create","backgroundColor","padding","borderRadius","alignItems","fontWeight"],"sources":["DownloadFile.tsx"],"sourcesContent":["import React, { useState } from 'react';\r\nimport { TouchableOpacity, Text, StyleSheet, ActivityIndicator } from 'react-native';\r\nimport { NativeDownload } from '../NativeModules';\r\nimport type { DownloadFileProps, DownloadResult } from '../types';\r\n\r\nconst DownloadFile: React.FC<DownloadFileProps> = ({\r\n files,\r\n multipleDownload = false,\r\n disabled = false,\r\n debug = false,\r\n maxSize = 0,\r\n fileTypes = ['*/*'],\r\n buttonPlaceHolder = 'Dosyaları İndir',\r\n buttonIcon,\r\n ButtonStyle,\r\n ButtonTextStyle,\r\n onSuccess,\r\n onError,\r\n}) => {\r\n const [isLoading, setIsLoading] = useState(false);\r\n\r\n const handlePress = async () => {\r\n if (disabled || isLoading || !files.length) return;\r\n setIsLoading(true);\r\n\r\n const options = { debug, maxSize, fileTypes };\r\n const targetFiles = multipleDownload ? files : [files[0]];\r\n\r\n try {\r\n const promises = targetFiles.map(url => NativeDownload.downloadFile(url, options));\r\n const results = await Promise.allSettled(promises);\r\n \r\n const final: DownloadResult = { successful: [], skipped: [] };\r\n\r\n results.forEach((res, index) => {\r\n const originalUrl = targetFiles[index] ?? \"\";\r\n if (res.status === 'fulfilled') {\r\n final.successful.push({ originalUrl, localUri: res.value });\r\n } else {\r\n final.skipped.push({ \r\n originalUrl, \r\n reason: res.reason?.message || \"Bilinmeyen Hata\" \r\n });\r\n }\r\n });\r\n\r\n if (onSuccess) onSuccess(final);\r\n } catch (e) {\r\n if (onError) onError(e);\r\n else console.error(e);\r\n } finally {\r\n setIsLoading(false);\r\n }\r\n };\r\n\r\n return (\r\n <TouchableOpacity\r\n style={[styles.button, ButtonStyle, (disabled || isLoading) && styles.disabled]}\r\n onPress={handlePress}\r\n disabled={disabled || isLoading}\r\n >\r\n {isLoading ? (\r\n <ActivityIndicator color=\"#FFF\" />\r\n ) : (\r\n buttonIcon ? buttonIcon : <Text style={[styles.text, ButtonTextStyle]}>{buttonPlaceHolder}</Text>\r\n )}\r\n </TouchableOpacity>\r\n );\r\n};\r\n\r\nconst styles = StyleSheet.create({\r\n button: {\r\n backgroundColor: '#03DAC6',\r\n padding: 12,\r\n borderRadius: 8,\r\n alignItems: 'center',\r\n },\r\n text: { color: '#000', fontWeight: 'bold' },\r\n disabled: { backgroundCol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