diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 00000000..3ba13e0c
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1 @@
+blank_issues_enabled: false
diff --git a/.github/ISSUE_TEMPLATE/custom.yaml b/.github/ISSUE_TEMPLATE/custom.yaml
new file mode 100644
index 00000000..2889f270
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/custom.yaml
@@ -0,0 +1,78 @@
+name: "\U0001F41B Bug Report"
+description: 'Report a bug'
+body:
+ - type: markdown
+ attributes:
+ value: Thanks for taking the time to file a bug report! Please fill out this entire form.
+ - type: checkboxes
+ attributes:
+ label: I have searched open and closed issues for this issue.
+ options:
+ - label: I have searched open and closed issues.
+ required: true
+ - type: checkboxes
+ attributes:
+ label: I have read and understood the license (link below).
+ options:
+ - label: I have read and understood the [license](https://github.com/react-native-documents/document-picker/blob/main/LICENSE.md).
+ required: true
+ - type: input
+ attributes:
+ label: Minimal reproducible example
+ description: |
+ A link to a GitHub repository containing a minimal reproducible example. This repository should include as little code as possible and not include extraneous dependencies.
+
+ Try to reproduce the bugs on the provided example app. Either provide a link to the repo that reproduces the bug or provide your version of the `App.tsx` file that reproduces the issue and that we can easily use.
+
+ If a reproducible example is not provided, your issue is likely to be closed.
+ [Learn more about creating a minimal reproducible example](https://stackoverflow.com/help/mcve).
+ validations:
+ required: true
+ - type: dropdown
+ attributes:
+ label: What platform(s) does this occur on?
+ multiple: true
+ options:
+ - Android
+ - iOS
+ validations:
+ required: true
+ - type: dropdown
+ attributes:
+ label: Did you reproduce on a real device or emulator / simulator?
+ multiple: false
+ options:
+ - Select an option
+ - real device
+ - emulator / simulator
+ validations:
+ required: true
+ - type: textarea
+ attributes:
+ label: Steps to reproduce
+ description: |
+ Explain the steps we need to take to reproduce the issue. Include a video or screenshots if you think it may help.
+ Clearly describe what the expected behavior is and what instead is actually happening. Be concise and precise in your description.
+ validations:
+ required: true
+ - type: checkboxes
+ attributes:
+ label: If the issue is related to specific file(s), I have linked the files so that others can reproduce exactly what I see.
+ options:
+ - label: I have attached files necessary to reproduce the problem (if applicable).
+ required: true
+ - type: textarea
+ attributes:
+ label: Stacktrace of the crash (if applicable)
+ render: shell
+ description: |
+ Give the stacktrace of the crash, or explain the error message you are seeing. This will be automatically formatted into code.
+ validations:
+ required: true
+ - type: textarea
+ attributes:
+ render: text
+ label: Your computer environment
+ description: Run the `npx react-native info` command and paste its output in the field below.
+ validations:
+ required: true
diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml
new file mode 100644
index 00000000..2a51ecca
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.yaml
@@ -0,0 +1,25 @@
+name: "Feature request template"
+description: 'Request a feature'
+body:
+ - type: markdown
+ attributes:
+ value: Thanks for taking the time to file a feature request! Please fill out this form.
+ - type: textarea
+ attributes:
+ label: Feature description
+ description: |
+ Please describe what feature you think is missing and link to the documentation of the underlying operating system APIs which cover the functionality.
+
+ Thank you!
+ validations:
+ required: true
+ - type: dropdown
+ attributes:
+ label: What platform(s) should this be implemented on?
+ multiple: true
+ options:
+ - Android
+ - iOS
+ - web
+ validations:
+ required: true
diff --git a/.github/ISSUE_TEMPLATE/question.yaml b/.github/ISSUE_TEMPLATE/question.yaml
new file mode 100644
index 00000000..deaf3385
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/question.yaml
@@ -0,0 +1,14 @@
+name: "Question template"
+description: 'Ask a question'
+labels: ['question']
+body:
+ - type: markdown
+ attributes:
+ value: Please use the [GH discussions](https://github.com/react-native-google-signin/google-signin/discussions) for questions. Thank you!
+ - type: dropdown
+ attributes:
+ label: I will post my question to GH discussions.
+ options:
+ - 'Yes'
+ validations:
+ required: true
diff --git a/.github/label-actions.yml b/.github/label-actions.yml
deleted file mode 100644
index b304f2d4..00000000
--- a/.github/label-actions.yml
+++ /dev/null
@@ -1,36 +0,0 @@
-# Configuration for Label Actions - https://github.com/dessant/label-actions
-
-# Actions taken when the `repro-required` label is added
-repro-required:
- # Post a comment
- comment: >
- :wave: @{issue-author}, sorry you're having an issue. This issue is being closed because it does not provide all information required by the [issue template](https://raw.githubusercontent.com/rnmods/.github/master/.github/ISSUE_TEMPLATE/bug_report.md).
- As the issue template explains, we require that you provide a runnable example that reproduces your issue and your environment information.
- This means you need to provide a code snippet that we can copy-paste into an empty project and see the error ourselves, or provide a git repository with the issue.
-
- The reason is that maintainers do not have time to try reproduce bugs themselves. Please try to minimize the superfluous code and focus only on reproducing the bug.
-
- Please create a new issue with this and we'll be happy to review it!
- # Lock the thread
- lock: true
- close: true
-# Actions taken when the `repro-required` label is removed
--repro-required:
- # Unlock the thread
- unlock: true
- reopen: true
-
-question:
- # Post a comment
- comment: >
- :wave: @{issue-author}, thanks for opening the issue. The issue tracker is intended for tracking bug reports and feature requests only.
-
- Seems you have a usage question. Please ask the question on [StackOverflow](https://stackoverflow.com/questions/tagged/react-native). You can also chat with other community members on [Reactiflux Discord server](https://www.reactiflux.com/).
- # Lock the thread
- lock: true
- close: true
-# Actions taken when the `repro-required` label is removed
--question:
- # Unlock the thread
- unlock: true
- reopen: true
diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml
index 8b782609..cfbb11e2 100644
--- a/.github/workflows/ios.yml
+++ b/.github/workflows/ios.yml
@@ -7,10 +7,12 @@ on:
paths:
- '.github/workflows/ios.yml'
- 'packages/**/ios**'
+ - 'packages/**/*.podspec'
pull_request:
paths:
- '.github/workflows/ios.yml'
- 'packages/**/ios**'
+ - 'packages/**/*.podspec'
jobs:
ios-build:
diff --git a/.github/workflows/label-actions.yml b/.github/workflows/label-actions.yml
deleted file mode 100644
index c11dde1b..00000000
--- a/.github/workflows/label-actions.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-name: 'Label Actions'
-
-on:
- issues:
- types: [labeled, unlabeled]
-# pull_request:
-# types: [labeled, unlabeled]
-# discussion:
-# types: [labeled, unlabeled]
-
-permissions:
- contents: read
- issues: write
- pull-requests: write
- discussions: write
-
-jobs:
- action:
- runs-on: ubuntu-latest
- steps:
- - uses: dessant/label-actions@v2
diff --git a/.github/workflows/support.yml b/.github/workflows/support.yml
new file mode 100644
index 00000000..432ce5c0
--- /dev/null
+++ b/.github/workflows/support.yml
@@ -0,0 +1,30 @@
+name: 'Support requests'
+
+on:
+ issues:
+ types: [labeled, unlabeled, reopened]
+
+jobs:
+ support:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: dessant/support-requests@v4
+ with:
+ github-token: ${{ github.token }}
+ support-label: 'repro-required'
+ issue-comment: >
+ :wave: @{issue-author}, sorry you're having an issue. As the issue template explains, it's required that you provide a runnable example that reproduces your issue (see the [issue template](../blob/main/.github/ISSUE_TEMPLATE/custom.yaml)).
+
+ The reason is that a bug report is not actionable without a reproducer. Try to minimize the superfluous code and focus only on reproducing the bug.
+
+ Please create a new issue with this and the maintainer will do his best to review it!.
+ close-issue: true
+ lock-issue: true
+ - uses: dessant/support-requests@v4
+ with:
+ github-token: ${{ github.token }}
+ support-label: 'question'
+ issue-comment: >
+ :wave: @{issue-author}, please post your question to [discussions](https://github.com/react-native-documents/document-picker/discussions) instead.
+ close-issue: true
+ lock-issue: true
diff --git a/README.md b/README.md
index 6839042e..c080d588 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,9 @@
# react-native-documents
-A set of React Native modules for document picking and viewing.
+React Native modules for document picking and viewing.
-Read the docs at https://react-native-documents.github.io/
+If this is useful to you, [say thanks](https://github.com/sponsors/vonovak). Your support is greatly appreciated!
-If this is useful to you, consider [saying thanks](https://github.com/sponsors/vonovak). Your support is greatly appreciated!!!
+Read the docs at https://react-native-documents.github.io
+
+Ask questions and engage in discussions at https://github.com/react-native-documents/document-picker/discussions
diff --git a/docs/docs/doc-viewer-api/index.md b/docs/docs/doc-viewer-api/index.md
index e7354746..f854c72c 100644
--- a/docs/docs/doc-viewer-api/index.md
+++ b/docs/docs/doc-viewer-api/index.md
@@ -63,8 +63,41 @@ options for viewing a document
If you're trying to open a file that you have long-term permission to access, you should use the `bookmark` option (provided by the DocumentPicker module).
+## Variables
+
+### errorCodes
+
+> `const` **errorCodes**: `Readonly`\<\{`IN_PROGRESS`: `"ASYNC_OP_IN_PROGRESS"`;`OPERATION_CANCELED`: `"OPERATION_CANCELED"`;`UNABLE_TO_OPEN_FILE_TYPE`: `"UNABLE_TO_OPEN_FILE_TYPE"`; \}\>
+
+#### Type declaration
+
+| Name | Type |
+| ------ | ------ |
+| `IN_PROGRESS` | `"ASYNC_OP_IN_PROGRESS"` |
+| `OPERATION_CANCELED` | `"OPERATION_CANCELED"` |
+| `UNABLE_TO_OPEN_FILE_TYPE` | `"UNABLE_TO_OPEN_FILE_TYPE"` |
+
## Functions
+### isErrorWithCode()
+
+> **isErrorWithCode**(`error`: `any`): `error is NativeModuleError`
+
+TypeScript helper to check if an object has the `code` property.
+This is used to avoid `as` casting when you access the `code` property on errors returned by the module.
+
+#### Parameters
+
+| Parameter | Type |
+| ------ | ------ |
+| `error` | `any` |
+
+#### Returns
+
+`error is NativeModuleError`
+
+***
+
### viewDocument()
> **viewDocument**(`data`: [`ViewDocumentOptions`](index.md#viewdocumentoptions)): `Promise`\<`null`\>
diff --git a/docs/docs/install.mdx b/docs/docs/install.mdx
index 3c6282b3..d4c686d5 100644
--- a/docs/docs/install.mdx
+++ b/docs/docs/install.mdx
@@ -17,6 +17,8 @@ yarn add @react-native-documents/viewer
## Setting up
+The packages are designed to support last 3 stable versions of RN. However, they very likely work with RN 0.73 and up.
+
:::warning
The document picker package requires iOS 14 or later. If you use Expo, use Expo SDK >=52 or [Expo build properties](https://docs.expo.dev/versions/latest/sdk/build-properties/#example-appjson-with-config-plugin) to update the `deploymentTarget` to `14`.
@@ -27,7 +29,7 @@ In regular React Native projects, use RN >= 0.76 or update the [settings in Xcod
:::info
-These packages cannot be used in ["Expo Go"](https://docs.expo.dev/workflow/overview/#expo-go-an-optional-tool-for-learning) because they require custom native code.
+These packages cannot be used in ["Expo Go"](https://docs.expo.dev/workflow/overview/#expo-go-an-optional-tool-for-learning) because they include custom native code.
However, you can add custom native code to an Expo app through a [development build](https://docs.expo.dev/workflow/overview/#development-builds). That is the officially recommended approach for building Expo apps. See the commands below to do this.
@@ -46,6 +48,4 @@ expo run:android
Install the package and then run `pod install` from the ios directory. Then rebuild your project with Xcode.
-The packages support last 3 stable releases of RN, but very likely work with RN 0.73 and up.
-
If you're using the [New Architecture](https://reactnative.dev/docs/new-architecture-intro), it's strongly recommended to use the latest stable release of RN.
diff --git a/docs/docs/sponsor-only/intro.md b/docs/docs/sponsor-only/intro.md
index 4d4547dc..57a9f252 100644
--- a/docs/docs/sponsor-only/intro.md
+++ b/docs/docs/sponsor-only/intro.md
@@ -42,7 +42,7 @@ There's the improved (list of changes below) picker package (called `@react-nati
### Windows
-Windows is not supported at the moment. While there is Windows-related code in the public module, it's not maintained and probably does not work.
+Windows is not supported at the moment but you can try your luck [here](https://github.com/ClaudiuHBann/document-picker-windows). While there was Windows-related code in the public module, it was not maintained and probably does not work.
### How do I know it works?
diff --git a/docs/docs/sponsor-only/license.md b/docs/docs/sponsor-only/license.md
index fb830937..98306662 100644
--- a/docs/docs/sponsor-only/license.md
+++ b/docs/docs/sponsor-only/license.md
@@ -3,4 +3,6 @@ sidebar_position: 80
sidebar_label: License
---
-The module is licensed under MIT
+# License
+
+The module is licensed under MIT, giving you the ability to use all of it for free in your projects, allowing modifications to your liking.
diff --git a/docs/docs/sponsor-only/migration.md b/docs/docs/sponsor-only/migration.md
index cd9b447b..dc575cf4 100644
--- a/docs/docs/sponsor-only/migration.md
+++ b/docs/docs/sponsor-only/migration.md
@@ -22,6 +22,18 @@ becomes
import { ... } from '@react-native-documents/picker'
```
+Also, if you previously used a default import like this:
+
+```ts
+import DocumentPicker from 'react-native-document-picker'
+```
+
+you should update it to use named imports for the methods you need (such as `pick`, `keepLocalCopy`, etc):
+
+```ts
+import { pick, keepLocalCopy } from '@react-native-documents/picker'
+```
+
2. remove `pickSingle`
Replace `pickSingle` with `pick`:
diff --git a/docs/docs/sponsor-only/picker/directory-picker.mdx b/docs/docs/sponsor-only/picker/directory-picker.mdx
index 9b5db245..a2db2d76 100644
--- a/docs/docs/sponsor-only/picker/directory-picker.mdx
+++ b/docs/docs/sponsor-only/picker/directory-picker.mdx
@@ -2,7 +2,7 @@
sidebar_position: 6
---
-# Directory Picker
+# Directory picker
This module allows you to pick a directory from the file system. The chosen directory can then be used for file I/O operations.
diff --git a/docs/docs/sponsor-only/picker/integrating-on-android.mdx b/docs/docs/sponsor-only/picker/integrating-on-android.mdx
index 4dd49513..7e649192 100644
--- a/docs/docs/sponsor-only/picker/integrating-on-android.mdx
+++ b/docs/docs/sponsor-only/picker/integrating-on-android.mdx
@@ -2,7 +2,7 @@
sidebar_position: 10
---
-# Android Usage Notes
+# Android usage notes
:::tip
The TL;DR version is: the Open and Import modes on Android aren't too different in practice, and you can usually use either one, often combined with [`keepLocalCopy`](./keeping-local-copy.mdx).
diff --git a/docs/docs/sponsor-only/picker/keeping-local-copy.mdx b/docs/docs/sponsor-only/picker/keeping-local-copy.mdx
index a4934eea..f4db2a8d 100644
--- a/docs/docs/sponsor-only/picker/keeping-local-copy.mdx
+++ b/docs/docs/sponsor-only/picker/keeping-local-copy.mdx
@@ -62,7 +62,8 @@ return (
destination: 'documentDirectory',
})
if (copyResult.status === 'success') {
- // do something
+ // do something with the local copy:
+ console.log(copyResult.localUri)
}
} catch (err) {
// see error handling
diff --git a/docs/docs/sponsor-only/viewer.mdx b/docs/docs/sponsor-only/viewer.mdx
index aa6bb19c..53642282 100644
--- a/docs/docs/sponsor-only/viewer.mdx
+++ b/docs/docs/sponsor-only/viewer.mdx
@@ -40,7 +40,7 @@ return (
title="view the last imported file"
onPress={() => {
const uriToOpen = 'file:///path/to/your/file'
- viewDocument({ uri: uriToOpen }).catch(handleError)
+ viewDocument({ uri: uriToOpen, mimeType: 'some-mime' }).catch(handleError)
}}
/>
)
diff --git a/docs/docusaurus.config.ts b/docs/docusaurus.config.ts
index ca57176c..985e2db7 100644
--- a/docs/docusaurus.config.ts
+++ b/docs/docusaurus.config.ts
@@ -38,10 +38,6 @@ const config: Config = {
[
'classic',
{
- gtag: {
- trackingID: 'G-V1JZZG12TG',
- anonymizeIP: true,
- },
docs: {
sidebarPath: './sidebars.ts',
editUrl: 'https://github.com/react-native-documents/document-picker/edit/main/docs',
@@ -130,13 +126,16 @@ const config: Config = {
],
themeConfig: {
- // announcementBar: {
- // id: 'announcementBar',
- // content:
- // 'Bridgeless mode is now available in the premium module!',
- // isCloseable: true,
- // },
+ announcementBar: {
+ id: 'announcementBar',
+ content:
+ 'Find these packages useful? Say thanks by sponsoring the author on GitHub!',
+ // isCloseable: true,
+ },
// Replace with your project's social card
+ colorMode: {
+ respectPrefersColorScheme: true,
+ },
image: 'img/docusaurus-social-card.jpg',
navbar: {
title: 'RN Document picker & viewer',
@@ -154,12 +153,12 @@ const config: Config = {
{ to: 'docs/doc-picker-api', label: 'Picker API', position: 'left' },
{ to: 'docs/doc-viewer-api', label: 'Viewer API', position: 'left' },
{
- to: '/example',
+ to: 'https://github.com/react-native-documents/document-picker/tree/main/packages/example',
label: 'Example app',
- position: 'left',
+ position: 'right',
},
{
- href: '/github-repo',
+ href: 'https://github.com/react-native-documents/document-picker',
label: 'GitHub',
position: 'right',
},
diff --git a/docs/src/components/HomepageFeatures/index.tsx b/docs/src/components/HomepageFeatures/index.tsx
index a7129b6e..4e92841c 100644
--- a/docs/src/components/HomepageFeatures/index.tsx
+++ b/docs/src/components/HomepageFeatures/index.tsx
@@ -10,6 +10,13 @@ type FeatureItem = {
}
const FeatureList: FeatureItem[] = [
+ {
+ title: 'Open-source and free',
+ Svg: require('@site/static/img/undraw_docusaurus_tree.svg').default,
+ description: (
+ <>Support the project by contributing PRs on GitHub, or sponsor the author to say thanks!>
+ ),
+ },
{
title: 'Full-featured',
Svg: require('@site/static/img/undraw_docusaurus_react.svg').default,
@@ -30,16 +37,6 @@ const FeatureList: FeatureItem[] = [
>
),
},
- {
- title: 'Maintained',
- Svg: require('@site/static/img/undraw_docusaurus_tree.svg').default,
- description: (
- <>
- Support the project maintenance by sponsoring it on GitHub, or just sponsor the author to
- say thanks!
- >
- ),
- },
]
function Feature({ title, description }: FeatureItem) {
diff --git a/docs/src/css/custom.css b/docs/src/css/custom.css
index 3a5d06f5..6cf93026 100644
--- a/docs/src/css/custom.css
+++ b/docs/src/css/custom.css
@@ -105,16 +105,7 @@
div[class^='announcementBar'] {
font-size: 20px;
-
- --site-announcement-bar-stripe-color1: #e8d7ff;
- --site-announcement-bar-stripe-color2: #ffe9d1;
-
- background: repeating-linear-gradient(
- 35deg,
- var(--site-announcement-bar-stripe-color1),
- var(--site-announcement-bar-stripe-color1) 20px,
- var(--site-announcement-bar-stripe-color2) 10px,
- var(--site-announcement-bar-stripe-color2) 40px
- );
+ color: var(--ifm-navbar-link-color);
+ background-color: var(--ifm-navbar-background-color);
font-weight: bold;
}
diff --git a/docs/src/pages/example.md b/docs/src/pages/example.md
deleted file mode 100644
index 800e83dc..00000000
--- a/docs/src/pages/example.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# Examples
-
-Example app is available at https://github.com/react-native-documents/document-picker/tree/main/packages/example
diff --git a/docs/src/pages/github-repo.md b/docs/src/pages/github-repo.md
deleted file mode 100644
index 7f8c48e0..00000000
--- a/docs/src/pages/github-repo.md
+++ /dev/null
@@ -1,3 +0,0 @@
-### Github Repository
-
-The monorepo with sources for the document picker and viewer modules is accessible to sponsors at https://github.com/react-native-documents/document-picker
diff --git a/docs/yarn.lock b/docs/yarn.lock
index 4fc8dc4e..3bc1c7eb 100644
--- a/docs/yarn.lock
+++ b/docs/yarn.lock
@@ -217,7 +217,7 @@ __metadata:
languageName: node
linkType: hard
-"@babel/code-frame@npm:^7.25.9, @babel/code-frame@npm:^7.26.0":
+"@babel/code-frame@npm:^7.25.9, @babel/code-frame@npm:^7.26.0, @babel/code-frame@npm:^7.26.2":
version: 7.26.2
resolution: "@babel/code-frame@npm:7.26.2"
dependencies:
@@ -819,23 +819,13 @@ __metadata:
languageName: node
linkType: hard
-"@babel/helpers@npm:^7.24.6":
- version: 7.24.6
- resolution: "@babel/helpers@npm:7.24.6"
- dependencies:
- "@babel/template": "npm:^7.24.6"
- "@babel/types": "npm:^7.24.6"
- checksum: 10c0/e5b5c0919fd6fa56ae11c15a72962d8de0ac19db524849554af28cf08ac32f9ae5aee49a43146eb150f54418cefb8e890fa2b2f33d029434dc7777dbcdfd5bac
- languageName: node
- linkType: hard
-
-"@babel/helpers@npm:^7.26.0":
- version: 7.26.0
- resolution: "@babel/helpers@npm:7.26.0"
+"@babel/helpers@npm:^7.24.6, @babel/helpers@npm:^7.26.0":
+ version: 7.26.10
+ resolution: "@babel/helpers@npm:7.26.10"
dependencies:
- "@babel/template": "npm:^7.25.9"
- "@babel/types": "npm:^7.26.0"
- checksum: 10c0/343333cced6946fe46617690a1d0789346960910225ce359021a88a60a65bc0d791f0c5d240c0ed46cf8cc63b5fd7df52734ff14e43b9c32feae2b61b1647097
+ "@babel/template": "npm:^7.26.9"
+ "@babel/types": "npm:^7.26.10"
+ checksum: 10c0/f99e1836bcffce96db43158518bb4a24cf266820021f6461092a776cba2dc01d9fc8b1b90979d7643c5c2ab7facc438149064463a52dd528b21c6ab32509784f
languageName: node
linkType: hard
@@ -882,6 +872,17 @@ __metadata:
languageName: node
linkType: hard
+"@babel/parser@npm:^7.26.9":
+ version: 7.26.10
+ resolution: "@babel/parser@npm:7.26.10"
+ dependencies:
+ "@babel/types": "npm:^7.26.10"
+ bin:
+ parser: ./bin/babel-parser.js
+ checksum: 10c0/c47f5c0f63cd12a663e9dc94a635f9efbb5059d98086a92286d7764357c66bceba18ccbe79333e01e9be3bfb8caba34b3aaebfd8e62c3d5921c8cf907267be75
+ languageName: node
+ linkType: hard
+
"@babel/plugin-bugfix-firefox-class-in-computed-class-key@npm:^7.24.6":
version: 7.24.6
resolution: "@babel/plugin-bugfix-firefox-class-in-computed-class-key@npm:7.24.6"
@@ -2849,30 +2850,21 @@ __metadata:
linkType: hard
"@babel/runtime-corejs3@npm:^7.25.9":
- version: 7.26.0
- resolution: "@babel/runtime-corejs3@npm:7.26.0"
+ version: 7.26.10
+ resolution: "@babel/runtime-corejs3@npm:7.26.10"
dependencies:
core-js-pure: "npm:^3.30.2"
regenerator-runtime: "npm:^0.14.0"
- checksum: 10c0/921fa27c004cf2b92f0d49efc2006cfc1a72d2a35c7374da8ec88d8b63543963e6ef29d4820e068a7892a7d553dc2bac7208aef8fef30642bc843b63255b650b
- languageName: node
- linkType: hard
-
-"@babel/runtime@npm:^7.1.2, @babel/runtime@npm:^7.10.3, @babel/runtime@npm:^7.12.13, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.8.4":
- version: 7.24.0
- resolution: "@babel/runtime@npm:7.24.0"
- dependencies:
- regenerator-runtime: "npm:^0.14.0"
- checksum: 10c0/3495eed727bf4a4f84c35bb51ab53317ae38f4bbc3b1d0a8303751f9dfa0ce6f5fb2afced72b76c3dd0d8bb2ccb84787559a4dee9886291a36b26f02f0f759b4
+ checksum: 10c0/897b61d84809d6e63e08566d436cd08a3a78f218283641bb53533948d4bcd5524c6a1f83613e20485cf7fa8d054da20dd9039d17e06c92cf282f25d4d4f57250
languageName: node
linkType: hard
-"@babel/runtime@npm:^7.25.9":
- version: 7.26.0
- resolution: "@babel/runtime@npm:7.26.0"
+"@babel/runtime@npm:^7.1.2, @babel/runtime@npm:^7.10.3, @babel/runtime@npm:^7.12.13, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.25.9, @babel/runtime@npm:^7.8.4":
+ version: 7.26.10
+ resolution: "@babel/runtime@npm:7.26.10"
dependencies:
regenerator-runtime: "npm:^0.14.0"
- checksum: 10c0/12c01357e0345f89f4f7e8c0e81921f2a3e3e101f06e8eaa18a382b517376520cd2fa8c237726eb094dab25532855df28a7baaf1c26342b52782f6936b07c287
+ checksum: 10c0/6dc6d88c7908f505c4f7770fb4677dfa61f68f659b943c2be1f2a99cb6680343462867abf2d49822adc435932919b36c77ac60125793e719ea8745f2073d3745
languageName: node
linkType: hard
@@ -2898,6 +2890,17 @@ __metadata:
languageName: node
linkType: hard
+"@babel/template@npm:^7.26.9":
+ version: 7.26.9
+ resolution: "@babel/template@npm:7.26.9"
+ dependencies:
+ "@babel/code-frame": "npm:^7.26.2"
+ "@babel/parser": "npm:^7.26.9"
+ "@babel/types": "npm:^7.26.9"
+ checksum: 10c0/019b1c4129cc01ad63e17529089c2c559c74709d225f595eee017af227fee11ae8a97a6ab19ae6768b8aa22d8d75dcb60a00b28f52e9fa78140672d928bc1ae9
+ languageName: node
+ linkType: hard
+
"@babel/traverse@npm:^7.24.6":
version: 7.24.6
resolution: "@babel/traverse@npm:7.24.6"
@@ -2963,6 +2966,16 @@ __metadata:
languageName: node
linkType: hard
+"@babel/types@npm:^7.26.10, @babel/types@npm:^7.26.9":
+ version: 7.26.10
+ resolution: "@babel/types@npm:7.26.10"
+ dependencies:
+ "@babel/helper-string-parser": "npm:^7.25.9"
+ "@babel/helper-validator-identifier": "npm:^7.25.9"
+ checksum: 10c0/7a7f83f568bfc3dfabfaf9ae3a97ab5c061726c0afa7dcd94226d4f84a81559da368ed79671e3a8039d16f12476cf110381a377ebdea07587925f69628200dac
+ languageName: node
+ linkType: hard
+
"@colors/colors@npm:1.5.0":
version: 1.5.0
resolution: "@colors/colors@npm:1.5.0"
@@ -9295,13 +9308,13 @@ __metadata:
linkType: hard
"image-size@npm:^1.0.2":
- version: 1.1.1
- resolution: "image-size@npm:1.1.1"
+ version: 1.2.1
+ resolution: "image-size@npm:1.2.1"
dependencies:
queue: "npm:6.0.2"
bin:
image-size: bin/image-size.js
- checksum: 10c0/2660470096d12be82195f7e80fe03274689fbd14184afb78eaf66ade7cd06352518325814f88af4bde4b26647889fe49e573129f6e7ba8f5ff5b85cc7f559000
+ checksum: 10c0/f8b3c19d4476513f1d7e55c3e6db80997b315444743e2040d545cbcaee59be03d2eb40c46be949a8372697b7003fdb0c04925d704390a7f606bc8181e25c0ed4
languageName: node
linkType: hard
@@ -12856,9 +12869,9 @@ __metadata:
linkType: hard
"prismjs@npm:^1.29.0":
- version: 1.29.0
- resolution: "prismjs@npm:1.29.0"
- checksum: 10c0/d906c4c4d01b446db549b4f57f72d5d7e6ccaca04ecc670fb85cea4d4b1acc1283e945a9cbc3d81819084a699b382f970e02f9d1378e14af9808d366d9ed7ec6
+ version: 1.30.0
+ resolution: "prismjs@npm:1.30.0"
+ checksum: 10c0/f56205bfd58ef71ccfcbcb691fd0eb84adc96c6ff21b0b69fc6fdcf02be42d6ef972ba4aed60466310de3d67733f6a746f89f2fb79c00bf217406d465b3e8f23
languageName: node
linkType: hard
@@ -14597,14 +14610,14 @@ __metadata:
linkType: hard
"tar-fs@npm:^2.0.0":
- version: 2.1.1
- resolution: "tar-fs@npm:2.1.1"
+ version: 2.1.2
+ resolution: "tar-fs@npm:2.1.2"
dependencies:
chownr: "npm:^1.1.1"
mkdirp-classic: "npm:^0.5.2"
pump: "npm:^3.0.0"
tar-stream: "npm:^2.1.4"
- checksum: 10c0/871d26a934bfb7beeae4c4d8a09689f530b565f79bd0cf489823ff0efa3705da01278160da10bb006d1a793fa0425cf316cec029b32a9159eacbeaff4965fb6d
+ checksum: 10c0/9c704bd4a53be7565caf34ed001d1428532457fe3546d8fc1233f0f0882c3d2403f8602e8046e0b0adeb31fe95336572a69fb28851a391523126b697537670fc
languageName: node
linkType: hard
diff --git a/package.json b/package.json
index 93300bf0..6518baf7 100644
--- a/package.json
+++ b/package.json
@@ -26,7 +26,7 @@
"icloud"
],
"author": "Vojtech Novak (hello@react-native-training.eu)",
- "license": "see LICENSE file",
+ "license": "MIT",
"bugs": {
"url": "https://github.com/react-native-documents/document-picker/issues"
},
diff --git a/packages/document-picker/CHANGELOG.md b/packages/document-picker/CHANGELOG.md
index 94d36fea..b8e0f81f 100644
--- a/packages/document-picker/CHANGELOG.md
+++ b/packages/document-picker/CHANGELOG.md
@@ -1,5 +1,35 @@
# @react-native-documents/picker
+## 10.1.5
+
+### Patch Changes
+
+- 4ddab03: refactor(ios): simplify file moves
+
+## 10.1.4
+
+### Patch Changes
+
+- 4b2b80e: refactor: copy streams differently
+
+## 10.1.3
+
+### Patch Changes
+
+- c7166b1: fix(android): correct long term access directory picker response
+
+## 10.1.2
+
+### Patch Changes
+
+- 8cd6dc5: fix(android): invalid column flags error in picker
+
+## 10.1.1
+
+### Patch Changes
+
+- 62794a6: fix: enable ios build with use_frameworks static
+
## 10.1.0
### Minor Changes
diff --git a/packages/document-picker/android/src/main/java/com/reactnativedocumentpicker/FileOperations.kt b/packages/document-picker/android/src/main/java/com/reactnativedocumentpicker/FileOperations.kt
index 5b9691ce..7e1f98b0 100644
--- a/packages/document-picker/android/src/main/java/com/reactnativedocumentpicker/FileOperations.kt
+++ b/packages/document-picker/android/src/main/java/com/reactnativedocumentpicker/FileOperations.kt
@@ -3,6 +3,8 @@ package com.reactnativedocumentpicker
import android.content.ContentResolver
import android.content.Context
import android.net.Uri
+import android.os.Build
+import android.os.FileUtils
import com.facebook.react.bridge.Arguments
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.bridge.ReactContext
@@ -18,7 +20,7 @@ import java.io.FileNotFoundException
import java.io.FileOutputStream
import java.io.IOException
import java.io.InputStream
-import java.nio.channels.Channels
+import java.io.OutputStream
import java.util.UUID
class FileOperations(private val uriMap: MutableMap) {
@@ -119,23 +121,17 @@ class FileOperations(private val uriMap: MutableMap) {
val destFileSafe = safeGetDestination(attemptedDestFile, destinationDir)
val copyStreamToFile: (InputStream?) -> Unit = { inputStream ->
- if (inputStream == null) {
- throw FileNotFoundException("No input stream was found for the source file")
- }
- FileOutputStream(destFileSafe).channel.use { destinationFileChannel ->
- val inputChannel = Channels.newChannel(inputStream)
- val size = destinationFileChannel.transferFrom(inputChannel, 0, Long.MAX_VALUE)
- if (size == 0L) {
- throw IOException("No data was copied to the destination file")
- }
+ inputStream ?: throw FileNotFoundException("No input stream was found for the source file")
+ val bytesCopied = copyStreamToAnother(inputStream, FileOutputStream(destFileSafe))
+ if (bytesCopied == 0L) {
+ throw IOException("No data was copied to the destination file")
}
}
if (convertVirtualFileAsType == null) {
- context.contentResolver.openInputStream(from).use(copyStreamToFile)
+ copyStreamToFile(context.contentResolver.openInputStream(from))
} else {
- getInputStreamForVirtualFile(context.contentResolver, from, convertVirtualFileAsType)
- .use(copyStreamToFile)
+ copyStreamToFile(getInputStreamForVirtualFile(context.contentResolver, from, convertVirtualFileAsType))
}
return destFileSafe
@@ -161,9 +157,7 @@ class FileOperations(private val uriMap: MutableMap) {
}
fun writeDocumentImpl(sourceUri: Uri?, targetUriString: String?, context: ReactApplicationContext): DocumentMetadataBuilder {
- if (sourceUri == null) {
- throw IllegalArgumentException("The source URI is null. Call saveDocument() before writeDocument()")
- }
+ sourceUri ?: throw IllegalArgumentException("The source URI is null. Call saveDocument() before writeDocument()")
val targetUri: Uri? = uriMap[targetUriString]
if (targetUri == null) {
@@ -180,25 +174,30 @@ class FileOperations(private val uriMap: MutableMap) {
val mimeFromUri = contentResolver.getType(targetUri)
metadataBuilder.mimeType(mimeFromUri)
- // TODO https://gist.github.com/vonovak/73affb1a5b904ee165d9b5981d8dfe9a
- contentResolver.openInputStream(sourceUri).use { inputStream ->
- if (inputStream == null) {
- metadataBuilder.metadataReadingError("No output stream found for source file")
- } else {
- contentResolver.openOutputStream(targetUri).use { outputStream ->
- if (outputStream == null) {
- metadataBuilder.metadataReadingError("No output stream found for destination file")
- } else {
- val bytesCopied = inputStream.copyTo(outputStream)
- if (bytesCopied == 0L) {
- metadataBuilder.metadataReadingError("No data was copied to the destination file")
- }
- outputStream.flush()
- }
- }
- }
+ val inputStream = contentResolver.openInputStream(sourceUri)
+ ?: return metadataBuilder.metadataReadingError("No input stream found for source file")
+
+ val outputStream = contentResolver.openOutputStream(targetUri)
+ ?: return metadataBuilder.metadataReadingError("No output stream found for destination file")
+
+ val bytesCopied = copyStreamToAnother(inputStream, outputStream)
+ if (bytesCopied == 0L) {
+ metadataBuilder.metadataReadingError("No data was copied to the destination file")
}
return metadataBuilder
}
+
+ val copyStreamToAnother: (InputStream, OutputStream) -> Long = { inputStream, outputStream ->
+ inputStream.use { input ->
+ outputStream.use { output ->
+ val bytesCopied = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
+ FileUtils.copy(inputStream, outputStream)
+ } else {
+ inputStream.copyTo(outputStream)
+ }
+ return@use bytesCopied
+ }
+ }
+ }
}
diff --git a/packages/document-picker/android/src/main/java/com/reactnativedocumentpicker/MetadataGetter.kt b/packages/document-picker/android/src/main/java/com/reactnativedocumentpicker/MetadataGetter.kt
index 36bc2de9..1e26a984 100644
--- a/packages/document-picker/android/src/main/java/com/reactnativedocumentpicker/MetadataGetter.kt
+++ b/packages/document-picker/android/src/main/java/com/reactnativedocumentpicker/MetadataGetter.kt
@@ -65,7 +65,8 @@ class MetadataGetter(private val uriMap: MutableMap) {
}
}
- queryContentResolverMetadata(contentResolver, metadataBuilder, context)
+ val couldBeVirtualFile = pickOptions.allowVirtualFiles && DocumentsContract.isDocumentUri(context, sourceUri)
+ queryContentResolverMetadata(contentResolver, metadataBuilder, couldBeVirtualFile)
metadataBuilder
}
@@ -73,18 +74,24 @@ class MetadataGetter(private val uriMap: MutableMap) {
fun queryContentResolverMetadata(
contentResolver: ContentResolver,
metadataBuilder: DocumentMetadataBuilder,
- context: Context
+ couldBeVirtualFile: Boolean
) {
val forUri = metadataBuilder.getUri()
+
+ val projection = mutableListOf(
+ DocumentsContract.Document.COLUMN_MIME_TYPE,
+ OpenableColumns.DISPLAY_NAME,
+ OpenableColumns.SIZE,
+ ).apply {
+ if (couldBeVirtualFile) {
+ add(DocumentsContract.Document.COLUMN_FLAGS)
+ }
+ }.toTypedArray()
+
contentResolver
.query(
forUri,
- arrayOf(
- DocumentsContract.Document.COLUMN_MIME_TYPE,
- OpenableColumns.DISPLAY_NAME,
- OpenableColumns.SIZE,
- DocumentsContract.Document.COLUMN_FLAGS,
- ),
+ projection,
null,
null,
null
@@ -106,7 +113,7 @@ class MetadataGetter(private val uriMap: MutableMap) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
// https://developer.android.com/training/data-storage/shared/documents-files#open-virtual-file
val isVirtual =
- if (DocumentsContract.isDocumentUri(context, forUri)) {
+ if (couldBeVirtualFile) {
val cursorValue: Int =
getCursorValue(
cursor, DocumentsContract.Document.COLUMN_FLAGS, Int::class.java
diff --git a/packages/document-picker/android/src/main/java/com/reactnativedocumentpicker/RNDocumentPickerModule.kt b/packages/document-picker/android/src/main/java/com/reactnativedocumentpicker/RNDocumentPickerModule.kt
index 8fdfbecc..e79951c2 100644
--- a/packages/document-picker/android/src/main/java/com/reactnativedocumentpicker/RNDocumentPickerModule.kt
+++ b/packages/document-picker/android/src/main/java/com/reactnativedocumentpicker/RNDocumentPickerModule.kt
@@ -254,12 +254,12 @@ class RNDocumentPickerModule(reactContext: ReactApplicationContext) :
reactApplicationContext.contentResolver.takePersistableUriPermission(uri, takeFlags)
val encodedBookmark =
Base64.encodeToString(uri.toString().toByteArray(Charsets.UTF_8), Base64.DEFAULT)
- map.putString("status", "success")
+ map.putString("bookmarkStatus", "success")
map.putString("bookmark", encodedBookmark)
} catch (e: Exception) {
val error =
e.localizedMessage ?: e.message ?: "Unknown error with takePersistableUriPermission"
- map.putString("status", "error")
+ map.putString("bookmarkStatus", "error")
map.putString("bookmarkError", error)
}
}
@@ -272,7 +272,7 @@ class RNDocumentPickerModule(reactContext: ReactApplicationContext) :
val targetUriString = if (options.hasKey("uri")) options.getString("uri") else null
val metadataBuilder = fileOps.writeDocumentImpl(currentUriOfFileBeingExported, targetUriString, reactApplicationContext)
- metadataGetter.queryContentResolverMetadata(reactApplicationContext.contentResolver, metadataBuilder, reactApplicationContext)
+ metadataGetter.queryContentResolverMetadata(reactApplicationContext.contentResolver, metadataBuilder, couldBeVirtualFile = false)
val arrayWithSingleResult = Arguments.createArray().apply {
val resultMap = metadataBuilder.build()
diff --git a/packages/document-picker/ios/RNDocumentPicker.mm b/packages/document-picker/ios/RNDocumentPicker.mm
index b2eb00b1..d787525a 100644
--- a/packages/document-picker/ios/RNDocumentPicker.mm
+++ b/packages/document-picker/ios/RNDocumentPicker.mm
@@ -6,7 +6,14 @@
#import "RCTConvert+RNDocumentPicker.h"
// this header file is generated by Xcode: https://developer.apple.com/documentation/swift/importing-swift-into-objective-c
// if it cannot be found, try cleaning the build folder and Xcode derived data folder
+
+// When using use_frameworks! :linkage => :static in Podfile
+#if __has_include()
+#import
+#else
#import "react_native_document_picker-Swift.h"
+#endif
+
// for UIModalPresentationStyle conversion
// remove after https://github.com/facebook/react-native/commit/2d547a3252b328251e49dabfeec85f8d46c85411 is released
#import
diff --git a/packages/document-picker/ios/swift/DocPicker.swift b/packages/document-picker/ios/swift/DocPicker.swift
index 33fa0882..1964b191 100644
--- a/packages/document-picker/ios/swift/DocPicker.swift
+++ b/packages/document-picker/ios/swift/DocPicker.swift
@@ -28,10 +28,10 @@ import MobileCoreServices
}
public func getMetadataFor(url: URL) throws -> DocumentMetadataBuilder {
- if (currentOptions?.isOpenMode() == true) {
- return try self.getOpenedDocumentInfo(url: url, requestLongTermAccess: currentOptions?.requestLongTermAccess ?? false)
+ return if (currentOptions?.isOpenMode() == true) {
+ try self.getOpenedDocumentInfo(url: url, requestLongTermAccess: currentOptions?.requestLongTermAccess ?? false)
} else {
- return try self.getAnyModeMetadata(url: url)
+ try self.getAnyModeMetadata(url: url)
}
}
diff --git a/packages/document-picker/ios/swift/FileOperations.swift b/packages/document-picker/ios/swift/FileOperations.swift
index 67d453ba..6f1682ff 100644
--- a/packages/document-picker/ios/swift/FileOperations.swift
+++ b/packages/document-picker/ios/swift/FileOperations.swift
@@ -4,45 +4,47 @@ import Foundation
@objc public class FileOperations: NSObject {
- @objc public static func keepLocalCopyAtUniqueDestination(from: Array>, destinationPreset: String, resolve: @escaping RNDPPromiseResolveBlock) {
- Task {
- let results = await moveFiles(from: from, destinationPreset: destinationPreset)
+ @objc public static func keepLocalCopyAtUniqueDestination(from: [[String: String]], destinationPreset: String, resolve: @escaping RNDPPromiseResolveBlock) {
+ DispatchQueue.global(qos: .utility).async {
+ let results = moveFiles(from: from, destinationPreset: destinationPreset)
resolve(results)
}
}
- static func moveFiles(from: Array>, destinationPreset: String) async -> [[String: String?]] {
+ static func moveFiles(from: [[String: String]], destinationPreset: String) -> [[String: String?]] {
let destinationRootDir = getDirectoryForFileDestination(destinationPreset)
let uniqueSubDirName = UUID().uuidString
- let destinationDir: URL = destinationRootDir.appendingPathComponent("\(uniqueSubDirName)/", isDirectory: true)
- // TODO do we need all of this Task dance?
+ let destinationDir = destinationRootDir.appendingPathComponent(uniqueSubDirName, isDirectory: true)
- return await withTaskGroup(of: LocalCopyResponse.self) { group in
- var results: Array> = [[String: String?]]()
-
- for dictionary in from {
- group.addTask {
- do {
- guard let uriString = dictionary["uri"], let uri = URL(string: uriString) else {
- return LocalCopyResponse.error(sourceUri: dictionary["uri"], copyError: "Invalid URI")
- }
- guard let fileName = dictionary["fileName"] else {
- return LocalCopyResponse.error(sourceUri: uri.absoluteString, copyError: "Invalid fileName")
- }
-
- let destinationUrl = try moveToDestination(from: uri, usingFilename: fileName, destinationDir: destinationDir)
- return LocalCopyResponse.success(sourceUri: uri.absoluteString, localUri: destinationUrl.absoluteString)
- } catch {
- return LocalCopyResponse.error(sourceUri: dictionary["uri"]!, copyError: error.localizedDescription)
- }
- }
+ do {
+ try FileManager.default.createDirectory(at: destinationDir, withIntermediateDirectories: true, attributes: nil)
+ } catch {
+ return from.map { dictionary in
+ LocalCopyResponse.error(sourceUri: dictionary["uri"], copyError: "Failed to create destination directory: \(error.localizedDescription)").dictionaryRepresentation
}
-
- for await result in group {
- results.append(result.dictionaryRepresentation)
- }
-
- return results
+ }
+
+ // move files
+ return from.map { dictionary in
+ moveSingleFile(dictionary: dictionary, destinationDir: destinationDir).dictionaryRepresentation
+ }
+ }
+
+ private static func moveSingleFile(dictionary: [String: String], destinationDir: URL) -> LocalCopyResponse {
+ guard let uriString = dictionary["uri"],
+ let uri = URL(string: uriString),
+ let fileName = dictionary["fileName"] else {
+ return LocalCopyResponse.error(
+ sourceUri: dictionary["uri"],
+ copyError: "Invalid URI or fileName"
+ )
+ }
+
+ do {
+ let destinationUrl = try moveToDestination(from: uri, usingFilename: fileName, destinationDir: destinationDir)
+ return LocalCopyResponse.success(sourceUri: uri.absoluteString, localUri: destinationUrl.absoluteString)
+ } catch {
+ return LocalCopyResponse.error(sourceUri: uriString, copyError: error.localizedDescription)
}
}
@@ -50,19 +52,20 @@ import Foundation
let destinationFile = destinationDir.appendingPathComponent(fileName).standardized
guard destinationFile.path.hasPrefix(destinationDir.standardized.path) else {
- throw NSError(domain: "PathTraversalPrevention", code: 400, userInfo: [NSLocalizedDescriptionKey: "The copied file is attempting to write outside of the target directory."])
+ throw NSError(
+ domain: "PathTraversalPrevention",
+ code: 400,
+ userInfo: [NSLocalizedDescriptionKey: "The copied file is attempting to write outside of the target directory."]
+ )
}
- try FileManager.default.createDirectory(at: destinationDir, withIntermediateDirectories: true, attributes: nil)
try FileManager.default.moveItem(at: from, to: destinationFile)
return destinationFile
}
static func getDirectoryForFileDestination(_ copyToDirectory: String) -> URL {
- if copyToDirectory == "documentDirectory" {
- return FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
- }
- return FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).first!
+ let searchPath: FileManager.SearchPathDirectory = copyToDirectory == "documentDirectory" ? .documentDirectory : .cachesDirectory
+ return FileManager.default.urls(for: searchPath, in: .userDomainMask).first!
}
}
diff --git a/packages/document-picker/ios/swift/IsKnownTypeImpl.swift b/packages/document-picker/ios/swift/IsKnownTypeImpl.swift
index 703bb878..871525c4 100644
--- a/packages/document-picker/ios/swift/IsKnownTypeImpl.swift
+++ b/packages/document-picker/ios/swift/IsKnownTypeImpl.swift
@@ -28,14 +28,10 @@ import UniformTypeIdentifiers
static func createUTType(kind: String, value: String) -> UTType? {
switch kind {
- case "UTType":
- return UTType(value)
- case "mimeType":
- return UTType(mimeType: value)
- case "extension":
- return UTType(filenameExtension: value)
- default:
- return nil
+ case "UTType": UTType(value)
+ case "mimeType": UTType(mimeType: value)
+ case "extension": UTType(filenameExtension: value)
+ default: nil
}
}
}
diff --git a/packages/document-picker/package.json b/packages/document-picker/package.json
index 036cfe06..027e565f 100644
--- a/packages/document-picker/package.json
+++ b/packages/document-picker/package.json
@@ -1,6 +1,6 @@
{
"name": "@react-native-documents/picker",
- "version": "10.1.0",
+ "version": "10.1.5",
"description": "A react native interface to access documents from dropbox, google drive, iCloud...",
"main": "lib/commonjs/index",
"module": "lib/module/index",
@@ -50,7 +50,7 @@
"url": "git+https://github.com/react-native-documents/document-picker.git"
},
"author": "Vojtech Novak (hello@react-native-training.eu)",
- "license": "see LICENSE file",
+ "license": "MIT",
"bugs": {
"url": "https://github.com/react-native-documents/document-picker/issues"
},
diff --git a/packages/document-picker/react-native-document-picker.podspec b/packages/document-picker/react-native-document-picker.podspec
index 56d85fe7..71c131e6 100644
--- a/packages/document-picker/react-native-document-picker.podspec
+++ b/packages/document-picker/react-native-document-picker.podspec
@@ -21,10 +21,5 @@ Pod::Spec.new do |s|
'DEFINES_MODULE' => 'YES',
}
- if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
- # RN 71+
- install_modules_dependencies(s)
- else
- s.dependency "React-Core"
- end
+ install_modules_dependencies(s)
end
diff --git a/packages/document-viewer/CHANGELOG.md b/packages/document-viewer/CHANGELOG.md
index 643780e0..05446f18 100644
--- a/packages/document-viewer/CHANGELOG.md
+++ b/packages/document-viewer/CHANGELOG.md
@@ -1,5 +1,11 @@
# @react-native-documents/viewer
+## 1.0.1
+
+### Patch Changes
+
+- 8a8cdfb: export `errorCodes`, `isErrorWithCode` from viewer module
+
## 1.0.0
### Major Changes
diff --git a/packages/document-viewer/jest/setup.ts b/packages/document-viewer/jest/setup.ts
index 27097cab..6061e545 100644
--- a/packages/document-viewer/jest/setup.ts
+++ b/packages/document-viewer/jest/setup.ts
@@ -1,7 +1,10 @@
type ExportedModuleType = typeof import('../src/index')
+import { errorCodes, isErrorWithCode } from '../src'
const mockModule: ExportedModuleType = Object.freeze({
viewDocument: jest.fn().mockResolvedValue(null),
+ errorCodes,
+ isErrorWithCode,
})
jest.mock('@react-native-documents/viewer', () => {
diff --git a/packages/document-viewer/package.json b/packages/document-viewer/package.json
index bf66d5ee..76094b0a 100644
--- a/packages/document-viewer/package.json
+++ b/packages/document-viewer/package.json
@@ -1,6 +1,6 @@
{
"name": "@react-native-documents/viewer",
- "version": "1.0.0",
+ "version": "1.0.1",
"description": "A react native interface to preview documents",
"main": "lib/commonjs/index",
"module": "lib/module/index",
@@ -48,7 +48,7 @@
"url": "git+https://github.com/react-native-documents/document-picker.git"
},
"author": "Vojtech Novak (hello@react-native-training.eu)",
- "license": "see LICENSE file",
+ "license": "MIT",
"bugs": {
"url": "https://github.com/react-native-documents/document-picker/issues"
},
diff --git a/packages/document-viewer/react-native-document-viewer.podspec b/packages/document-viewer/react-native-document-viewer.podspec
index 1dc24de3..3bb5fbd0 100644
--- a/packages/document-viewer/react-native-document-viewer.podspec
+++ b/packages/document-viewer/react-native-document-viewer.podspec
@@ -16,10 +16,5 @@ Pod::Spec.new do |s|
s.source_files = ["ios/**/*.{h,m,mm}"]
- if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
- # RN 71+
- install_modules_dependencies(s)
- else
- s.dependency "React-Core"
- end
+ install_modules_dependencies(s)
end
diff --git a/packages/document-viewer/src/index.ts b/packages/document-viewer/src/index.ts
index 5cc99219..e69384e1 100644
--- a/packages/document-viewer/src/index.ts
+++ b/packages/document-viewer/src/index.ts
@@ -77,3 +77,4 @@ export function viewDocument(data: ViewDocumentOptions): Promise {
data?.presentationStyle,
)
}
+export { errorCodes, isErrorWithCode } from './errors'
diff --git a/packages/example/ios/Podfile.lock b/packages/example/ios/Podfile.lock
index da1716b9..1a045e7c 100644
--- a/packages/example/ios/Podfile.lock
+++ b/packages/example/ios/Podfile.lock
@@ -1210,7 +1210,7 @@ PODS:
- React-jsiexecutor
- React-RCTFBReactNativeSpec
- ReactCommon/turbomodule/core
- - react-native-document-picker (10.0.1):
+ - react-native-document-picker (10.1.0):
- DoubleConversion
- glog
- hermes-engine
@@ -1885,7 +1885,7 @@ SPEC CHECKSUMS:
React-logger: 02e5802824aa9b15cb7df42e10a91abead83cd8d
React-Mapbuffer: 99bd566147aaa78e872568be53ebca8a4449ddae
React-microtasksnativemodule: 51e7813abf875408a0f367e473a65bbab6aa8481
- react-native-document-picker: 00f3dedbea5b81e9e5d810720d0ed9ff40e3f687
+ react-native-document-picker: d566165412d4913ff83e611c6ba51cebaa05cd79
react-native-document-viewer: e72376e1efe598380803ef661c33e3b3a3c0e3b0
react-native-segmented-control: bf6e0032726727498e18dd437ae88afcdbc18e99
react-native-uitextview: d30631440c99dde5210691267bdaf5480a080ffe
diff --git a/packages/example/package.json b/packages/example/package.json
index 49fbf338..fce2213a 100644
--- a/packages/example/package.json
+++ b/packages/example/package.json
@@ -22,7 +22,7 @@
"private": true,
"repository": "https://github.com/react-native-documents/sponsors-only",
"author": "Vojtech Novak (hello@react-native-training.eu)",
- "license": "see LICENSE file",
+ "license": "MIT",
"bugs": {
"url": "https://github.com/react-native-documents/sponsors-only/issues"
},
diff --git a/patches/react-native-test-app+3.2.0.patch b/patches/react-native-test-app+3.2.0.patch
deleted file mode 100644
index 88e1e356..00000000
--- a/patches/react-native-test-app+3.2.0.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/node_modules/react-native-test-app/ios/ReactTestApp/ReactTestApp.common.xcconfig b/node_modules/react-native-test-app/ios/ReactTestApp/ReactTestApp.common.xcconfig
-index af946f2..df0099b 100644
---- a/node_modules/react-native-test-app/ios/ReactTestApp/ReactTestApp.common.xcconfig
-+++ b/node_modules/react-native-test-app/ios/ReactTestApp/ReactTestApp.common.xcconfig
-@@ -11,7 +11,7 @@ ENABLE_STRICT_OBJC_MSGSEND = YES
- GCC_C_LANGUAGE_STANDARD = gnu11
- GCC_NO_COMMON_BLOCKS = YES
- GCC_TREAT_WARNINGS_AS_ERRORS = YES
--IPHONEOS_DEPLOYMENT_TARGET = 13.7
-+IPHONEOS_DEPLOYMENT_TARGET = 14.0
- MTL_FAST_MATH = YES
- OTHER_CFLAGS = $(inherited) -fstack-protector-strong
- OTHER_LDFLAGS = $(inherited) -fstack-protector-strong
diff --git a/yarn.lock b/yarn.lock
index b51c22cf..e676453a 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -530,23 +530,13 @@ __metadata:
languageName: node
linkType: hard
-"@babel/helpers@npm:^7.26.0":
- version: 7.26.0
- resolution: "@babel/helpers@npm:7.26.0"
+"@babel/helpers@npm:^7.26.0, @babel/helpers@npm:^7.26.7":
+ version: 7.26.10
+ resolution: "@babel/helpers@npm:7.26.10"
dependencies:
- "@babel/template": "npm:^7.25.9"
- "@babel/types": "npm:^7.26.0"
- checksum: 10c0/343333cced6946fe46617690a1d0789346960910225ce359021a88a60a65bc0d791f0c5d240c0ed46cf8cc63b5fd7df52734ff14e43b9c32feae2b61b1647097
- languageName: node
- linkType: hard
-
-"@babel/helpers@npm:^7.26.7":
- version: 7.26.7
- resolution: "@babel/helpers@npm:7.26.7"
- dependencies:
- "@babel/template": "npm:^7.25.9"
- "@babel/types": "npm:^7.26.7"
- checksum: 10c0/37fec398e53a2dbbf24bc2a025c4d571b2556cef18d8116d05d04b153f13ef659cdfbaab96c8eed875e629d39bdf9b3ea5d099ccf80544537de224e2d94f9b11
+ "@babel/template": "npm:^7.26.9"
+ "@babel/types": "npm:^7.26.10"
+ checksum: 10c0/f99e1836bcffce96db43158518bb4a24cf266820021f6461092a776cba2dc01d9fc8b1b90979d7643c5c2ab7facc438149064463a52dd528b21c6ab32509784f
languageName: node
linkType: hard
@@ -572,6 +562,17 @@ __metadata:
languageName: node
linkType: hard
+"@babel/parser@npm:^7.26.9":
+ version: 7.26.10
+ resolution: "@babel/parser@npm:7.26.10"
+ dependencies:
+ "@babel/types": "npm:^7.26.10"
+ bin:
+ parser: ./bin/babel-parser.js
+ checksum: 10c0/c47f5c0f63cd12a663e9dc94a635f9efbb5059d98086a92286d7764357c66bceba18ccbe79333e01e9be3bfb8caba34b3aaebfd8e62c3d5921c8cf907267be75
+ languageName: node
+ linkType: hard
+
"@babel/plugin-bugfix-firefox-class-in-computed-class-key@npm:^7.25.9":
version: 7.25.9
resolution: "@babel/plugin-bugfix-firefox-class-in-computed-class-key@npm:7.25.9"
@@ -1772,11 +1773,11 @@ __metadata:
linkType: hard
"@babel/runtime@npm:^7.25.0, @babel/runtime@npm:^7.5.5, @babel/runtime@npm:^7.8.4":
- version: 7.26.0
- resolution: "@babel/runtime@npm:7.26.0"
+ version: 7.26.10
+ resolution: "@babel/runtime@npm:7.26.10"
dependencies:
regenerator-runtime: "npm:^0.14.0"
- checksum: 10c0/12c01357e0345f89f4f7e8c0e81921f2a3e3e101f06e8eaa18a382b517376520cd2fa8c237726eb094dab25532855df28a7baaf1c26342b52782f6936b07c287
+ checksum: 10c0/6dc6d88c7908f505c4f7770fb4677dfa61f68f659b943c2be1f2a99cb6680343462867abf2d49822adc435932919b36c77ac60125793e719ea8745f2073d3745
languageName: node
linkType: hard
@@ -1791,6 +1792,17 @@ __metadata:
languageName: node
linkType: hard
+"@babel/template@npm:^7.26.9":
+ version: 7.26.9
+ resolution: "@babel/template@npm:7.26.9"
+ dependencies:
+ "@babel/code-frame": "npm:^7.26.2"
+ "@babel/parser": "npm:^7.26.9"
+ "@babel/types": "npm:^7.26.9"
+ checksum: 10c0/019b1c4129cc01ad63e17529089c2c559c74709d225f595eee017af227fee11ae8a97a6ab19ae6768b8aa22d8d75dcb60a00b28f52e9fa78140672d928bc1ae9
+ languageName: node
+ linkType: hard
+
"@babel/traverse--for-generate-function-map@npm:@babel/traverse@^7.25.3, @babel/traverse@npm:^7.20.0, @babel/traverse@npm:^7.25.3, @babel/traverse@npm:^7.25.9":
version: 7.25.9
resolution: "@babel/traverse@npm:7.25.9"
@@ -1831,6 +1843,16 @@ __metadata:
languageName: node
linkType: hard
+"@babel/types@npm:^7.26.10, @babel/types@npm:^7.26.9":
+ version: 7.26.10
+ resolution: "@babel/types@npm:7.26.10"
+ dependencies:
+ "@babel/helper-string-parser": "npm:^7.25.9"
+ "@babel/helper-validator-identifier": "npm:^7.25.9"
+ checksum: 10c0/7a7f83f568bfc3dfabfaf9ae3a97ab5c061726c0afa7dcd94226d4f84a81559da368ed79671e3a8039d16f12476cf110381a377ebdea07587925f69628200dac
+ languageName: node
+ linkType: hard
+
"@babel/types@npm:^7.26.5, @babel/types@npm:^7.26.7":
version: 7.26.7
resolution: "@babel/types@npm:7.26.7"
@@ -9157,13 +9179,13 @@ __metadata:
linkType: hard
"image-size@npm:^1.0.2":
- version: 1.1.1
- resolution: "image-size@npm:1.1.1"
+ version: 1.2.1
+ resolution: "image-size@npm:1.2.1"
dependencies:
queue: "npm:6.0.2"
bin:
image-size: bin/image-size.js
- checksum: 10c0/2660470096d12be82195f7e80fe03274689fbd14184afb78eaf66ade7cd06352518325814f88af4bde4b26647889fe49e573129f6e7ba8f5ff5b85cc7f559000
+ checksum: 10c0/f8b3c19d4476513f1d7e55c3e6db80997b315444743e2040d545cbcaee59be03d2eb40c46be949a8372697b7003fdb0c04925d704390a7f606bc8181e25c0ed4
languageName: node
linkType: hard