Skip to content

Commit bb1fd89

Browse files
authored
docs: tiny improvements (#800)
1 parent 59391a7 commit bb1fd89

File tree

10 files changed

+54
-25
lines changed

10 files changed

+54
-25
lines changed

docs/docs/doc-viewer-api/index.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,41 @@ options for viewing a document
6363

6464
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).
6565

66+
## Variables
67+
68+
### errorCodes
69+
70+
> `const` **errorCodes**: `Readonly`\<\{`IN_PROGRESS`: `"ASYNC_OP_IN_PROGRESS"`;`OPERATION_CANCELED`: `"OPERATION_CANCELED"`;`UNABLE_TO_OPEN_FILE_TYPE`: `"UNABLE_TO_OPEN_FILE_TYPE"`; \}\>
71+
72+
#### Type declaration
73+
74+
| Name | Type |
75+
| ------ | ------ |
76+
| `IN_PROGRESS` | `"ASYNC_OP_IN_PROGRESS"` |
77+
| `OPERATION_CANCELED` | `"OPERATION_CANCELED"` |
78+
| `UNABLE_TO_OPEN_FILE_TYPE` | `"UNABLE_TO_OPEN_FILE_TYPE"` |
79+
6680
## Functions
6781

82+
### isErrorWithCode()
83+
84+
> **isErrorWithCode**(`error`: `any`): `error is NativeModuleError`
85+
86+
TypeScript helper to check if an object has the `code` property.
87+
This is used to avoid `as` casting when you access the `code` property on errors returned by the module.
88+
89+
#### Parameters
90+
91+
| Parameter | Type |
92+
| ------ | ------ |
93+
| `error` | `any` |
94+
95+
#### Returns
96+
97+
`error is NativeModuleError`
98+
99+
***
100+
68101
### viewDocument()
69102

70103
> **viewDocument**(`data`: [`ViewDocumentOptions`](index.md#viewdocumentoptions)): `Promise`\<`null`\>

docs/docs/sponsor-only/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ There's the improved (list of changes below) picker package (called `@react-nati
4242

4343
### Windows
4444

45-
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.
45+
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.
4646

4747
### How do I know it works?
4848

docs/docs/sponsor-only/license.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ sidebar_position: 80
33
sidebar_label: License
44
---
55

6-
The module is licensed under MIT
6+
# License
7+
8+
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.

docs/docs/sponsor-only/picker/directory-picker.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
sidebar_position: 6
33
---
44

5-
# Directory Picker
5+
# Directory picker
66

77
This module allows you to pick a directory from the file system. The chosen directory can then be used for file I/O operations.
88

docs/docs/sponsor-only/picker/integrating-on-android.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
sidebar_position: 10
33
---
44

5-
# Android Usage Notes
5+
# Android usage notes
66

77
:::tip
88
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).

docs/docs/sponsor-only/picker/keeping-local-copy.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ return (
6262
destination: 'documentDirectory',
6363
})
6464
if (copyResult.status === 'success') {
65-
// do something
65+
// do something with the local copy:
66+
console.log(copyResult.localUri)
6667
}
6768
} catch (err) {
6869
// see error handling

docs/docs/sponsor-only/viewer.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ return (
4040
title="view the last imported file"
4141
onPress={() => {
4242
const uriToOpen = 'file:///path/to/your/file'
43-
viewDocument({ uri: uriToOpen }).catch(handleError)
43+
viewDocument({ uri: uriToOpen, mimeType: 'some-mime' }).catch(handleError)
4444
}}
4545
/>
4646
)

docs/docusaurus.config.ts

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ const config: Config = {
3838
[
3939
'classic',
4040
{
41-
gtag: {
42-
trackingID: 'G-V1JZZG12TG',
43-
anonymizeIP: true,
44-
},
4541
docs: {
4642
sidebarPath: './sidebars.ts',
4743
editUrl: 'https://github.com/react-native-documents/document-picker/edit/main/docs',
@@ -130,13 +126,16 @@ const config: Config = {
130126
],
131127

132128
themeConfig: {
133-
// announcementBar: {
134-
// id: 'announcementBar',
135-
// content:
136-
// '<a target="_blank" href="https://github.com/reactwg/react-native-new-architecture/discussions/154">Bridgeless mode</a> is now available in the premium module!',
137-
// isCloseable: true,
138-
// },
129+
announcementBar: {
130+
id: 'announcementBar',
131+
content:
132+
'Find these packages useful? Say thanks by <a target="_blank" href="https://github.com/sponsors/vonovak">sponsoring</a> the author on GitHub!',
133+
// isCloseable: true,
134+
},
139135
// Replace with your project's social card
136+
colorMode: {
137+
respectPrefersColorScheme: true,
138+
},
140139
image: 'img/docusaurus-social-card.jpg',
141140
navbar: {
142141
title: 'RN Document picker & viewer',
@@ -154,12 +153,12 @@ const config: Config = {
154153
{ to: 'docs/doc-picker-api', label: 'Picker API', position: 'left' },
155154
{ to: 'docs/doc-viewer-api', label: 'Viewer API', position: 'left' },
156155
{
157-
to: '/example',
156+
to: 'https://github.com/react-native-documents/document-picker/tree/main/packages/example',
158157
label: 'Example app',
159-
position: 'left',
158+
position: 'right',
160159
},
161160
{
162-
href: '/github-repo',
161+
href: 'https://github.com/react-native-documents/document-picker',
163162
label: 'GitHub',
164163
position: 'right',
165164
},

docs/src/pages/example.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/src/pages/github-repo.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)