Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: restore support for v2 without frame processors #1812

Merged
merged 3 commits into from
Sep 19, 2023

Conversation

tomekzaw
Copy link
Contributor

@tomekzaw tomekzaw commented Sep 19, 2023

What

This PR fixes problems mentioned in #1759 (comment) and #1759 (comment).

Changes

  • Restored support for RNVisionCamera v2 without frame processors (when react-native-reanimated is not installed):
    • Added proper detection if Reanimated 3.5.0+ is installed on Android in build.gradle
    • Moved contents of FrameProcessorUtils.mm back to FrameProcessorRuntimeManager.mm on iOS
  • Bumped C++ version to 17 to resolve problems with missing std::optional when Reanimated is installed

Tested on

iPhone simulator

Related issues

Requires software-mansion/react-native-reanimated#5098.

@vercel
Copy link

vercel bot commented Sep 19, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-native-vision-camera ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 19, 2023 3:18am

@mrousavy
Copy link
Owner

Whoops, you're right, I rushed a release on that I forgot that we still need to make this optional

@mrousavy mrousavy merged commit e905069 into mrousavy:v2 Sep 19, 2023
4 of 8 checks passed
@efstathiosntonas
Copy link

@mrousavy please check my review comment above, I believe disableFrameProcessors should be VisionCamera_disableFrameProcessors

@mrousavy
Copy link
Owner

mrousavy commented Sep 19, 2023

Hey @efstathiosntonas - nope in this case not, only disableFrameProcessors is being queried - tested with that flag set and without.

VisionCamera: Frame Processors are disabled because the user explicitly disabled it ('disableFrameProcessors=true'). C++ part will not be built.

@efstathiosntonas
Copy link

perfect, thank you for your hard work guys ❤️

@tomekzaw tomekzaw deleted the rea-v3-fixes branch September 19, 2023 11:54
@Diego10x
Copy link

Diego10x commented Sep 20, 2023

Is this what they're talking about? Why does the Frame Processor get disabled in my project? :(

I just updated React Native from 0.70.5 to 0.71.0

VisionCamera: Building with Hermes... VisionCamera: Frame Processors are disabled because Reanimated 3.5.0+ is not installed

And it's strange because I have the following, and it does compile my app, but it doesn't open the camera because the frame processor is disabled:

"react-native-reanimated": "^2.10.0",
 "react-native-vision-camera": "^2.15.2",
 "vision-camera-code-scanner": "^0.2.0"

Then I update and it gives me this.

 "react-native-reanimated": "^3.5.0",
 "react-native-vision-camera": "^2.16.1",
 "vision-camera-code-scanner": "^0.2.0"
VisionCamera: Building with Hermes...
VisionCamera: Frame Processors are enabled! Building C++ part...

What went wrong:
Execution failed for task :react-native-vision-camera:configureCMakeDebug[arm64-v8a].
[CXX1214] /Users/foxmaster/Documents/repos/canjeappv2/node_modules/react-native-vision-camera/android/CMakeLists.txt debug|arm64-v8a :
 User has minSdkVersion 21 but library was built for 26
 [//react-native-reanimated/reanimated] 

PD. I apologize if my comment is out of place or has nothing to do with the topic. Regards.

@mrousavy
Copy link
Owner

Hey @Diego10x - the error message tells you exactly what you need to do. You need Reanimated 3.5+, and you need minSdk 26+.

@Diego10x
Copy link

Thank you for your valuable work, it worked for me in the following way:

package.json:

"react-native": "^0.71.0",
"react-native-reanimated": "^3.5.0",
"react-native-vision-camera": "^2.15.2",
"vision-camera-code-scanner": "^0.2.0"

build.gradle:

 buildToolsVersion = "33.0.0"
 minSdkVersion = 21
 compileSdkVersion = 33
 targetSdkVersion = 33

Thanks.

@tomekzaw
Copy link
Contributor Author

It definitely doesn't work with 2.15.2, please use RNVisionCamera ^2.16.1 along with Reanimated ^3.5.4.

"react-native-reanimated": "^3.5.4",
"react-native-vision-camera": "^2.16.1",

j-piasecki pushed a commit to j-piasecki/react-native-vision-camera that referenced this pull request Feb 12, 2024
* Make react-native-reanimated optional on Android again

* Build Android with C++17

* Make react-native-reanimated optional on iOS again
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants