Skip to content

Commit

Permalink
make named export again
Browse files Browse the repository at this point in the history
  • Loading branch information
hannojg committed Oct 25, 2024
1 parent df159ff commit 4b48d6c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package/src/Camera.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { CameraDevice } from './types/CameraDevice'
import type { CameraCaptureError } from './CameraError'
import { CameraRuntimeError, tryParseNativeCameraError, isErrorWithCause } from './CameraError'
import type { CameraProps, DrawableFrameProcessor, OnShutterEvent, ReadonlyFrameProcessor } from './types/CameraProps'
import CameraModule from './NativeCameraModule'
import { CameraModule } from './NativeCameraModule'
import type { PhotoFile, TakePhotoOptions } from './types/PhotoFile'
import type { Point } from './types/Point'
import type { RecordVideoOptions, VideoFile } from './types/VideoFile'
Expand Down
5 changes: 1 addition & 4 deletions package/src/NativeCameraModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const supportedPlatforms = ['ios', 'android', 'macos']

// NativeModules automatically resolves 'CameraView' to 'CameraViewModule'
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const CameraModule = NativeModules.CameraView
export const CameraModule = NativeModules.CameraView
if (CameraModule == null) {
if (!supportedPlatforms.includes(Platform.OS)) {
throw new CameraRuntimeError(
Expand Down Expand Up @@ -40,6 +40,3 @@ if (CameraModule == null) {
message += '\n* Make sure you rebuilt the app.'
throw new CameraRuntimeError('system/camera-module-not-found', message)
}

// Default export to avoid a metro/babel bug where this becomes undefined when imported as named export
export default CameraModule
2 changes: 1 addition & 1 deletion package/src/frame-processors/VisionCameraProxy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { IWorkletContext } from 'react-native-worklets-core'
import CameraModule from '../NativeCameraModule'
import { CameraModule } from '../NativeCameraModule'
import type { Frame } from '../types/Frame'
import { FrameProcessorsUnavailableError } from './FrameProcessorsUnavailableError'

Expand Down
2 changes: 1 addition & 1 deletion package/src/hooks/useCodeScanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { Code, CodeScanner, CodeScannerFrame } from '../types/CodeScanner'
export function useCodeScanner(codeScanner: CodeScanner): CodeScanner {
const { onCodeScanned, ...codeScannerOptions } = codeScanner

// Memoize the function once and use a ref on any identity changes
// Memoize the function once and use a ref on any identity changes
const ref = useRef(onCodeScanned)
ref.current = onCodeScanned
const callback = useCallback((codes: Code[], frame: CodeScannerFrame) => {
Expand Down

0 comments on commit 4b48d6c

Please sign in to comment.