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

Project with React Native SVG fails to build on 0.74.0-rc.9 with new architecture #44174

Closed
Naturalclar opened this issue Apr 21, 2024 · 7 comments
Labels
Resolution: Answered When the issue is resolved with a simple answer Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)

Comments

@Naturalclar
Copy link
Contributor

Naturalclar commented Apr 21, 2024

Description

A project using react-native 0.74.0-rc.9 fails to build with the latest react-native-svg on new architecture.

At first I thought it was a problem with react-native-svg library, but after further investigation it seems like codegen is generating incorrect typings so it maybe an issue on codegen side.

Method that's causing the build to fail has input of Double, but generated type suggests that it needs to override method with input paramter of Integer

App can be built successfully on the latest 0.73 with new architecture.

Steps to reproduce

  1. Initialize new react-native app v0.74.0-rc.9
  2. install latest react-native-svg
  3. on gradle.propertires, set newArchitectureEnabled=true
  4. run yarn android

React Native Version

0.74.0-rc.9

Affected Platforms

Build - MacOS

Areas

Codegen

Output of npx react-native info

info Fetching system and libraries information...
System:
  OS: macOS 14.4.1
  CPU: (10) arm64 Apple M1 Max
  Memory: 355.16 MB / 64.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.8.1
    path: ~/.volta/tools/image/node/20.8.1/bin/node
  Yarn:
    version: 1.22.22
    path: ~/.volta/tools/image/yarn/1.22.22/bin/yarn
  npm:
    version: 10.1.0
    path: ~/.volta/tools/image/node/20.8.1/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.14.3
    path: /Users/naturalclar/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - visionOS 1.0
      - watchOS 10.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.1 AI-231.9392.1.2311.11330709
  Xcode:
    version: 15.2/15C500b
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /Users/naturalclar/.asdf/shims/javac
  Ruby:
    version: 2.7.6
    path: /Users/naturalclar/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.0-rc.9
    wanted: 0.74.0-rc.9
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: false

Stacktrace or Logs

BUILD FAILED in 1s
error Failed to install the app. Command failed with exit code 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
/Users/naturalclar/.ghq/github.com/Naturalclar/RN74Test/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/RNSVGRenderableManager.java:33: error: RNSVGRenderableManager is not abstract and does not override abstract method getScreenCTM(Integer) in NativeSvgRenderableModuleSpec
class RNSVGRenderableManager extends NativeSvgRenderableModuleSpec {
^
/Users/naturalclar/.ghq/github.com/Naturalclar/RN74Test/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/SvgViewModule.java:21: error: SvgViewModule is not abstract and does not override abstract method toDataURL(Integer,ReadableMap,Callback) in NativeSvgViewModuleSpec
class SvgViewModule extends NativeSvgViewModuleSpec {
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors FAILURE: Build failed with an exception. * What went wrong:
Execution failed for task ':react-native-svg:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details. * Try:
> Run with --info option to get more log output.
> Run with --scan to get full insights. BUILD FAILED in 1s.
info Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
╭─ ~/.ghq/github.com/Naturalclar/RN74Test [main]

Reproducer

https://github.com/Naturalclar/repro-rn74-new-arch-svg-build-fail

Screenshots and Videos

No response

@Naturalclar Naturalclar added Needs: Triage 🔍 Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules) labels Apr 21, 2024
@mensonones
Copy link

Hey, @Naturalclar!

I downloaded your project and noticed something. View the library's NativeSvgViewModule.ts file

image

Now see the same file in the library repository

https://github.com/software-mansion/react-native-svg/blob/main/src/fabric/NativeSvgViewModule.ts

I believe the problem has already been resolved, but they have not yet released a version with the correction.

If I'm wrong on something please let me know, otherwise it's been a pleasure trying to help. :)

@cortinico
Copy link
Contributor

I believe the problem has already been resolved, but they have not yet released a version with the correction.

@Naturalclar can we open an issue on react-native-svg's end to verify if this is the case?

@Naturalclar
Copy link
Contributor Author

@cortinico

@Naturalclar can we open an issue on react-native-svg's end to verify if this is the case?

Sure! That would be great 👍

@cortinico
Copy link
Contributor

@Naturalclar can you do it? :)

@WoLewicki
Copy link
Contributor

I think I know what is the problem. Could you try building from main? I added PR with support for 0.74: software-mansion/react-native-svg#2231 but I didn't release it yet since iirc it broke the 0.73 so I did not want to support only a version that is not yet released.

@cortinico
Copy link
Contributor

Closing as this is unrelated to React Native but related to a missing release of react-native-svg.

@cortinico cortinico added the Resolution: Answered When the issue is resolved with a simple answer label Apr 23, 2024
@WoLewicki
Copy link
Contributor

And it is available in the newest release: https://github.com/software-mansion/react-native-svg/releases/tag/v15.2.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Answered When the issue is resolved with a simple answer Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)
Projects
None yet
Development

No branches or pull requests

4 participants