Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions package/native-package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"react-native": ">=0.67.0",
"react-native-audio-recorder-player": ">=3.6.4",
"react-native-blob-util": ">=0.19.9",
"react-native-document-picker": ">=9.3.0",
"@react-native-documents/picker": ">=10.1.1",
"react-native-haptic-feedback": ">=2.2.0",
"react-native-image-picker": ">=7.1.2",
Expand All @@ -49,9 +48,6 @@
"react-native-share": {
"optional": true
},
"react-native-document-picker": {
"optional": true
},
"@react-native-documents/picker": {
"optional": true
},
Expand Down
27 changes: 4 additions & 23 deletions package/native-package/src/optionalDependencies/pickDocument.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Types are approximated from what we need from the DocumentPicker API.
*
* For its full API, see https://github.com/rnmods/react-native-document-picker/blob/master/src/index.tsx
* For its full API, see https://github.com/react-native-documents/document-picker/blob/main/packages/document-picker/src/index.ts
* */
type ResponseValue = {
name: string;
Expand All @@ -19,31 +19,12 @@ type DocumentPickerType =

let DocumentPicker: DocumentPickerType;

let OldDocumentPicker: DocumentPickerType;
let NewDocumentPicker: DocumentPickerType;

try {
NewDocumentPicker = require('@react-native-documents/picker');
} catch (err) {
// we log below
}

try {
OldDocumentPicker = require('react-native-document-picker').default;
DocumentPicker = require('@react-native-documents/picker');
} catch (err) {
// we log below
}

if (NewDocumentPicker) {
DocumentPicker = NewDocumentPicker;
} else if (OldDocumentPicker) {
DocumentPicker = OldDocumentPicker;
console.log(
"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 !",
);
} else {
// do nothing
console.log(
'Neither react-native-document-picker nor @react-native-documents/picker are installed.',
'The @react-native-documents/picker is not installed. Installing it will enable you to pick and upload files from within your app.',
);
}

Expand Down