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

Expo app plugin adds Firebase import multiple times [Expo 45] #6477

Closed
2 of 10 tasks
pehagg opened this issue Aug 18, 2022 · 6 comments · Fixed by #6507
Closed
2 of 10 tasks

Expo app plugin adds Firebase import multiple times [Expo 45] #6477

pehagg opened this issue Aug 18, 2022 · 6 comments · Fixed by #6507
Labels
help: ios Needs help implementing or reviewing a PR relating to iOS code. platform: expo type: bug New bug report

Comments

@pehagg
Copy link
Contributor

pehagg commented Aug 18, 2022

Issue

On Expo 45, Firebase import gets added every time expo prebuild is run on an Expo project that uses dev client and the Firebase app plugin. Most likely caused by the import check in appDelegate.ts which only checks for @import Firebase, not #import <Firebase/Firebase.h>.

Had a stab at a local fix/patch, but wasn't able to figure out how to update the plugin code so that my changes would apply.

Not a huge issue, but somewhat annoying because I need to remove the added lines every time I want to check in my changes to version control.


Project Files

Javascript

Click To Expand

package.json:

# N/A

firebase.json for react-native-firebase v6:

# N/A

iOS

Click To Expand

ios/Podfile:

  • I'm not using Pods
  • I'm using Pods and my Podfile looks like:
# N/A

AppDelegate.m:

// N/A


Android

Click To Expand

Have you converted to AndroidX?

  • my application is an AndroidX application?
  • I am using android/gradle.settings jetifier=true for Android compatibility?
  • I am using the NPM package jetifier for react-native compatibility?

android/build.gradle:

// N/A

android/app/build.gradle:

// N/A

android/settings.gradle:

// N/A

MainApplication.java:

// N/A

AndroidManifest.xml:

<!-- N/A -->


Environment

Click To Expand

react-native info output:

 OUTPUT GOES HERE
  • Platform that you're experiencing the issue on:
    • iOS
    • Android
    • iOS but have not tested behavior on Android
    • Android but have not tested behavior on iOS
    • Both
  • react-native-firebase version you're using that has this issue:
    • 15.3.0
  • Firebase module(s) you're using that has the issue:
    • App
  • Are you using TypeScript?
    • N/A


@pehagg pehagg added help: needs-triage Issue needs additional investigation/triaging. type: bug New bug report labels Aug 18, 2022
@mikehardy
Copy link
Collaborator

That does sound irritating. Expo isn't a use case of mine (apologies) so this will need a patch from someone else but I can merge+release anything that comes in related

@mikehardy mikehardy added help: ios Needs help implementing or reviewing a PR relating to iOS code. platform: expo and removed help: needs-triage Issue needs additional investigation/triaging. labels Aug 24, 2022
@DoctorJohn
Copy link
Contributor

DoctorJohn commented Aug 24, 2022

@pehagg I think you're right, looks like the following check is not correct:

if (!contents.includes('@import Firebase;')) {

You should give patch-package a try. Our do you mean by but wasn't able to figure out how to update the plugin code so that my changes would apply. something else 👀 ?

@pehagg
Copy link
Contributor Author

pehagg commented Sep 5, 2022

You should give patch-package a try. Our do you mean by but wasn't able to figure out how to update the plugin code so that my changes would apply. something else 👀 ?

@DoctorJohn , Sorry, didn't see this before now. I tried with patch-package, but my changes didn't have any effect when I built the app, regardless what I tried. Might've been missing some step or something 🤷🏻 . Thanks for the fix!

@mikehardy
Copy link
Collaborator

That sounds like a mis-integration of patch-package somehow. Yarn will obliterate patch-package changes if you re-run yarn and patch-package is not in a postinstall (or maybe even postinstall-postinstall - check patch-package docs) step

@pehagg
Copy link
Contributor Author

pehagg commented Sep 6, 2022

@mikehardy nope, that's not it. I verified several times that the postinstall task ran successfully. Most likely some other issue, but let's not rule out PEBCAK completely 😁

@pehagg
Copy link
Contributor Author

pehagg commented Sep 20, 2022

Can confirm that the fix is working. Thanks for fixing this @DoctorJohn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help: ios Needs help implementing or reviewing a PR relating to iOS code. platform: expo type: bug New bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants