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: update Expo plugin to be compatible with objcpp #6223

Merged
merged 5 commits into from
Apr 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports[`Config Plugin iOS Tests tests changes made to AppDelegate.m (SDK 43) 1`
// creating a bare React Native app (without Expo)
#import \\"AppDelegate.h\\"
@import Firebase;
#import <Firebase/Firebase.h>
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
Expand Down Expand Up @@ -99,7 +99,7 @@ exports[`Config Plugin iOS Tests tests changes made to AppDelegate.m with Expo R
// It has the RCTBridge to be created by Expo ReactDelegate
#import \\"AppDelegate.h\\"
@import Firebase;
#import <Firebase/Firebase.h>
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
Expand Down Expand Up @@ -189,7 +189,7 @@ exports[`Config Plugin iOS Tests tests changes made to AppDelegate.m with fallba
// some parts omitted to be short
#import \\"AppDelegate.h\\"
@import Firebase;
#import <Firebase/Firebase.h>
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
Expand Down Expand Up @@ -240,7 +240,7 @@ exports[`Config Plugin iOS Tests tests changes made to old AppDelegate.m (SDK 42
// It expects the old react-native-unimodules architecture (UM* prefix)
#import \\"AppDelegate.h\\"
@import Firebase;
#import <Firebase/Firebase.h>
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
Expand Down Expand Up @@ -351,7 +351,7 @@ exports[`Config Plugin iOS Tests works with AppDelegate.mm (RN 0.68+) 1`] = `
// using React Native 0.68 and is written in Objective-C++
#import \\"AppDelegate.h\\"
@import Firebase;
#import <Firebase/Firebase.h>
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
Expand Down
2 changes: 1 addition & 1 deletion packages/app/plugin/src/ios/appDelegate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function modifyObjcAppDelegate(contents: string): string {
contents = contents.replace(
/#import "AppDelegate.h"/g,
`#import "AppDelegate.h"
@import Firebase;`,
#import <Firebase/Firebase.h>`,
Copy link
Contributor

Choose a reason for hiding this comment

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

According to the RNFB docs, I don't know if it shouldn't be #import <Firebase.h> 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe we use to advice using @import Firebase a long time ago, but we also switched, maybe that's the confusion?

Either way this reminded me of some previous issues, and in triage of those we made sure both ways work (or, worked - @import won't work now I understand that:
#4069

Also, I made this change myself recently in my demo script - which hadn't been updated from @import style yet, and I can say I know this is working as well with new style:
mikehardy/rnfbdemo@cfed4d8#diff-3e27ae623577d0c559bd8ab973a0c34af8cc65ef9beb9868a9cdb029854f8078R33

Which is all to say: I'm pretty comfortable this will be backwards compatible (excellent!) and also I know for RN68 you need it as well

);
}

Expand Down