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

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.
@@ -1,13 +1,13 @@
1
1
  import React, { useState } from 'react';
2
- import { TouchableOpacity, Text, StyleSheet, ActivityIndicator,NativeModules } from 'react-native';
3
- import type { MyUploaderProps, DocumentPickerOptions, FileInfo } from '../types';
2
+ import { TouchableOpacity, Text, StyleSheet, ActivityIndicator, NativeModules } from 'react-native';
3
+ import type { MyUploaderProps, DocumentPickerOptions, FileInfo, RotateImageProps } from '../types';
4
4
 
5
5
  const { UploadDocumentPicker: NativeUploadPicker } = NativeModules;
6
6
 
7
7
  // 1. Standalone pickFile Fonksiyonu
8
8
  export const pickFile = async (options: DocumentPickerOptions = {}): Promise<FileInfo[]> => {
9
9
  if (!NativeUploadPicker) throw new Error("DocumentPicker module is not linked.");
10
-
10
+
11
11
  // Native tarafa gönderilecek options
12
12
  const nativeOptions = {
13
13
  multipleFiles: options.multipleFiles ?? false,
@@ -20,6 +20,22 @@ export const pickFile = async (options: DocumentPickerOptions = {}): Promise<Fil
20
20
  return await NativeUploadPicker.openDocument(nativeOptions);
21
21
  };
22
22
 
23
+ export const RotateImage = async ({ base64, angle }: RotateImageProps): Promise<string> => {
24
+ if (!NativeUploadPicker) {
25
+ throw new Error("UploadDocumentPicker module is not linked.");
26
+ }
27
+
28
+ try {
29
+ const rotatedBase64: string =
30
+ await NativeUploadPicker.rotateImage(base64, angle);
31
+
32
+ // JS tarafında prefix eklenir
33
+ return `data:image/jpeg;base64,${rotatedBase64}`;
34
+ } catch (error: any) {
35
+ throw new Error(`RotateImage Error: ${error.message}`);
36
+ }
37
+ };
38
+
23
39
  // 2. MyUploader Bileşeni
24
40
  const MyUploader: React.FC<MyUploaderProps> = ({
25
41
  onSelect,
@@ -48,7 +64,7 @@ const MyUploader: React.FC<MyUploaderProps> = ({
48
64
  maxFiles,
49
65
  excludedUris
50
66
  });
51
-
67
+
52
68
  onSelect(files);
53
69
  } catch (error: any) {
54
70
  if (onError) {
package/src/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import type { DocumentPickerOptions, MyUploaderProps, FileInfo } from './types';
2
+ import type { DocumentPickerOptions, MyUploaderProps, FileInfo, DownloadFileProps ,RotateImageProps } from './types';
3
3
  // import type { DownloadFileProps } from './types';
4
4
 
5
5
  export * from './types';
@@ -9,7 +9,8 @@ export * from './types';
9
9
 
10
10
  // pickFile Fonksiyon Tanımı
11
11
  export declare function pickFile(options?: DocumentPickerOptions): Promise<FileInfo[]>;
12
-
12
+ export declare function RotateImage(props:RotateImageProps):Promise<string>;
13
+ export declare const DownloadFile :React.FC<DownloadFileProps>;
13
14
  export declare const MyUploader: React.FC<MyUploaderProps>;
14
15
 
15
16
  // Varsayılan dışa aktarım (İsteğe bağlı, genellikle ana bileşen verilir)
package/src/index.ts CHANGED
@@ -1,12 +1,9 @@
1
- import MyUploader,{pickFile} from "./components/MyUploader";
2
- // import DownloadFile from "./components/DownloadFile";
3
-
4
- // 2. Diğerlerini NAMED olarak dışa aktar (import { DownloadFile, pickFile } ... için)
5
- // export { DownloadFile, pickFile };
1
+ import MyUploader,{pickFile,RotateImage} from "./components/MyUploader";
2
+ import {DownloadFile} from "./components/DownloadFile";
6
3
 
7
4
 
8
5
  // Sadece bu paketle ilgili olanları dışa aktar
9
- export { MyUploader, pickFile };
6
+ export { MyUploader, pickFile ,DownloadFile ,RotateImage };
10
7
  export * from './types';
11
8
 
12
9
  // Varsayılan dışa aktarım olarak da ana bileşeni verelim
package/src/types.ts CHANGED
@@ -118,4 +118,11 @@ export interface DownloadFileProps {
118
118
  export interface DownloadResult {
119
119
  successful: { originalUrl: string; localUri: string | null }[];
120
120
  skipped: { originalUrl: string; reason: string }[];
121
+ }
122
+
123
+
124
+ ///rotateImage
125
+
126
+ export interface RotateImageProps{
127
+ base64: string, angle: number
121
128
  }