react-native-svg: [RN 0.72.1 New Arch] iOS build error: No matching constructor for initialization of 'facebook::react::RNSVGImageState'
Bug
When I try to build iOS with xcode this error occurs
No matching constructor for initialization of 'facebook::react::RNSVGImageState'
Unexpected behavior
iOS XCode Build Error
Environment info
System: OS: macOS 13.0 CPU: (10) arm64 Apple M1 Pro Memory: 72.11 MB / 16.00 GB Shell: version: 5.8.1 path: /bin/zsh Binaries: Node: version: 18.12.1 path: /var/folders/jf/pnk__5h55vqcsjtj_jchcz780000gn/T/yarn–1688129795348-0.059536718565355695/node Yarn: version: 1.22.19 path: /var/folders/jf/pnk__5h55vqcsjtj_jchcz780000gn/T/yarn–1688129795348-0.059536718565355695/yarn npm: version: 8.19.2 path: ~/.nvm/versions/node/v18.12.1/bin/npm Watchman: version: 2023.04.24.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.12.0 path: /Users/paul/.rvm/gems/ruby-2.7.6/bin/pod SDKs: iOS SDK: Platforms: - DriverKit 22.1 - iOS 16.1 - macOS 13.0 - tvOS 16.1 - watchOS 9.1 Android SDK: API Levels: - “23” - “24” - “28” - “30” - “31” - “32” - “33” Build Tools: - 29.0.2 - 30.0.2 - 30.0.3 - 31.0.0 - 32.0.0 - 32.1.0 - 33.0.0 - 34.0.0 System Images: - android-23 | Google APIs ARM 64 v8a - android-24 | Google APIs ARM 64 v8a - android-29 | Google Play ARM 64 v8a - android-31 | Google Play ARM 64 v8a - android-32 | Google APIs ARM 64 v8a - android-32 | Google Play ARM 64 v8a - android-33 | Google Play ARM 64 v8a - android-TiramisuPrivacySandbox | Google Play ARM 64 v8a Android NDK: Not Found IDEs: Android Studio: 2022.2 AI-222.4459.24.2221.9971841 Xcode: version: 14.1/14B47b path: /usr/bin/xcodebuild Languages: Java: version: 11.0.11 path: /usr/bin/javac Ruby: version: 2.7.6 path: /Users/paul/.rvm/rubies/ruby-2.7.6/bin/ruby npmPackages: “@react-native-community/cli”: Not Found react: installed: 18.2.0 wanted: 18.2.0 react-native: installed: 0.72.1 wanted: 0.72.1 react-native-macos: Not Found npmGlobalPackages: “react-native”: Not Found Android: hermesEnabled: true newArchEnabled: true iOS: hermesEnabled: true newArchEnabled: true Library version: x.x.x
Steps To Reproduce
Issues without reproduction steps or code are likely to stall.
- git clone https://github.com/user/rnsvg-bug-repro
- cd rnsvg-bug-repro
- yarn
- yarn ios
- yarn android
- …
Describe what you expected to happen:
Short, Self Contained, Correct (Compilable), Example
If you are having a problem with some code and seeking help, preparing a Short, Self Contained, Correct Example (SSCCE) is very useful. But what is an SSCCE?
It is all in the name, really. Take a look at each part. The version prepared for others to see should be:
Short (Small) - Minimise bandwidth for the example, do not bore the audience. Self Contained - Ensure everything is included, ready to go. Correct - Copy, paste, (compile,) see is the aim. Example - Displays the problem we are trying to solve.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 4
- Comments: 16 (7 by maintainers)
Fixing the return to
return {imageSource, {imageSource, nullptr, SharedFunction<>(nullptr)}};solved it for me. I’m too bad at C++ to understand whether this is idiomatic code, however.
Solution --This is only a syntax error. Please remove {} in this line – return {imageSource, {imageSource, nullptr,{}}}; Replace – return {imageSource, {imageSource, nullptr,}};
I upgraded react-native to 0.72.3 with react-native-svg 13.10.0 and it works fine now with new architecture enabled.
Closing since v13.10.0 (https://github.com/software-mansion/react-native-svg/releases/tag/v13.10.0) has been released and it should be fixed there 🚀