react-native-reanimated: iOS: Version 2.17.0 fails to build on React Native 0.72.0+
Description
Version 2.17.0 of this library encounters C++ dialect-related build errors on React Native 0.72.0-rc.5:
❌ /Users/jeff/Projects/groove/deps/react-native-app/RNReanimated2/ios/Pods/Headers/Public/React-cxxreact/cxxreact/NativeModule.h:28:26: no template named 'optional' in namespace 'std'; did you mean 'folly::Optional'?
using MethodCallResult = std::optional<folly::dynamic>;
^
❌ /Users/jeff/Projects/groove/deps/react-native-app/RNReanimated2/ios/Pods/Headers/Public/React-cxxreact/cxxreact/ModuleRegistry.h:50:3: no template named 'optional' in namespace 'std'; did you mean 'folly::Optional'?
std::optional<ModuleConfig> getConfig(const std::string &name);
^
❌ /Users/jeff/Projects/groove/deps/react-native-app/RNReanimated2/ios/Pods/Headers/Public/React-jsiexecutor/jsireact/JSINativeModules.h:30:3: no template named 'optional' in namespace 'std'; did you mean 'folly::Optional'?
std::optional<jsi::Function> m_genNativeModuleJS;
^
❌ /Users/jeff/Projects/groove/deps/react-native-app/RNReanimated2/ios/Pods/Headers/Public/React-jsiexecutor/jsireact/JSINativeModules.h:34:3: no template named 'optional' in namespace 'std'; did you mean 'folly::Optional'?
std::optional<jsi::Object> createModule(
^
❌ /Users/jeff/Projects/groove/deps/react-native-app/RNReanimated2/ios/Pods/Headers/Public/React-jsiexecutor/jsireact/JSIExecutor.h:131:3: no template named 'optional' in namespace 'std'; did you mean 'folly::Optional'?
std::optional<jsi::Function> callFunctionReturnFlushedQueue_;
^
❌ /Users/jeff/Projects/groove/deps/react-native-app/RNReanimated2/ios/Pods/Headers/Public/React-jsiexecutor/jsireact/JSIExecutor.h:132:3: no template named 'optional' in namespace 'std'; did you mean 'folly::Optional'?
std::optional<jsi::Function> invokeCallbackAndReturnFlushedQueue_;
^
❌ /Users/jeff/Projects/groove/deps/react-native-app/RNReanimated2/ios/Pods/Headers/Public/React-jsiexecutor/jsireact/JSIExecutor.h:133:3: no template named 'optional' in namespace 'std'; did you mean 'folly::Optional'?
std::optional<jsi::Function> flushedQueue_;
^
Changing the C++ dialect setting to match the new React Native c++17
default seems to resolve this issue. We, like others, are stuck on Reanimated 2.x due to react-native-vision-camera
.
Steps to reproduce
- Create a bare React Native project on 0.72.0-rc.5
- Ensure that it build successfully on iOS
- Install Reanimated 2.17.0
- Attempt to build on iOS again
Snack or a link to a repository
https://github.com/jbrowning/RN072Reanimated2
Reanimated version
2.17.0
React Native version
0.72.0-rc.5
Platforms
iOS
JavaScript runtime
None
Workflow
React Native (without Expo)
Architecture
Paper (Old Architecture)
Build type
None
Device
None
Device model
No response
Acknowledgements
Yes
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 15
- Comments: 67 (19 by maintainers)
Are there plans to add support for react-native v0.72 in reanimated v2? Currently I cannot update reanimated to v3 in my projects as vision-camera is not yet compatible with that version.
@tomekzaw Do you have any plans to add RN 0.72 support for Reanimated 2? My project won’t be able to upgrade to Reanimated 3 any time soon but we would like to keep using the latest RN version.
Similar to @camilossantos2809 I cannot update reanimated to v3 in my project due to react-native-vision-camera and its plugin vision-camera-code-scanner.
Similar to @arshak-kahnputers I’m blocked by reanimated v3 and my project cannot be built successfully cuz I’m using react-native-vision-camera too.
You can update your Podfile to override this build setting during
pod install
:On my side, this does not fix the problem. The project now builds on iOS but triggers an error at runtime:
Everything is ready from our side, we just preparing for the release - most probably next week.
also stacked because of
react-native-vision-camera
.pod install
andyarn start --reset-cache
.Simply changing the dialect fixes the issue
@tomekzaw We are also in the VisionCamera situation.
This work for me.
patch-package
generate this diff file:Anyone can add and use for fix temporary this issue.
To sum up:
Hi @tomekzaw, I got this error running on latest react-native@0.72.4, react-native-reanimated@3.5.2 and react-native-vision-camera@2.16.0 that should support reanimated@V3. It works fine for iOS build, but fails on Android build.
Any news on this? Still waiting for this fix to be able to update to 0.72 😦
I am also having this problem and it will likely prevent me from updating to react-native 0.72.3 until this can be fixed! I don’t think updating to v3 is practical but I can try.
I’m facing the same issue, would love to have the support for 0.72 with reanimated v2 @elliottkember
Same for me … HELP !
react-native-vision-camera
doesn’t work with Reanimated v3 and block the upgrade for manysame, is there a patch to add support for v2 ?
@tomekzaw Hi, thanks for your work. I tried the PR build and reanimated version you suggested and ios is working fine now but i am getting error while trying to run android.
Any idea what am i missing here? Thanks.
@lexer Thanks for the response. We’re actively working on it. Reanimated 3.5.0 will expose API that RNVisionCamera v2/v3 will use for frame processors. Any other libraries?
@CelinaJa The PR was merged so you can use
react-native-vision-camera@2.16.5
.Just checked latest react-native-vision-camera@2.16.1 and react-native-reanimated@3.5.2 and it works for me! Thank you @tomekzaw for updating C++14 to C++17!
@tomekzaw I wasn’t aware of that. I’ll try to use the carousel library with reanimated 3 and see if that works. Thanks for the answer!
@tomekzaw I’m aware that supporting v2 for 0.72 is quite an effort but I believe there are still quite a bit of issues around v3 which will block upgrading v3 for quite some time… I found another two blocking issues since my last reported issue which I still need to find the time to provide with example projects… These range from random reanimated related crashes to blank screens when navigating between certain screens in my project.
The fix for iOS should be on version v2.17.0
@tomekzaw We found another blocker for updating to v3… it seems like that the
useAnimatedProps
hook is broken in v3. I will try to create an issue for that in the next days including an example to reproduce that.@AlexanderEggers Thanks for quick response. I think it’s way easier for us to resolve this issue than to backport support for 0.72 to v2 😄 Will take a look at it again soon.
For me, this resulted in
error Couldn't find match for "e323a61d360ba70d30ecf8522e515a6270225db0"
Usingyarn add tomekzaw/react-native-vision-camera#refs/heads/v2
instead worked for me! Probably because the PR has been merged.Bump
For me it is still not working with react-native-vision-camera@2.16.1 and react-native-reanimated@3.5.2 and react-native@0.72.4 , similar to @Romick2005 , but I tried with react-native@0.72.0 and it worked
i am using react-native
0.72.4
. How do i check which C++ version am i using?Thanks @tomekzaw
I have tested 3.4.1 and still having the same issue when using react navigation on web with the permanent drawer.
useAnimatedStyle.ts:429 Uncaught Error: useAnimatedStyle was used without a dependency array or Babel plugin. Please explicitly pass a dependency array, or enable the Babel/SWC plugin.
https://github.com/react-navigation/react-navigation/issues/11483
Also created a PR on react navigation but nobody is reviewing it. https://github.com/react-navigation/react-navigation/pull/11496
Is there anything we can do on react-native-reanimated library side?
Cheers
This is also a blocker for us. Any news or workarounds?
I’m seeing the same as @felginep on
0.72.1
and2.17.0
. Looks like that was updated on the main branch in this commit but it was in with all the new-architecture changes so I had trouble finding any clues thereI can confirm this does fix it. Only issue is when you have a remote CI server that does a pod install it can’t change the pod file dialect. Can this be a minor release just to change this?
In my project I’m also using is vision-camera
@tomekzaw I successfully upgraded to v3 (on RN 0.71) so all good for me (I must have already upgraded other packages that had issues with v3 in the past or it’s the latest v3 that fixed it)
Hi @tomekzaw , If I remember well, I think in my case it was an issue with https://github.com/dohooo/react-native-reanimated-carousel maybe with react-native-gesture-handler too