Skip to content

Commit 55caef5

Browse files
committed
chore: add possibility to use @react-native-documents/picker
1 parent 6aaede7 commit 55caef5

File tree

5 files changed

+31
-15
lines changed

5 files changed

+31
-15
lines changed

examples/SampleApp/ios/Podfile.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,7 +1454,7 @@ PODS:
14541454
- ReactCommon/turbomodule/bridging
14551455
- ReactCommon/turbomodule/core
14561456
- Yoga
1457-
- react-native-document-picker (9.3.1):
1457+
- react-native-document-picker (10.1.1):
14581458
- DoubleConversion
14591459
- glog
14601460
- hermes-engine
@@ -2283,7 +2283,7 @@ DEPENDENCIES:
22832283
- React-microtasksnativemodule (from `../node_modules/react-native/ReactCommon/react/nativemodule/microtasks`)
22842284
- react-native-blob-util (from `../node_modules/react-native-blob-util`)
22852285
- "react-native-cameraroll (from `../node_modules/@react-native-camera-roll/camera-roll`)"
2286-
- react-native-document-picker (from `../node_modules/react-native-document-picker`)
2286+
- "react-native-document-picker (from `../node_modules/@react-native-documents/picker`)"
22872287
- "react-native-netinfo (from `../node_modules/@react-native-community/netinfo`)"
22882288
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
22892289
- react-native-video (from `../node_modules/react-native-video`)
@@ -2438,7 +2438,7 @@ EXTERNAL SOURCES:
24382438
react-native-cameraroll:
24392439
:path: "../node_modules/@react-native-camera-roll/camera-roll"
24402440
react-native-document-picker:
2441-
:path: "../node_modules/react-native-document-picker"
2441+
:path: "../node_modules/@react-native-documents/picker"
24422442
react-native-netinfo:
24432443
:path: "../node_modules/@react-native-community/netinfo"
24442444
react-native-safe-area-context:
@@ -2590,7 +2590,7 @@ SPEC CHECKSUMS:
25902590
React-microtasksnativemodule: b31e56a980634f383221bfefd5111d04c14c110b
25912591
react-native-blob-util: 875bbeee07e4ada135e4edf9fc7b22acf8d9721d
25922592
react-native-cameraroll: 36dc62b41c7943a79ac2f7cf4d3da10d4138513f
2593-
react-native-document-picker: 6d3991d663e28714988c41696490e6fb1c525fbc
2593+
react-native-document-picker: 19be73c0423e4bc886cef74ec282eff750698013
25942594
react-native-netinfo: f0a9899081c185db1de5bb2fdc1c88c202a059ac
25952595
react-native-safe-area-context: 0b43456abcaaa3c8323bbfafe9c5f0f9511219d2
25962596
react-native-video: a225b4d4d3286f3253dc7b00a62e7c8e59d04d51
@@ -2642,4 +2642,4 @@ SPEC CHECKSUMS:
26422642

26432643
PODFILE CHECKSUM: 4f662370295f8f9cee909f1a4c59a614999a209d
26442644

2645-
COCOAPODS: 1.16.2
2645+
COCOAPODS: 1.14.3

examples/SampleApp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"@react-native-async-storage/async-storage": "^2.1.1",
2929
"@react-native-camera-roll/camera-roll": "^7.9.0",
3030
"@react-native-community/netinfo": "^11.4.1",
31+
"@react-native-documents/picker": "^10.1.1",
3132
"@react-native-firebase/app": "21.11.0",
3233
"@react-native-firebase/messaging": "21.11.0",
3334
"@react-navigation/bottom-tabs": "7.2.0",
@@ -38,7 +39,6 @@
3839
"react-native": "^0.78.0",
3940
"react-native-audio-recorder-player": "^3.6.12",
4041
"react-native-blob-util": "^0.21.2",
41-
"react-native-document-picker": "^9.3.1",
4242
"react-native-fast-image": "^8.6.3",
4343
"react-native-gesture-handler": "^2.24.0",
4444
"react-native-haptic-feedback": "^2.3.3",

