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

Fix missing headers on iOS when using static linkage #150

Merged
merged 10 commits into from
Feb 5, 2024

Conversation

tomekzaw
Copy link
Collaborator

@tomekzaw tomekzaw commented Feb 5, 2024

Details

This PR fixes the following compile errors related to missing headers on iOS when static linkage is enabled (reported by @staszekscp):

Screenshot 2024-02-05 at 13 33 40

As it turns out, when static linkage is enabled, all - in header paths are replaced with _. The following change resolves the problem:

-#import <react-native-live-markdown/RCTMarkdownUtils.h>
+#import <react_native_live_markdown/RCTMarkdownUtils.h>

However, we would need to add macro conditionals to support both paths like Expo does here:

https://github.com/expo/expo/blob/294399de1e40f628b3ffdd5176eb181690d870ce/packages/expo-dev-menu/ios/ReactNativeCompatibles/ReactNative/DevClientAppDelegate.mm#L5-L10

The simpler solution is to eliminate all - from podspec name by renaming it from react-native-live-markdown to RNLiveMarkdown (similarly to RNReanimated, RNGestureHandler and others).

Related Issues

GH_LINK

Manual Tests

cd ios && USE_FRAMEWORKS=static NO_FLIPPER=1 pod install

Linked PRs

@tomekzaw tomekzaw force-pushed the @tomekzaw/fix-missing-headers-ios-linkage-static branch from 6a3bf24 to 12c0957 Compare February 5, 2024 13:02
@@ -1,15 +1,15 @@
#import <React/RCTUITextField.h>
#import <react/debug/react_native_assert.h>
#import "react_native_assert.h"
Copy link
Collaborator Author

@tomekzaw tomekzaw Feb 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason #import <react/debug/react_native_assert.h> also does not work, changed to #import "react_native_assert.h".
Screenshot 2024-02-05 at 13 56 33


#ifdef RCT_NEW_ARCH_ENABLED
#import <React/RCTConversions.h>
#else
#import <React-Core/React/RCTConvert.h>
#import <React/RCTConvert.h>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React_Core doesn't work

@AndrewGable AndrewGable merged commit 6363592 into main Feb 5, 2024
2 checks passed
@AndrewGable AndrewGable deleted the @tomekzaw/fix-missing-headers-ios-linkage-static branch February 5, 2024 20:12
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

Successfully merging this pull request may close these issues.

4 participants