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
-
Hi,
I am trying to create a Turbo Native Module with backwards compatibility. I am using the
create-react-native-library
project to scaffold and build my library.npx create-react-native-library@latest turboModuleWithBackwardsCompat
The library template comes with an example
multiply
function. I have modified the header files and implementation files as documentedios/TurboModuleWithBackwardsCompat.h
ios/TurboModuleWithBackwardsCompat.mm
The podfile is as follows
TurboModuleWithBackwardsCompat.podspec
.The differences I notice against the documentation are:
s.source_files
includescpp
files here and the documentation doesn't. I think this is fine.s.source_files
includesswift
in 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.0
myAppV75
directory, ran:cd ios && bundle install && bundle exec pod install
App.tsx
file tonpx react-native run-ios
The app runs successfully. I've then installed my turbo native module package from NPM.
npm install turbo-module-with-backwards-compat
myAppV75
directory, ran:cd ios && bundle exec pod install
npx react-native run-ios
The 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 themultiply
function in theApp.tsx
file.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