Przeglądaj źródła

Update README.md

Gaëtan Renaudeau 7 lat temu
rodzic
commit
e85cdaffb2
1 zmienionych plików z 7 dodań i 4 usunięć
  1. 7
    4
      README.md

+ 7
- 4
README.md Wyświetl plik

@@ -41,14 +41,17 @@ Returns a Promise of the image URI.
41 41
     - `"file"` (default): save to a temporary file *(that will only exist for as long as the app is running)*.
42 42
     - `"base64"`: encode as base64 and returns the raw string. Use only with small images as this may result of lags (the string is sent over the bridge). *N.B. This is not a data uri, use `data-uri` instead*.
43 43
     - `"data-uri"`: same as `base64` but also includes the [Data URI scheme](https://en.wikipedia.org/wiki/Data_URI_scheme) header.
44
- - **`path`** *(string)*: The absolute path where the file get generated. See *`dirs` constants* for more information.
44
+ - **`path`** *(string)*: The absolute path where the file get generated. **Read below before using it!** 
45 45
  - **`snapshotContentContainer`** *(bool)*: if true and when view is a ScrollView, the "content container" height will be evaluated instead of the container height.
46 46
 
47
-### `dirs` constants
47
+### `path` option and `dirs` constants
48 48
 
49
-By default, takeSnapshot will export in a temporary folder and the snapshot file will be deleted as soon as the app leaves. If you use the `path` option, you make the snapshot file more permanent and at a specific file location. To make file location more 'universal', the library exports some classic directory constants:
49
+**Disclaimer: advanced usecase only!**
50 50
 
51
-> If you use the `path` option, you own the file and manage its lifecycle: it won't get cleaned so be careful not leaking files on user's phone.
51
+By default, takeSnapshot will export in a temporary folder and the snapshot file will be deleted as soon as the app leaves.
52
+But if you use the `path` option, you make the snapshot file more permanent and at a specific file location. it is up to you to manage the image file lifecycle, the library won't clean it for you (which might result of leaking files on user's phone if you are not careful). There is also no guarantee the file will be successfully saved: you can reach permissions problem, this also is platform specific.
53
+
54
+If you still want to do this, we expose a few somewhat universal "constants" to ease the work.
52 55
 
53 56
 ```js
54 57
 import { takeSnapshot, dirs } from "react-native-view-shot";