iOS Turbo Module Backwards Compatibility Build Error #278
Zach-Dean-Attractions-io
started this conversation in
Documentation
Replies: 1 comment
-
|
I found a thread here: #8 (comment) which recommended changing |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am trying to create a Turbo Native Module with backwards compatibility. I am using the
create-react-native-libraryproject to scaffold and build my library.npx create-react-native-library@latest turboModuleWithBackwardsCompatThe library template comes with an example
multiplyfunction. I have modified the header files and implementation files as documentedios/TurboModuleWithBackwardsCompat.hios/TurboModuleWithBackwardsCompat.mmThe podfile is as follows
TurboModuleWithBackwardsCompat.podspec.The differences I notice against the documentation are:
s.source_filesincludescppfiles here and the documentation doesn't. I think this is fine.s.source_filesincludesswiftin the documentation and not here. I think this is fine.s.private_header_files = "ios/generated/**/*.h", which comes from Library with swift files causes build to fail because of generated umbrella header file including codegen headers callstack/react-native-builder-bob#690I've then published this library to NPM.
Then I've created a React Native app running version 0.75.0 of React Native so that the legacy architecture should be enabled by default.
npx @react-native-community/cli@latest init myAppV75 --version 0.75.0myAppV75directory, ran:cd ios && bundle install && bundle exec pod installApp.tsxfile tonpx react-native run-iosThe app runs successfully. I've then installed my turbo native module package from NPM.
npm install turbo-module-with-backwards-compatmyAppV75directory, ran:cd ios && bundle exec pod installnpx react-native run-iosThe app now fails to build. If I open the project in Xcode then I see the error:
However, this is coming from a file within the codegen generated code, which the conditional compilation blocks in the header and implementation files should avoid.
To get around this issue I have modified the podspec file to exclude the generated files.
I've published these changes to the library as a new version and created a new example app:
npx @react-native-community/cli@latest init myAppV75Second --version 0.75.0. I've installed the pods built the app successfully and used themultiplyfunction in theApp.tsxfile.Is it correct to need to exclude the generated files like this if the consuming app is running the legacy architecture or am I doing something wrong?
Beta Was this translation helpful? Give feedback.
All reactions