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

When running in Xcode 15.3 getting Incompatible function pointer types passing 'YGSize (...)' exception #866

Closed
alex-mironov opened this issue Mar 6, 2024 · 64 comments · Fixed by #868
Labels

Comments

@alex-mironov
Copy link

Bug report

I've updated to the most recent Xcode 15.3 and build started to fail with:

Incompatible function pointer types passing 'YGSize (YGNodeRef, float, YGMeasureMode, float, YGMeasureMode)' (aka 'struct YGSize (struct YGNode *, float, enum YGMeasureMode, float, enum YGMeasureMode)') to parameter of type 'YGMeasureFunc' (aka 'struct YGSize (*)(const struct YGNode *, float, enum YGMeasureMode, float, enum YGMeasureMode)')

Any idea what can be wrong with it?

Getting the issue
image

    "react-native": "0.73.1",
    "@react-native-community/datetimepicker": "^7.6.2",
@sbeigel
Copy link

sbeigel commented Mar 6, 2024

Same, I changed YGNodeRef to YGNodeConstRef in RNDateTimePickerShadowView.m line 44 (in function RNDateTimePickerShadowViewMeasure) and everything seems back to normal :)

@chsdwn
Copy link

chsdwn commented Mar 6, 2024

Same, I changed YGNodeRef to YGNodeConstRef in RNDateTimePickerShadowView.m line 44 (in function RNDateTimePickerShadowViewMeasure) and everything seems back to normal :)

It fixed my build error issue too. Thank you.

@sonmybbp05
Copy link

Same, I changed YGNodeRef to YGNodeConstRef in RNDateTimePickerShadowView.m line 44 (in function RNDateTimePickerShadowViewMeasure) and everything seems back to normal :)

It 's same issue.

@david98
Copy link

david98 commented Mar 6, 2024

The solution proposed by @sbeigel was indeed correct, but I kept getting an error at line 4 about "an expected expression". Turns out some weird whitespace character was used, I don't know if that was my fault or what...

EDIT: thanks to @phicoder for the suggestion (my bad for being kinda hasty), the issue was indeed on my end; after reinstalling and rebuilding this is the working patch.

diff --git a/node_modules/@react-native-community/datetimepicker/ios/RNDateTimePickerShadowView.m b/node_modules/@react-native-community/datetimepicker/ios/RNDateTimePickerShadowView.m
index c139440..45a97dd 100644
--- a/node_modules/@react-native-community/datetimepicker/ios/RNDateTimePickerShadowView.m
+++ b/node_modules/@react-native-community/datetimepicker/ios/RNDateTimePickerShadowView.m
@@ -41,7 +40,7 @@ - (void)setTimeZoneName:(NSString *)timeZoneName {
   YGNodeMarkDirty(self.yogaNode);
 }

-static YGSize RNDateTimePickerShadowViewMeasure(YGNodeRef node, float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode)
+static YGSize RNDateTimePickerShadowViewMeasure(YGNodeConstRef node, float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode)
 {
   RNDateTimePickerShadowView *shadowPickerView = (__bridge RNDateTimePickerShadowView *)YGNodeGetContext(node);


@phicoder
Copy link

phicoder commented Mar 6, 2024

@david98 for me the proposed solution by @sbeigel was sufficient. I think the error at line 4 might have been on your end. Try to reinstall the package, implement the suggested solution and build again to avoid any confusion.

@fnazarios
Copy link

Same here. The workaround fixed the compilation error. Any clue when this will be released?

@hereusmizo
Copy link

Same, I changed YGNodeRef to YGNodeConstRef in RNDateTimePickerShadowView.m line 44 (in function RNDateTimePickerShadowViewMeasure) and everything seems back to normal :)

Thank you so much. You save my day.

@mfrfinbox
Copy link

I am having the same issue! Changing to YGNodeConstRef fixed the problem, I would love this to be fixed soon! Thanks a lot

@cblaze22
Copy link

cblaze22 commented Mar 6, 2024

Please fix.

@therbta
Copy link

therbta commented Mar 7, 2024

Same, I changed YGNodeRef to YGNodeConstRef in RNDateTimePickerShadowView.m line 44 (in function RNDateTimePickerShadowViewMeasure) and everything seems back to normal :)

this did work! Thank you.

@mpho-ppm
Copy link

mpho-ppm commented Mar 7, 2024

Got the same issue on Expo

@mphill
Copy link

mphill commented Mar 7, 2024

@mpho-ppm the fix works on Expo too (dev client builds)

Just go to node_modules/@react-native-community/datetimepicker/ios and edit line 44. expo run:<platform> will work again.

This is a hack workaround until a fix is released. If you restore modules this will be overwritten.

