forked from rodgomesc/vision-camera-code-scanner
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
See: mrousavy/react-native-vision-camera#1754 for Android. We need this to be able to pass in the types array.
- Loading branch information
1 parent
dedefa6
commit f2933a7
Showing
27 changed files
with
5,175 additions
and
6,330 deletions.
There are no files selected for viewing
27 changes: 0 additions & 27 deletions
27
.yarn/patches/react-native-vision-camera-https-167742576d.patch
This file was deleted.
Oops, something went wrong.
47 changes: 47 additions & 0 deletions
47
.yarn/patches/react-native-vision-camera-npm-3.0.0-21b4ab30d7.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
diff --git a/ios/Frame Processor/FrameProcessorPluginHostObject.mm b/ios/Frame Processor/FrameProcessorPluginHostObject.mm | ||
index c21e7765da1205264063650f84e86a4a45f9f263..8fb580472bd391b9b02685e83c55af2920125445 100644 | ||
--- a/ios/Frame Processor/FrameProcessorPluginHostObject.mm | ||
+++ b/ios/Frame Processor/FrameProcessorPluginHostObject.mm | ||
@@ -39,7 +39,7 @@ | ||
} | ||
|
||
// Call actual Frame Processor Plugin | ||
- id result = [_plugin callback:frame withArguments:nil]; | ||
+ id result = [_plugin callback:frame withArguments:options]; | ||
|
||
// Convert result value to jsi::Value (possibly undefined) | ||
return JSINSObjectConversion::convertObjCObjectToJSIValue(runtime, result); | ||
diff --git a/src/FrameProcessorPlugins.ts b/src/FrameProcessorPlugins.ts | ||
index cb5366f5cbebb6472b77b4450c50f9ca8e965ef2..d49f709e26a8e7970501826f0ca86f70e44b0628 100644 | ||
--- a/src/FrameProcessorPlugins.ts | ||
+++ b/src/FrameProcessorPlugins.ts | ||
@@ -7,17 +7,16 @@ import type TWorklets from 'react-native-worklets-core'; | ||
import { CameraModule } from './NativeCameraModule'; | ||
import { assertJSIAvailable } from './JSIHelper'; | ||
|
||
-type BasicParameterType = string | number | boolean | undefined; | ||
-type ParameterType = BasicParameterType | BasicParameterType[] | Record<string, BasicParameterType | undefined>; | ||
+type ParameterType = string | number | boolean | undefined | ParameterType[] | { [key: string]: ParameterType }; | ||
|
||
-interface FrameProcessorPlugin { | ||
+interface FrameProcessorPlugin<T extends ParameterType> { | ||
/** | ||
* Call the native Frame Processor Plugin with the given Frame and options. | ||
* @param frame The Frame from the Frame Processor. | ||
* @param options (optional) Additional options. Options will be converted to a native dictionary | ||
* @returns (optional) A value returned from the native Frame Processor Plugin (or undefined) | ||
*/ | ||
- call: (frame: Frame, options?: Record<string, ParameterType>) => ParameterType; | ||
+ call: (frame: Frame, options?: Record<string, ParameterType>) => T; | ||
} | ||
|
||
interface TVisionCameraProxy { | ||
@@ -27,7 +26,7 @@ interface TVisionCameraProxy { | ||
* Creates a new instance of a Frame Processor Plugin. | ||
* The Plugin has to be registered on the native side, otherwise this returns `undefined` | ||
*/ | ||
- getFrameProcessorPlugin: (name: string) => FrameProcessorPlugin | undefined; | ||
+ getFrameProcessorPlugin: <T extends ParameterType>(name: string) => FrameProcessorPlugin<T> | undefined; | ||
} | ||
|
||
let hasWorklets = false; |
Oops, something went wrong.
f2933a7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello
i have been having this error
node_modules/react-native-vision-camera/src/CameraDevice.ts:30:5 - error TS2578: Unused '@ts-expect-error' directive.
30 // @ts-expect-error for very obvious reasons
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 1 error in node_modules/react-native-vision-camera/src/CameraDevice.ts:30
f2933a7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, thanks! That can be fixed by just uncommenting the @ts-expect-error line. I had been uncommenting it in previous commits' patch files but missed carrying it forward with this release. I'll put it back in for the next update once a new release of react-native-vision-camera is out that lets me add Android support.