fix(all): add lowercase to auto type (#444)

Co-authored-by: Guilherme Ferraz <gferraz@visiblemagic.com>
This commit is contained in:
guilherme-ferraz1
2022-12-07 08:30:15 +01:00
committed by GitHub
co-authored by Guilherme Ferraz
parent ff63489571
commit 0d395f5d67
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -164,7 +164,7 @@ On Android, the tag must be a local image or video URI, such as `"file:///sdcard
On iOS, the tag can be any image URI (including local, remote asset-library and base64 data URIs) or a local video file URI (remote or data URIs are not supported for saving video at this time).
If the tag has a file extension of .mov or .mp4, it will be inferred as a video. Otherwise it will be treated as a photo. To override the automatic choice, you can pass an optional `type` parameter that must be one of 'photo' or 'video'.
If the tag has a file extension of .mov or .mp4 (lower or uppercase), it will be inferred as a video. Otherwise it will be treated as a photo. To override the automatic choice, you can pass an optional `type` parameter that must be one of 'photo' or 'video'.
It allows to specify a particular album you want to store the asset to when the param `album` is provided.
On Android, if no album is provided, DCIM directory is used, otherwise PICTURE or MOVIES directory is used depending on the `type` provided.
+1 -1
View File
@@ -178,7 +178,7 @@ export class CameraRoll {
if (type === 'auto') {
const fileExtension = tag.split('.').slice(-1)[0] ?? '';
if (['mov', 'mp4'].indexOf(fileExtension) >= 0) type = 'video';
if (['mov', 'mp4'].indexOf(fileExtension.toLowerCase()) >= 0) type = 'video';
else type = 'photo';
}
return RNCCameraRoll.saveToCameraRoll(tag, {type, album});