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

How to do codegen for iOS if we have both TurboModules and Fabric in our project? #19

Closed
BraveEvidence opened this issue Jul 9, 2022 · 5 comments

Comments

@BraveEvidence
Copy link

I have a specification for Fabric and TurboModule in my project. It works for separate project. If I try to write both of them in the same project , it generates a bunch of undefined symbols. I think the issue is in package.json file where we write the codegen code

"codegenConfig": {
    "libraries": [
      {
        "name": "CustomLib",
        "type": "modules",
        "jsSrcsDir": "./js"
      },
      {
        "name": "CustomUILib",
        "type": "components",
        "jsSrcsDir": "./js"
      }
    ]
  }

I tried this but it doesn't seem to work and throws a bunch of undefined symbols error

@chakrihacker
Copy link
Member

Can you share a repo to take a look at??

@BraveEvidence
Copy link
Author

@chakrihacker Check this https://github.com/PritishSawant/ReactNativeMultipleTurboModulesAndFabricExample

The issue happens for iOS codegen. I have multiple Fabric and TurboModules Spec in js folder and codegen is not able to recognise which one is Fabric and which one is TurboModule so I think the issue happens.

@BraveEvidence
Copy link
Author

Looks like on further debugging, the issue is on codgen side for Fabric. Even individual fabric component with no TurboModule in a separate project is not working
Screenshot 2022-07-10 at 10 02 09 AM
Screenshot 2022-07-10 at 10 02 25 AM
Screenshot 2022-07-10 at 10 03 01 AM

The error logs are for separate project with only fabric module.

@cipolleschi
Copy link
Collaborator

Hi @PritishSawant, thanks for your questions. I think you are hitting two different problems, here.

  1. If you want to create a library which has both a TM and a FC, you have to work with it in the same way android does: you have to create a single library that contains both and use the type all. The configuration will look something like this:
"codegenConfig": {
  "libraries": [
    {
      "name": "CustomLib",
      "type": "all",
      "jsSrcsDir": "./js"
    }
  ]
}
  1. The error Undefined Symbols for architecture x86_64, _ColoredViewCls means that iOS is not finding the symbol for the ColoredViewCls method. If you look here, you'll see that, at the end of the last iOS file, there is the required method: That is something you have to write, the Codegen can't create that for you because the Codegen does not know the name of the class that actually represents the View in the native world.

@BraveEvidence
Copy link
Author

@cipolleschi Thanks closing this

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

No branches or pull requests

3 participants