@bitcrumb
Copy link

bitcrumb commented Mar 7, 2024

@mphill The patch-package library is an excellent way of temporarily patching these kind of issues.

Here's a patch file that I already prepared:
@react-native-community+datetimepicker+7.6.2.patch

In our projects we typically keep these in a patches/ folder with a README.md inside that documents each patch with a link to the related issue(s).

Screenshot 2024-03-07 at 11 23 59

I can really recommend this approach (much easier than having to fork as well).

@mphill
Copy link

mphill commented Mar 7, 2024

@bitcrumb nice! EAS build servers are still working because they are not using Xcode 15.3, but we may have to do this if they upgrade. Thanks for sharing this pearl.

@MariuzM
Copy link

MariuzM commented Mar 8, 2024

Same for me, happens when i do local dev expo run:ios and eas build

This worked thank you

Same, I changed YGNodeRef to YGNodeConstRef in RNDateTimePickerShadowView.m line 44 (in function RNDateTimePickerShadowViewMeasure) and everything seems back to normal :)

@MariuzM
Copy link

MariuzM commented Mar 8, 2024

But i did notice when running eas build locally im getting this issue.
image

@aleksandar-zoric-workvivo

Can anyone confirm applying the fix above by @sbeigel breaks it on previous versions of Xcode? i.e. is this specific to 15.3?

@araphiel-nf
Copy link

araphiel-nf commented Mar 11, 2024

But i did notice when running eas build locally im getting this issue. image

The fix detailed in this thread is only applicable to React Native 0.73 as this is when Yoga was updated.

https://github.com/facebook/react-native/blob/v0.73.6/packages/react-native/ReactCommon/yoga/yoga/Yoga.h#L32-L37

@MariuzM
Copy link

MariuzM commented Mar 11, 2024

But i did notice when running eas build locally im getting this issue. image

The fix detailed in this thread is only applicable to React Native 0.73+

I'm on "react-native": "0.73.4"

@araphiel-nf
Copy link

araphiel-nf commented Mar 11, 2024

Seems like the patch isn't being applied.

I'd recommend checking that:

  • your post installs script is being executed
  • your build server isn't pulling from a cache

@johnnyxbell
Copy link

Do we have an ETA on a fix? I use expo and I locally build the the apps and it's been failing.

@WangTao-CD
Copy link

Do we have an ETA on a fix? I use expo and I locally build the the apps and it's been failing.

same for me, so I restarted my Mac, it worked.

@blimatech
Copy link

Same, I changed YGNodeRef to YGNodeConstRef in RNDateTimePickerShadowView.m line 44 (in function RNDateTimePickerShadowViewMeasure) and everything seems back to normal :)

Thanks. It worked for me also.

@marcelwinter04
Copy link

But i did notice when running eas build locally im getting this issue. image

The fix detailed in this thread is only applicable to React Native 0.73+

I'm on "react-native": "0.73.4"

#868 (comment)

you created a patch? worked for me after i did.

@AngrySquirrell
Copy link

Hey, I have the same issue but the fix doesn't work for me... I changed the type of the node variable to the YGNodeConstRef as advised but the error keeps reappearing

@marcelwinter04
Copy link

Hey, I have the same issue but the fix doesn't work for me... I changed the type of the node variable to the YGNodeConstRef as advised but the error keeps reappearing

I think you need to create a patch from the package. Because otherwise '''eas build''' just pulls the current package from npm.
https://medium.com/@PreetamGahlot/implement-patch-packages-in-react-native-mobile-app-61f651a7dec1

@ainanabilahh
Copy link

Same, I changed YGNodeRef to YGNodeConstRef in RNDateTimePickerShadowView.m line 44 (in function RNDateTimePickerShadowViewMeasure) and everything seems back to normal :)

So I changed back to YGNodeRef and it works.

Same for me

@namcancode
Copy link

Same, I changed YGNodeRef to YGNodeConstRef in RNDateTimePickerShadowView.m line 44 (in function RNDateTimePickerShadowViewMeasure) and everything seems back to normal :)

So I changed back to YGNodeRef and it works.

Lol. it worked

@jpmoyn
Copy link

jpmoyn commented Mar 26, 2024

@vonovak The latest version is not working. YGNodeConstRef in line 44 seems to be the issue.

@ethras
Copy link

ethras commented Mar 26, 2024

@vonovak The latest version is not working. YGNodeConstRef in line 44 seems to be the issue.

Please read above

v7.6.3 only applies to RN 0.73

@IronBlossom
Copy link

IronBlossom commented Apr 2, 2024

🎉 This issue has been resolved in version 7.6.3 🎉

