mirror of
https://github.com/status-im/react-native-camera-roll.git
synced 2026-08-28 11:51:07 +00:00
fix(all): add lowercase to auto type (#444)
Co-authored-by: Guilherme Ferraz <gferraz@visiblemagic.com>
This commit is contained in:
co-authored by
Guilherme Ferraz
parent
ff63489571
commit
0d395f5d67
@@ -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
@@ -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});
|
||||
|
||||
Reference in New Issue
Block a user