@react-native-documents/picker 10.1.6 → 10.1.7

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.
@@ -138,7 +138,7 @@ class MetadataGetter(private val uriMap: MutableMap<String, Uri>) {
138
138
  private fun <T> getCursorValue(cursor: Cursor, columnName: String, valueType: Class<T>): T? {
139
139
  val columnIndex = cursor.getColumnIndex(columnName)
140
140
  if (columnIndex != -1 && !cursor.isNull(columnIndex)) {
141
- return try {
141
+ return runCatching {
142
142
  when (valueType) {
143
143
  String::class.java -> cursor.getString(columnIndex) as T
144
144
  Int::class.java -> cursor.getInt(columnIndex) as T
@@ -147,10 +147,8 @@ class MetadataGetter(private val uriMap: MutableMap<String, Uri>) {
147
147
  Float::class.java -> cursor.getFloat(columnIndex) as T
148
148
  else -> null
149
149
  }
150
- } catch (e: Exception) {
151
- // this should not happen but if it does, we return null
152
- null
153
- }
150
+ // throw should not happen but if it does, we return null
151
+ }.getOrNull()
154
152
  }
155
153
  return null
156
154
  }
@@ -0,0 +1,35 @@
1
+ // LICENSE: see License.md in the package root
2
+ package com.reactnativedocumentpicker
3
+
4
+ import com.facebook.react.BaseReactPackage
5
+ import com.facebook.react.bridge.NativeModule
6
+ import com.facebook.react.bridge.ReactApplicationContext
7
+ import com.facebook.react.module.model.ReactModuleInfo
8
+ import com.facebook.react.module.model.ReactModuleInfoProvider
9
+
10
+ class RNDocumentPickerPackage : BaseReactPackage() {
11
+ override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
12
+ return if (name == NativeDocumentPickerSpec.NAME) {
13
+ RNDocumentPickerModule(reactContext)
14
+ } else {
15
+ null
16
+ }
17
+ }
18
+
19
+ override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
20
+ return ReactModuleInfoProvider {
21
+ val isTurboModule = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
22
+ val moduleInfos = mapOf(
23
+ NativeDocumentPickerSpec.NAME to ReactModuleInfo(
24
+ NativeDocumentPickerSpec.NAME,
25
+ NativeDocumentPickerSpec.NAME, // "DocumentPickerModule",
26
+ false, // canOverrideExistingModule
27
+ false, // needsEagerInit
28
+ false, // isCxxModule
29
+ isTurboModule // isTurboModule
30
+ )
31
+ )
32
+ moduleInfos
33
+ }
34
+ }
35
+ }
@@ -14,10 +14,6 @@
14
14
  #import "react_native_document_picker-Swift.h"
15
15
  #endif
16
16
 
17
- // for UIModalPresentationStyle conversion
18
- // remove after https://github.com/facebook/react-native/commit/2d547a3252b328251e49dabfeec85f8d46c85411 is released
19
- #import <React/RCTModalHostViewManager.h>
20
-
21
17
  @interface RNDocumentPicker ()
22
18
  @end
23
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-documents/picker",
3
- "version": "10.1.6",
3
+ "version": "10.1.7",
4
4
  "description": "A react native interface to access documents from dropbox, google drive, iCloud...",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -1,49 +0,0 @@
1
- // LICENSE: see License.md in the package root
2
- package com.reactnativedocumentpicker;
3
-
4
- import androidx.annotation.NonNull;
5
- import androidx.annotation.Nullable;
6
-
7
- import com.facebook.react.TurboReactPackage;
8
- import com.facebook.react.bridge.NativeModule;
9
- import com.facebook.react.bridge.ReactApplicationContext;
10
- import com.facebook.react.module.model.ReactModuleInfo;
11
- import com.facebook.react.module.model.ReactModuleInfoProvider;
12
-
13
- import java.util.HashMap;
14
- import java.util.Map;
15
-
16
- public class RNDocumentPickerPackage extends TurboReactPackage {
17
-
18
- @Nullable
19
- @Override
20
- public NativeModule getModule(String name, @NonNull ReactApplicationContext reactContext) {
21
- if (name.equals(RNDocumentPickerModule.NAME)) {
22
- return new RNDocumentPickerModule(reactContext);
23
- } else {
24
- return null;
25
- }
26
- }
27
-
28
- @Override
29
- public ReactModuleInfoProvider getReactModuleInfoProvider() {
30
- return () -> {
31
- boolean isTurboModule = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
32
- final Map<String, ReactModuleInfo> moduleInfos = new HashMap<>();
33
- moduleInfos.put(
34
- RNDocumentPickerModule.NAME,
35
- // deprecated in RN 0.73
36
- new ReactModuleInfo(
37
- RNDocumentPickerModule.NAME,
38
- RNDocumentPickerModule.NAME,
39
- // "DocumentPickerModule",
40
- false, // canOverrideExistingModule
41
- false, // needsEagerInit
42
- false, // hasConstants
43
- false, // isCxxModule
44
- isTurboModule // isTurboModule
45
- ));
46
- return moduleInfos;
47
- };
48
- }
49
- }