If this package helps you, consider sponsoring us! 🚀

Works on Expo!! (although expo-doctor@1.5.0 is yelling )

  • SDK: 50.0.14
  • Xcode: 15.3

@ryanjwessel
Copy link

@vonovak The latest version is not working. YGNodeConstRef in line 44 seems to be the issue.

Please read above

v7.6.3 only applies to RN 0.73

I am observing this issue on RN 0.69.*. We are running 7.6.3 for this package and Xcode 15.3. This change appears to affect more versions of React Native than specified.

@andreiCrisan55
Copy link

@vonovak The latest version is not working. YGNodeConstRef in line 44 seems to be the issue.

Please read above
v7.6.3 only applies to RN 0.73

I am observing this issue on RN 0.69.*. We are running 7.6.3 for this package and Xcode 15.3. This change appears to affect more versions of React Native than specified.

I think he was referring that the fix only applies to RN 0.73 setups

@ryanjwessel
Copy link

My apologies, I misread the thread. Thanks for clarifying, I'll try this again once I'm upgraded to 0.73.*

@jhdollosa
Copy link

jhdollosa commented Apr 10, 2024

Upgrading to v7.6.3 worked for me

My package versions

"@react-native-community/datetimepicker": "7.6.3"
"react-native": "0.73.6",
"expo": "~50.0.15",

If you receive this error when after running npx expo run:ios .

❌ error: Sandbox: bash(27359) deny(1) file-read-data / ...

Just set User Script Sandboxing to No on Build Settings > Build Options

image

@radulescuandrew
Copy link

Confirm upgrading to 7.6.3 fixed it. Cheers 🍻

@pavlo-tretiak
Copy link

Upgraded to 7.6.4.

Now it's vice versa 😅 🤡

incompatible function pointer types passing 'YGSize (YGNodeConstRef, float, YGMeasureMode, float, YGMeasureMode)' (aka 'struct YGSize (const struct YGNode *, float, enum YGMeasureMode, float, enum YGMeasureMode)') to parameter of type 'YGMeasureFunc' (aka 'struct YGSize (*)(struct YGNode *, float, enum YGMeasureMode, float, enum YGMeasureMode)') [-Wincompatible-function-pointer-types]

Changing YGNodeConstRef back to YGNodeRef fixed the problem.

@aaparicio87
Copy link

aaparicio87 commented Apr 18, 2024

Same error that @pavlo-tretiak
version 7.7.0
`incompatible function pointer types passing 'YGSize (YGNodeConstRef, float, YGMeasureMode, float, YGMeasureMode)' (aka 'struct YGSize (const struct YGNode , float, enum YGMeasureMode, float, enum YGMeasureMode)') to parameter of type 'YGMeasureFunc' (aka 'struct YGSize ()(struct YGNode *, float, enum YGMeasureMode, float, enum YGMeasureMode)') [-Wincompatible-function-pointer-types]

YGNodeSetMeasureFunc(self.yogaNode, RNDateTimePickerShadowViewMeasure);`

Any solution?

@kodaraj
Copy link

kodaraj commented Apr 25, 2024

Just upgrading to 7.7.0 worked for me.

eas build -p ios --local

"expo": "^50.0.14",
"@react-native-community/datetimepicker": "^7.7.0",
"react-native": "0.73.6",

@aaparicio87
Copy link

Seems to be a problem of platform, because I have React Native 0.72

@christophby
Copy link

Issue still exists:

  • react-native 0.72.13
  • @react-native-community/datetimepicker 7.7.0

@tylim88
Copy link

tylim88 commented May 3, 2024

@react-native-community/datetimepicker: 8.0.0
react-native: 0.73.6

works

@GerardjRincon
Copy link

Same, I changed YGNodeRef to YGNodeConstRef in RNDateTimePickerShadowView.m line 44 (in function RNDateTimePickerShadowViewMeasure) and everything seems back to normal :)

In my case it was the opposite I had to change YGNodeRef to YGNodeRef

@OguzEkinci
Copy link

Upgraded to 7.6.4.

Now it's vice versa 😅 🤡

incompatible function pointer types passing 'YGSize (YGNodeConstRef, float, YGMeasureMode, float, YGMeasureMode)' (aka 'struct YGSize (const struct YGNode *, float, enum YGMeasureMode, float, enum YGMeasureMode)') to parameter of type 'YGMeasureFunc' (aka 'struct YGSize (*)(struct YGNode *, float, enum YGMeasureMode, float, enum YGMeasureMode)') [-Wincompatible-function-pointer-types]

Changing YGNodeConstRef back to YGNodeRef fixed the problem.

ahahaha lol, it's working really v8.0

@sinonodd
Copy link

I faced the same issue
image

Updated from "@react-native-community/datetimepicker": "7.6.1" to "@react-native-community/datetimepicker": "7.6.3"
and it worked 🪄

@friederbluemle
Copy link

friederbluemle commented May 11, 2024

I just ran into this issue as well, and after some trial and error, I can confirm 7.6.3+ is breaking RN 0.72 (and below?), while 7.6.2 still works. It can be traced back to #868, merged and released with v7.6.3 on March 18, 2024.
As @araphiel-nf noted above, this should probably have been considered a breaking change (i.e. major semver). But since the issue was at least in part affected by an "external" tool update (Xcode 15.3), it's a tricky situation. If possible, it should have been implemented in some backwards compatible way, and released as a follow up patch release (e.g. 7.6.5 and 7.7.1).
Currently, the major version 7 series appears to be partially compatible with RN <=0.72 and partially with RN 0.73+:

react-native datetimepicker
<=0.72 <=7.6.2
0.73+ 7.6.3+

@blodyle
Copy link

blodyle commented May 13, 2024

Hi all 👋
It seems there was some sort of regression from a couple months back since right now I had to change from YGNodeConstRef to YGNodeRef which is the exact opposite solution from this one (#866 (comment))

Is there any way you could reopen this issue (or create another one) in order to address this? Thanks!

@devalnor
Copy link

+1

@dconlisk
Copy link

dconlisk commented May 13, 2024

Upgrading to version 7.6.3 solved my issue on expo.dev

@AliHassan5927
Copy link

AliHassan5927 commented May 16, 2024

When we change ⁠ YGNodeRef ⁠ to ⁠ YGNodeConstRef ⁠ in RNDateTimePickerShadowView.m line 44 and run the app, it's working fine but when we run 'pod install', we have to update again RNDateTimePickerShadowView.m. To fix this issue, we will create a patch for ⁠ @react-native-community/datetimepicker ⁠.

This solution worked for me:

⁠react-native: ^0.71.7
⁠@react-native-community/datetimepicker: ^8.0.0

Step-1.⁠ ⁠npm i patch-package.

Step-2.⁠ ⁠add a new script in ⁠ package.json ⁠:

"scripts": {
"postinstall": "patch-package"
}

Step-3.⁠ ⁠Go to ⁠ node_modules/@react-native-community/datetimepicker/ios/RNDateTimePickerShadowView.m ⁠, replace ⁠ YGNodeConstRef ⁠ with ⁠ YGNodeRef ⁠ in ⁠ RNDateTimePickerShadowView.m ⁠ line 44.

Step-4.⁠ ⁠Run command ⁠ npx patch-package @react-native-community/datetimepicker ⁠

@Devdannnny
Copy link

I faced the same issue image

Updated from "@react-native-community/datetimepicker": "7.6.1" to "@react-native-community/datetimepicker": "7.6.3" and it worked 🪄

This works!!!

@harshithvemulas
Copy link

I just ran into this issue as well, and after some trial and error, I can confirm 7.6.3+ is breaking RN 0.72 (and below?), while 7.6.2 still works. It can be traced back to #868, merged and released with v7.6.3 on March 18, 2024. As @araphiel-nf noted above, this should probably have been considered a breaking change (i.e. major semver). But since the issue was at least in part affected by an "external" tool update (Xcode 15.3), it's a tricky situation. If possible, it should have been implemented in some backwards compatible way, and released as a follow up patch release (e.g. 7.6.5 and 7.7.1). Currently, the major version 6 series appears to be partially compatible with RN <=0.72 and partially with RN 0.73+:

react-native datetimepicker
<=0.72 <=7.6.2
0.73+ 7.6.3+

This worked for me, I was using RN 0.72 downgraded datetimepicker to 7.6.2 from 7.6.4 and it worked

@imamrobani
Copy link

imamrobani commented Jun 3, 2024

Same, I changed YGNodeRef to YGNodeConstRef in RNDateTimePickerShadowView.m line 44 (in function RNDateTimePickerShadowViewMeasure) and everything seems back to normal :)

So I changed back to YGNodeRef and it works.

I think this issue back in version 8.0.1

"react-native": "0.72.14",
"@react-native-community/datetimepicker": "^8.0.1",
Xcode: 15.4

Works for me to change back to YGNodeRef

@shivanip-iprogrammer
Copy link

YGNodeConstRef

same issue, still facing

@Rajaram10
Copy link

I am using "react-native": "0.71.7",
"@react-native-community/datetimepicker": "7.6.3",
Xcode: 15.4,
and i went with "YGNodeRef" instead of "YGNodeConstRef"
I am able to publish the app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.