Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
expo-camera
Advanced tools
A React component that renders a preview for the device's either front or back camera. Camera's parameters like zoom, auto focus, white balance and flash mode are adjustable. With expo-camera, one can also take photos and record videos that are saved to t
The expo-camera package is a part of the Expo ecosystem and provides a comprehensive API for accessing and using the device's camera in React Native applications. It allows developers to capture photos, record videos, and access various camera settings and features.
Capture Photos
This feature allows you to capture photos using the device's camera. The code sample demonstrates how to set up the Camera component and take a picture when a button is pressed.
```javascript
import React, { useRef } from 'react';
import { View, Button } from 'react-native';
import { Camera } from 'expo-camera';
export default function App() {
const cameraRef = useRef(null);
const takePicture = async () => {
if (cameraRef.current) {
const photo = await cameraRef.current.takePictureAsync();
console.log(photo);
}
};
return (
<View style={{ flex: 1 }}>
<Camera style={{ flex: 1 }} ref={cameraRef} />
<Button title="Take Picture" onPress={takePicture} />
</View>
);
}
```
Record Videos
This feature allows you to record videos using the device's camera. The code sample demonstrates how to set up the Camera component and start/stop video recording when a button is pressed.
```javascript
import React, { useRef, useState } from 'react';
import { View, Button } from 'react-native';
import { Camera } from 'expo-camera';
export default function App() {
const cameraRef = useRef(null);
const [isRecording, setIsRecording] = useState(false);
const recordVideo = async () => {
if (cameraRef.current) {
if (isRecording) {
cameraRef.current.stopRecording();
} else {
setIsRecording(true);
const video = await cameraRef.current.recordAsync();
console.log(video);
setIsRecording(false);
}
}
};
return (
<View style={{ flex: 1 }}>
<Camera style={{ flex: 1 }} ref={cameraRef} />
<Button title={isRecording ? "Stop Recording" : "Record Video"} onPress={recordVideo} />
</View>
);
}
```
Access Camera Settings
This feature allows you to access and modify camera settings such as switching between the front and back cameras. The code sample demonstrates how to request camera permissions and toggle the camera type.
```javascript
import React, { useState, useEffect } from 'react';
import { View, Text } from 'react-native';
import { Camera } from 'expo-camera';
export default function App() {
const [hasPermission, setHasPermission] = useState(null);
const [cameraType, setCameraType] = useState(Camera.Constants.Type.back);
useEffect(() => {
(async () => {
const { status } = await Camera.requestPermissionsAsync();
setHasPermission(status === 'granted');
})();
}, []);
if (hasPermission === null) {
return <View />;
}
if (hasPermission === false) {
return <Text>No access to camera</Text>;
}
return (
<View style={{ flex: 1 }}>
<Camera style={{ flex: 1 }} type={cameraType} />
<Button
title="Flip Camera"
onPress={() => {
setCameraType(
cameraType === Camera.Constants.Type.back
? Camera.Constants.Type.front
: Camera.Constants.Type.back
);
}}
/>
</View>
);
}
```
The react-native-camera package is a popular alternative to expo-camera. It provides similar functionalities such as capturing photos, recording videos, and accessing camera settings. However, it requires linking and additional setup compared to the more streamlined experience of expo-camera within the Expo ecosystem.
The react-native-vision-camera package offers advanced camera functionalities, including frame processing and integration with machine learning models. It is more feature-rich compared to expo-camera but also requires more complex setup and configuration.
A React component that renders a preview for the device's either front or back camera. Camera's parameters like zoom, auto focus, white balance and flash mode are adjustable. With expo-camera, one can also take photos and record videos that are saved to the app's cache. Morever, the component is also capable of detecting faces and bar codes appearing on the preview.
For managed managed Expo projects, please follow the installation instructions in the API documentation for the latest stable release. If you follow the link and there is no documentation available then this library is not yet usable within managed projects — it is likely to be included in an upcoming Expo SDK release.
For bare React Native projects, you must ensure that you have installed and configured the react-native-unimodules
package before continuing.
expo install expo-camera
Add NSCameraUsageDescription
key to your Info.plist
:
<key>NSCameraUsageDescription</key>
<string>Allow $(PRODUCT_NAME) to use the camera</string>
Run pod install
in the ios directory after installing the npm package.
Add android.permission.CAMERA
permission to your manifest (android/app/src/main/AndroidManifest.xml
):
<uses-permission android:name="android.permission.CAMERA" />
Adjust the android/build.gradle
to add a new maven
block after all other repositories as described below:
allprojects {
repositories {
// * Your other repositories here *
// * Add a new maven block after other repositories / blocks *
maven {
// expo-camera bundles a custom com.google.android:cameraview
url "$rootDir/../node_modules/expo-camera/android/maven"
}
}
}
Contributions are very welcome! Please refer to guidelines described in the contributing guide.
48.0.0 — 2023-02-09
@stripe/stripe-react-native
from 0.19.0
to 0.23.3
. (#20964 by @aleqsio, #21117 by @kudo)react-native-webview
from 11.23.1
to 11.26.0
. (#20933 by @aleqsio)react-native-gesture-handler
from 2.8.0
to 2.9.0
. (#20930 by @tsapeta)react-native-shared-element
from 0.8.4
to 0.8.7
. (#20593 by @ijzerenhein)@react-native-async-storage/async-storage
from 1.17.3
to 1.17.11
. (#20780 by @kudo)react-native-reanimated
from 2.12.0
to 2.14.4
. (#20798 by @kudo, #20990 by @tsapeta)@shopify/react-native-skia
from 0.1.157
to 0.1.172
. (#20857, #21014 by @kudo)react-native-safe-area-context
from 4.4.1
to 4.5.0
. (#20899 by @gabrieldonadel)react-native-screens
from 3.18.0
to 3.20.0
. (#20938 by @lukmccall, #21186 by @tsapeta)react-native-pager-view
from 6.0.1
to 6.1.2
. (#20932 by @gabrieldonadel)@react-native-community/slider
from 4.2.4
to 4.4.2
. (#20903 by @gabrieldonadel, #21055 by @kudo)react-native-shared-element
from 0.8.7
to 0.8.8
. (#20929 by @byCedric)@react-native-community/datetimepicker
from 6.5.2
to 6.7.3
. (#20926 by @byCedric)@shopify/flash-list
from 1.3.1
to 1.4.0
. (#20927 by @lukmccall)expo-contacts
expo-keep-awake
KeepAwake.activateKeepAwake
has been deprecated in favor of KeepAwake.activateKeepAwakeAsync
. (#15826 by @EvanBacon)expo-linking
expo-apple-authentication
expo-av
expo-barcode-scanner
expo-blur
expo-brightness
expo-constants
expo-crypto
randomUUID
method to get a random UUIDv4 string. (#20274 by @aleqsio)getRandomValues
method to fill typed arrays. (#20257 by @aleqsio)getRandomBytes
, getRandomBytesAsync
methods from expo-random
. (#20217 by @aleqsio)digest
method to get a cryptographic digest of a typed array. (#20886 by @aleqsio)expo-device
expo-document-picker
expo-gl
expo-haptics
expo-keep-awake
KeepAwake.isAvailableAsync
which returns false on certain web browsers. (#15826 by @EvanBacon)KeepAwake.addListener
to observe state changes on web. (#15826 by @EvanBacon)expo-intent-launcher
expo-local-authentication
expo-image-picker
expo-media-library
expo-modules-core
TypedArray
and additional union types for Int, Uint and Float TypedArrays. (#20257 by @aleqsio)executeOnJavaScriptThread
method to appContext
to allow for running code blocks on the JS thread. (#20161 by @aleqsio)Exceptions.MissingActivity
on Android. (#20174 by @lukmccall)Events
component can now be initialized with an array of event names (not only variadic arguments). (#20590 by @tsapeta)Property
component can now take the native shared object instance as the first argument. (#20608 by @tsapeta)Property
's owner properties using Swift key paths. (#20610 by @tsapeta)Long
type as function parameters on Android. (#20787 by @lukmccall)expo-network
expo-sharing
expo-sms
expo-store-review
expo-speech
expo-video-thumbnails
expo-asset
/
. (#20258 by @EvanBacon)expo-av
HTMLMediaElement.play
and HTMLMediaElement.pause
calls on the Web aren't properly awaited. (#20439) by @zhigang1992 (#20439 by @zhigang1992)SimpleExoPlayer
implementation on Android. (#21055 by @kudo)expo-barcode-scanner
expo-blur
-webkit-backdrop-filter
to support blurring on Safari. (#21003 by @EvanBacon)expo-clipboard
ImageFormat
or the StringFormat
not working in the release builds on Android. (#20155 by @lukmccall)expo-constants
expo-camera
Cannot set prop 'barCodeScannerSettings' on view 'class expo.modules.camera.ExpoCameraView'
on Android. (#21033 by @lukmccall)expo-file-system
expo-gl
expo-haptics
expo-image-picker
expo-mail-composer
composeAsync
not resolving promise after sending/ discarding email. (#20869 by @keith-kurak)expo-media-library
expo-modules-core
new NativeEventEmitter() was called with a non-null argument without the required addListener method.
warnings on Android with JSC. (#19920 by @kudo)ViewDefinitionBuilder
crashes when ProGuard or R8 is enabled on Android. (#20197 by @lukmccall)SharedObject
initializer being inaccessible due to internal
protection level. (#20588 by @tsapeta)null
or undefined
. (#20755 & #20766 by @tsapeta & @lukmccall) (#20755, #20766 by @tsapeta, @lukmccall)expo-location
isolatedModules
flag. (#20239 by @zakharchenkoAndrii)expo-print
printAsync
not reflecting custom width/ height, useMarkupFormatter
option preventing custom width/ height/ margin from being reflected. (#18873 by @keith-kurak) (#20046 by)expo-sensors
isolatedModules
flag. (#20239 by @zakharchenkoAndrii)expo-web-browser
url
for web. (#20708 by @EvanBacon)expo-asset
expo-application
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-auth-session
expo-random
package. (#21063 by @lukmccall)expo-background-fetch
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-av
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-barcode-scanner
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-branch
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-brightness
useSystemBrightnessAsync
and add it as renamed restoreSystemBrightnessAsync
method to avoid violating Rules of Hooks. (#19701 by @Simek)compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-cellular
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-calendar
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-clipboard
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-constants
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-contacts
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-crypto
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-battery
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-device
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-document-picker
uuid
. (#20477 by @LinusU)compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-camera
videoStabilizationMode
option. (#20130 by @simek)compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-error-recovery
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-file-system
DeletingOptions
, InfoOptions
, RelocatingOptions
and MakeDirectoryOptions
types. (#20103 by @Simek)UploadProgressData
totalByteSent
field to totalBytesSent
. (#20804 by @gabrieldonadel)compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-font
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-face-detector
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-gl
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-haptics
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-image-manipulator
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-image-loader
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-keep-awake
KeepAwakeOptions
type, update the doc comments. (#20489 by @Simek)compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-linear-gradient
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-intent-launcher
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-local-authentication
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-linking
expo-image-picker
uuid
. (#20476 by @LinusU)compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-localization
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-mail-composer
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-media-library
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-modules-core
ArgumentCastException
to use ordinal numbers. (#19912 by @tsapeta)Enumerable
protocol implement CaseIterable
to get rid of operating on unsafe pointers. (#20640 by @tsapeta)compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-location
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-network
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-print
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-random
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-permissions
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-screen-capture
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-notifications
getExpoPushTokenAsync
to make projectId
required. (#20833 by @gabrieldonadel)compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)getExpoPushTokenAsync
parameter type. (#21104 by @Simek)expo-sharing
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-screen-orientation
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-sms
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-sensors
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-store-review
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-secure-store
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-speech
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-sqlite
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-task-manager
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-video-thumbnails
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)expo-web-browser
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)unimodules-app-loader
compileSdkVersion
and targetSdkVersion
to 33
. (#20721 by @lukmccall)FAQs
A React component that renders a preview for the device's either front or back camera. Camera's parameters like zoom, auto focus, white balance and flash mode are adjustable. With expo-camera, one can also take photos and record videos that are saved to t
The npm package expo-camera receives a total of 124,498 weekly downloads. As such, expo-camera popularity was classified as popular.
We found that expo-camera demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 33 open source maintainers 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.