-
Notifications
You must be signed in to change notification settings - Fork 208
iOS Fabric View template doesn't work when published and installed into a new app #788
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
Comments
I have found the bug. The issue is within the the The issue is with the code:
Since a + #import <React/RCTConvert.h>
- RCT_EXPORT_VIEW_PROPERTY(color, NSString)
+ RCT_CUSTOM_VIEW_PROPERTY(color, UIColor, UIView)
+{
+ if (json) {
+ [view setBackgroundColor:[RCTConvert UIColor:json]];
+ } else {
+ [view setBackgroundColor:nil];
+ }
+} When publishing the library with this change it works in a standalone app. However, this raises another question. It's my understanding that the Do you know why the library isn't picking up the new architecture in a standalone app (or do I have an error in my understanding here)? (I'll try investigate this some more) Update: I added a log statement into the view constructors in the legacy and new architecture files. When running the example app included in the library the new architecture constructor is used. However, when running the standalone app in Xcode the code does fall into the legacy constructor. Prior to the log statement there is this error
|
I added When running on the example app, only |
Hi, I managed to fix this issue by removing the Whether this is a good fix or not I am not sure but it at least gets to the root of the problem. -"exports": {
- ".": {
- "import": {
- "types": "./lib/typescript/module/src/index.d.ts",
- "default": "./lib/module/index.js"
- },
- "require": {
- "types": "./lib/typescript/commonjs/src/index.d.ts",
- "default": "./lib/commonjs/index.js"
- }
- }
-},
+ "types": "./lib/typescript/commonjs/src/index.d.ts", |
Can you check by updating
Is this with |
Hi @satya164 Yes it is with |
@Zach-Dean-Attractions-io can you check if it works without removing the "exports": {
// …
+ "./package.json": "./package.json"
}, |
Hi @satya164 Yes you are correct. With my "exports": {
".": {
"import": {
"types": "./lib/typescript/module/src/index.d.ts",
"default": "./lib/module/index.js"
},
"require": {
"types": "./lib/typescript/commonjs/src/index.d.ts",
"default": "./lib/commonjs/index.js"
}
},
+ "./package.json": "./package.json"
} Then publishing the generated library and installing it into a standalone app works as expected. |
@Zach-Dean-Attractions-io thanks! then I'll add this to the template and publish a new version. |
fixes #788 **fabric view**   **turbo module**  
Thanks @satya164 for your support, it is much appreciated. Also like the addition of |
Thanks @Zach-Dean-Attractions-io ! Let me know if you find any issues in the latest version. |
Description
I have created a Fabric View template using
npx create-react-native-library@latest FabricNativeComponent
with npm package namefabric-native-component
. If I run the example iOS app then I see a green square as expected.I've then published this app to a local registry
npm publish --registry http://localhost:4873/
and then created a new React Native app (running version 0.78.0 of React Native) usingnpx @react-native-community/cli@latest init App_v_0_78_0
.I've then installed the package
npm install fabric-native-component --registry http://localhost:4873/
into this app and modified theApp.tsx
file to be the same as the example app included in the library template.I then ran
bundle install && bundle exec pod install
within the appsios
directory. Building this app is successful but the app crashes immediately with the errorOne difference I see comparing the
ios
directories is that the Podfile in the example app included in the library template includesHowever, I tried adding the following code into the Podfile of the new app but it didn't seem to fix the issue. (Although I thought that codegen was ran when publishing the library)
Do you know how to resolve this issue?
As a side note in the file
/ios/FabricNativeComponentView.mm
the return type for the functionhexStringToColor
is missing I believe.Packages
Selected options
Fabric View
Link to repro
N/A
Environment
The text was updated successfully, but these errors were encountered: