mrousavy / react-native-blurhash

🖼️ A library to show colorful blurry placeholders while your content loads.
https://blurha.sh
MIT License
1.98k stars 70 forks source link

[BUG] Can't build iOS #188

Closed wilkinsonj closed 6 months ago

wilkinsonj commented 8 months ago

Bug

Get a Fastlane exception when creating a development build on EXPO - 'react_native_blurhash-Swift.h' file not found

To Reproduce Steps to reproduce the behavior:

  1. Add package to project
  2. Try to build using EAS build

Expected behavior I expect the build to succeed. Android build is successful.

sektr63a commented 8 months ago

@janicduplessis, @mrousavy

Faced with same issue on bare React Native project

iM-GeeKy commented 8 months ago

Relates to https://github.com/mrousavy/react-native-blurhash/issues/186#issuecomment-1972097554. Reverting back to "react-native-blurhash": "~1.1.11", seems to resolve the issue for now.

Saphirah commented 7 months ago

Faced same issue

JimTeva commented 7 months ago

Same issue with bare rn project. (rn 0.72.6; podfile: use_frameworks! (because I use firebase)) As suggested by @iM-GeeKy I reverted back to rnblurhash 1.1.11 for the moment and it works again I cannot understand where the bug is coming from exactly.

focux commented 6 months ago

Did anyone find a workaround that is not downgrading? For some reason, it works good on my machine but not on CI.

iM-GeeKy commented 6 months ago

Did anyone find a workaround that is not downgrading? For some reason, it works good on my machine but not on CI.

I haven't been able to get anything above 1.1.11 to work. I thought it might work when new arch support was added in 2.0, but I prototyped upgrading my project to the new arch and it still didn't work. So long story short, unfortunately, I think the answer is no.

focux commented 6 months ago

By the way, I found the cause of the bug, looks like it was related to using dynamic/static frameworks (use_frameworks), which you most likely have enabled if you are using firebase.

I already opened a PR with the fix.

iM-GeeKy commented 6 months ago

By the way, I found the cause of the bug, looks like it was related to using dynamic/static frameworks (use_frameworks), which you most likely have enabled if you are using firebase.

I already opened a PR with the fix.

Nice work! I am in fact using firebase. I can try to use patch-package to verify your PR.

focux commented 6 months ago

Ya, that'd be great. It's working good for me. This is the patch:

diff --git a/node_modules/react-native-blurhash/ios/BlurhashModule.mm b/node_modules/react-native-blurhash/ios/BlurhashModule.mm
index 0069675..560040d 100644
--- a/node_modules/react-native-blurhash/ios/BlurhashModule.mm
+++ b/node_modules/react-native-blurhash/ios/BlurhashModule.mm
@@ -6,7 +6,12 @@
 #import <blurhash_codegen/blurhash_codegen.h>
 #endif

+#if __has_include("react_native_blurhash/react_native_blurhash-Swift.h")
+#import "react_native_blurhash/react_native_blurhash-Swift.h"
+#else
 #import "react_native_blurhash-Swift.h"
+#endif
+

 #ifdef RCT_NEW_ARCH_ENABLED
 using namespace facebook::react;
iM-GeeKy commented 6 months ago

@focux I built with the patch applied and it worked for me. Do note, I don't have the new arch enabled, I'm just running bridgeless mode with "react-native": "0.74.1",, but previously without the patch this version was failing.

mrousavy commented 6 months ago

Nice @focux

iM-GeeKy commented 1 month ago

For those who may run into this there is another file that needs to be changed like the patch above. The new patch is below

diff --git a/node_modules/react-native-blurhash/ios/BlurhashViewComponentView.mm b/node_modules/react-native-blurhash/ios/BlurhashViewComponentView.mm
index 2d919a9..e483bfb 100644
--- a/node_modules/react-native-blurhash/ios/BlurhashViewComponentView.mm
+++ b/node_modules/react-native-blurhash/ios/BlurhashViewComponentView.mm
@@ -10,7 +10,11 @@
 #import <react/renderer/components/blurhash_codegen/Props.h>
 #import <react/renderer/components/blurhash_codegen/RCTComponentViewHelpers.h>

+#if __has_include("react_native_blurhash/react_native_blurhash-Swift.h")
+#import "react_native_blurhash/react_native_blurhash-Swift.h"
+#else
 #import "react_native_blurhash-Swift.h"
+#endif

 using namespace facebook::react;