iOS standalone app falls into legacy architecture codepath using published React Native library exposing a Fabric Native Component #277
Unanswered
Zach-Dean-Attractions-io
asked this question in
Q&A
Replies: 1 comment 13 replies
-
cc @cipolleschi |
Beta Was this translation helpful? Give feedback.
13 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have created a React Native library, using the Fabric Native Component template, which exposes a coloured square view:
npx create-react-native-library@latest FabricNativeComponentTest
fabric-native-component-test
Firstly, there is a bug in the file
ios/FabricNativeComponentTestViewManager.mm
, which is a file required by the legacy architecture. The code exports a view propertycolor
but aUIView
doesn't have acolor
property (it should bebackgroundColor
). (I have raised this as a bug callstack/react-native-builder-bob#788 and asked about the issue I go on to explain below but have had no traction)To fix this file I have modified it as so:
To check which codepath the app is falling into I have modified the file
ios/FabricNativeComponentTestView.mm
(the new architecture) and hardcoded the colour of the view to be red.Then I've also modified the file
ios/FabricNativeComponentTestViewManager.mm
(the legacy architecture) and hardcoded the colour of the view to be blue.If I run the example app included in the library project I correctly get a red square as the code is falling into the new architecture codepath as expected.
I've then published this library to a local npm registry using
npm publish --registry http://localhost:4873/
and also created a standalone React Native app running version0.78.0
of React Native using the commandnpx @react-native-community/cli@latest init standaloneApp
.Within the standalone app I have:
npm install fabric-native-component-test --registry http://localhost:4873/
cd ios && bundle install && bundle exec pod install
App.tsx
file to:npx react-native run-ios
I then see a blue square when I expect to see a red square. If I look in the logs in the developer tools I see the following, not sure if this is a red-herring or not, but I don't see this in the example app.
Does anyone know what I need to do so that the standalone app works correctly?
Beta Was this translation helpful? Give feedback.
All reactions