Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
react-native-pvt-image-picker
Advanced tools
Readme
A React Native module that allows you to select a photo/video from the device library or camera.
Note: If you are still using deprecated version 2.x.x check this for documentation.
showImagePicker
API is removed.options
on Android.options
, so please check them carefully.yarn add react-native-image-picker
# RN >= 0.60
cd ios && pod install
# RN < 0.60
react-native link react-native-image-picker
Add the appropriate keys to your Info.plist,
If you are allowing user to select image/video from photos, add NSPhotoLibraryUsageDescription
.
If you are allowing user to capture image add NSCameraUsageDescription
key also.
If you are allowing user to capture video add NSCameraUsageDescription
add NSMicrophoneUsageDescription
key also.
No permissions required (saveToPhotos
requires permission check).
Note: This library does not require Manifest.permission.CAMERA, if your app declares as using this permission in manifest then you have to obtain the permission before using launchCamera
.
import {launchCamera, launchImageLibrary} from 'react-native-image-picker';
launchCamera()
Launch camera to take photo or video.
launchCamera(options?, callback);
See Options for further information on options
.
The callback
will be called with a response object, refer to The Response Object.
launchImageLibrary
Launch gallery to pick image or video.
launchImageLibrary(options?, callback)
See Options for further information on options
.
The callback
will be called with a response object, refer to The Response Object.
Option | iOS | Android | Description |
---|---|---|---|
mediaType | OK | OK | 'photo' or 'video' |
maxWidth | OK | OK | To resize the image |
maxHeight | OK | OK | To resize the image |
videoQuality | OK | OK | 'low', 'medium', or 'high' on iOS, 'low' or 'high' on Android |
durationLimit | OK | OK | Video max duration in seconds |
quality | OK | OK | 0 to 1, photos |
cameraType | OK | OK | 'back' or 'front'. May not be supported in few android devices |
includeBase64 | OK | OK | If true, creates base64 string of the image (Avoid using on large image files due to performance) |
saveToPhotos | OK | OK | (Boolean) Only for launchCamera, saves the image/video file captured to public photo |
key | iOS | Android | Description |
---|---|---|---|
didCancel | OK | OK | true if the user cancelled the process |
errorCode | OK | OK | Check ErrorCode for all error codes |
errorMessage | OK | OK | Description of the error, use it for debug purpose only |
base64 | OK | OK | The base64 string of the image (photos only) |
uri | OK | OK | The file uri in app specific cache storage. Except when picking video from Android gallery where you will get read only content uri, to get file uri in this case copy the file to app specific storage using any react-native library |
width | OK | OK | Image dimensions (photos only) |
height | OK | OK | Image dimensions (photos only) |
fileSize | OK | OK | The file size (photos only) |
type | OK | OK | The file type (photos only) |
fileName | OK | OK | The file name |
Image/video captured via camera will be stored in temporary folder so will be deleted any time, so don't expect it to persist. Use saveToPhotos: true
(default is false) to save the file in the public photos. saveToPhotos
requires WRITE_EXTERNAL_STORAGE permission on Android 28 and below (You have to obtain the permission, the library does not).
Code | Description |
---|---|
camera_unavailable | camera not available on device |
permission | Permission not satisfied |
others | other errors (check errorMessage for description) |
FAQs
A React Native module that allows you to use native UI to select media from the device library or directly from the camera
The npm package react-native-pvt-image-picker receives a total of 2 weekly downloads. As such, react-native-pvt-image-picker popularity was classified as not popular.
We found that react-native-pvt-image-picker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.