examples/SampleApp/yarn.lock

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2140,6 +2140,11 @@
21402140
resolved "https://registry.yarnpkg.com/@react-native-community/netinfo/-/netinfo-11.4.1.tgz#a3c247aceab35f75dd0aa4bfa85d2be5a4508688"
21412141
integrity sha512-B0BYAkghz3Q2V09BF88RA601XursIEA111tnc2JOaN7axJWmNefmfjZqw/KdSxKZp7CZUuPpjBmz/WCR9uaHYg==
21422142

2143+
"@react-native-documents/picker@^10.1.1":
2144+
version "10.1.1"
2145+
resolved "https://registry.yarnpkg.com/@react-native-documents/picker/-/picker-10.1.1.tgz#3060d9387771ce74c58d212b9e7be876f076b7bc"
2146+
integrity sha512-RijOCQmesOPe4ahtwOag6k6GLhLHf34sMQtAJ4KjLk7ab0kG5Chvcsvd5zixWC4d0tuBnVAtMUOzvn0bp+UtAg==
2147+
21432148
"@react-native-firebase/[email protected]":
21442149
version "21.11.0"
21452150
resolved "https://registry.yarnpkg.com/@react-native-firebase/app/-/app-21.11.0.tgz#a01b0cb738a8b9ca7bb7ab7dd461c5a9744cb68a"
@@ -6859,13 +6864,6 @@ react-native-blob-util@^0.21.2:
68596864
base-64 "0.1.0"
68606865
glob "^10.3.10"
68616866

6862-
react-native-document-picker@^9.3.1:
6863-
version "9.3.1"
6864-
resolved "https://registry.yarnpkg.com/react-native-document-picker/-/react-native-document-picker-9.3.1.tgz#f2c33237a906fd0893130e0605c8f18a3aef1605"
6865-
integrity sha512-Vcofv9wfB0j67zawFjfq9WQPMMzXxOZL9kBmvWDpjVuEcVK73ndRmlXHlkeFl5ZHVsv4Zb6oZYhqm9u5omJOPA==
6866-
dependencies:
6867-
invariant "^2.2.4"
6868-
68696867
react-native-drawer-layout@^4.1.1:
68706868
version "4.1.1"
68716869
resolved "https://registry.yarnpkg.com/react-native-drawer-layout/-/react-native-drawer-layout-4.1.1.tgz#7fce1b3d3ddd9fc5d781c73d13b814d022b90114"

package/native-package/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"react-native-audio-recorder-player": ">=3.6.4",
3131
"react-native-blob-util": ">=0.19.9",
3232
"react-native-document-picker": ">=9.3.0",
33+
"@react-native-documents/picker": ">=10.1.1",
3334
"react-native-haptic-feedback": ">=2.2.0",
3435
"react-native-image-picker": ">=7.1.2",
3536
"react-native-share": ">=10.2.1",
@@ -51,6 +52,9 @@
5152
"react-native-document-picker": {
5253
"optional": true
5354
},
55+
"@react-native-documents/picker": {
56+
"optional": true
57+
},
5458
"react-native-haptic-feedback": {
5559
"optional": true
5660
},

package/native-package/src/optionalDependencies/pickDocument.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,23 @@ let DocumentPicker:
1818
| undefined;
1919

2020
try {
21-
DocumentPicker = require('react-native-document-picker').default;
21+
DocumentPicker = require('@react-native-documents/picker');
2222
} catch (err) {
23-
console.log('react-native-document-picker is not installed');
23+
// we do nothing as the alternative might be used
24+
// console.warn('@react-native-documents/picker is not installed');
25+
}
26+
27+
if (!DocumentPicker) {
28+
try {
29+
DocumentPicker = require('react-native-document-picker').default;
30+
console.log(
31+
"You're using the react-native-document-picker library, which is no longer supported and has moved to @react-native-documents/picker. Things might not work as intended. Please migrate to the new library as soon as possible !",
32+
);
33+
} catch (err) {
34+
console.log(
35+
'Neither react-native-document-picker nor @react-native-documents/picker are installed.',
36+
);
37+
}
2438
}
2539

2640
export const pickDocument = DocumentPicker

0 commit comments

Comments
 (0)