Skip to content

Commit ca0dc6b

Browse files
authored
Merge pull request #297 from Elyx0/@vonovak/patch-1
make options linkable
2 parents c5b76c8 + 31b1965 commit ca0dc6b

File tree

1 file changed

+30
-11
lines changed

1 file changed

+30
-11
lines changed

README.md

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,27 @@ If you are using RN >= 0.60, only run `pod install` from the ios directory. Then
2323

2424
#### RN < 0.60 / Manual Instructions
2525

26-
See [this](install-old.md)
26+
See [this](./install-old.md)
2727

2828
## API
2929

30-
### `DocumentPicker.pick(opts)` and `DocumentPicker.pickMultiple(opts)`
30+
#### `DocumentPicker.pick(options)` and `DocumentPicker.pickMultiple(options)`
3131

3232
Use `pick` or `pickMultiple` to open a document picker for the user to select file(s). Both methods return a Promise. `pick` will only allow a single selection and the Promise will resolve to that single result. `pickMultiple` will allow multiple selection and the Promise returned will always resolve to an array of results.
3333

34-
**Options:**
34+
### Options
3535

36-
- **`type`**:`string|Array<string>`: The type or types of documents to allow selection of. May be an array of types as single type string.
36+
##### `type`:`string|Array<string>`:
37+
38+
The type or types of documents to allow selection of. May be an array of types as single type string.
3739
- On Android these are MIME types such as `text/plain` or partial MIME types such as `image/*`.
3840
- On iOS these must be Apple "[Uniform Type Identifiers](https://developer.apple.com/library/content/documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html)"
3941
- If `type` is omitted it will be treated as `*/*` or `public.content`.
4042
- Multiple type strings are not supported on Android before KitKat (API level 19), Jellybean will fall back to `*/*` if you provide an array with more than one value.
41-
- **[UWP only] `readContent`**: Boolean which defaults to `false`. If `readContent` is set to true the content of the picked file/files will be read and supplied in the result object.
43+
44+
##### `readContent`:
45+
46+
Boolean which defaults to `false`. If `readContent` is set to true the content of the picked file/files will be read and supplied in the result object.
4247

4348
- Be aware that this can introduce a huge performance hit in case of big files. (The files are read completely and into the memory and encoded to base64 afterwards to add them to the result object)
4449
- However reading the file directly from within the Thread which managed the picker can be necessary on Windows: Windows Apps can only read the Downloads folder and their own app folder by default and If a file is outside of these locations it cannot be acessed directly. However if the user picks the file through a file picker permissions to that file are granted implicitly.
@@ -53,15 +58,29 @@ Use `pick` or `pickMultiple` to open a document picker for the user to select fi
5358
5459
- You can use `react-native-fs` on Android and IOS to read the picked file.
5560
56-
**Result:**
61+
### Result
5762
5863
The object a `pick` Promise resolves to or the objects in the array a `pickMultiple` Promise resolves to will contain the following keys.
5964
60-
- **`uri`**: The URI representing the document picked by the user. _On iOS this will be a `file://` URI for a temporary file in your app's container. On Android this will be a `content://` URI for a document provided by a DocumentProvider that must be accessed with a ContentResolver._
61-
- **`type`**: The MIME type of the file. _On Android some DocumentProviders may not provide MIME types for their documents. On iOS this MIME type is based on the best MIME type for the file extension according to Apple's internal "Uniform Type Identifiers" database._
62-
- **`name`**: The display name of the file. _This is normally the filename of the file, but Android does not guarantee that this will be a filename from all DocumentProviders._
63-
- **`size`**: The file size of the document. _On Android some DocumentProviders may not provide this information for a document._
64-
- **[UWP only] `content`**: The base64 encoded content of the picked file if the option `readContent` was set to `true`.
65+
##### `uri`:
66+
67+
The URI representing the document picked by the user. _On iOS this will be a `file://` URI for a temporary file in your app's container. On Android this will be a `content://` URI for a document provided by a DocumentProvider that must be accessed with a ContentResolver._
68+
69+
##### `type`:
70+
71+
The MIME type of the file. _On Android some DocumentProviders may not provide MIME types for their documents. On iOS this MIME type is based on the best MIME type for the file extension according to Apple's internal "Uniform Type Identifiers" database._
72+
73+
##### `name`:
74+
75+
The display name of the file. _This is normally the filename of the file, but Android does not guarantee that this will be a filename from all DocumentProviders._
76+
77+
##### `size`:
78+
79+
The file size of the document. _On Android some DocumentProviders may not provide this information for a document._
80+
81+
##### [UWP only] `content`:
82+
83+
The base64 encoded content of the picked file if the option `readContent` was set to `true`.
6584
6685
### `DocumentPicker.types.*`
6786

0 commit comments

Comments
 (0)