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/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/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/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 978af90d..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 at https://github.com/react-native-documents/document-picker