datetimepicker icon indicating copy to clipboard operation
datetimepicker copied to clipboard

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

Open alex-mironov opened this issue 4 months ago • 27 comments

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",

alex-mironov avatar Mar 06 '24 07:03 alex-mironov

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

sbeigel avatar Mar 06 '24 08:03 sbeigel

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.

chsdwn avatar Mar 06 '24 09:03 chsdwn

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

It 's same issue.

sonmybbp05 avatar Mar 06 '24 09:03 sonmybbp05

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);


david98 avatar Mar 06 '24 09:03 david98

@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.

phicoder avatar Mar 06 '24 10:03 phicoder

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

fnazarios avatar Mar 06 '24 10:03 fnazarios

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.

hereusmizo avatar Mar 06 '24 12:03 hereusmizo

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

mfrfinbox avatar Mar 06 '24 13:03 mfrfinbox

Please fix.

cblaze22 avatar Mar 06 '24 16:03 cblaze22

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.

therbta avatar Mar 07 '24 02:03 therbta

Got the same issue on Expo

mpho-ppm avatar Mar 07 '24 09:03 mpho-ppm

@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.

mphill avatar Mar 07 '24 10:03 mphill

@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).

bitcrumb avatar Mar 07 '24 10:03 bitcrumb

@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.

mphill avatar Mar 07 '24 10:03 mphill

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 avatar Mar 08 '24 03:03 MariuzM

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

MariuzM avatar Mar 08 '24 03:03 MariuzM

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

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

araphiel-nf avatar Mar 11 '24 17:03 araphiel-nf

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"

MariuzM avatar Mar 11 '24 17:03 MariuzM

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

araphiel-nf avatar Mar 11 '24 18:03 araphiel-nf

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

johnnyxbell avatar Mar 12 '24 03:03 johnnyxbell

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.

WangTao-CD avatar Mar 12 '24 09:03 WangTao-CD

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.

blimatech avatar Mar 12 '24 15:03 blimatech

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"

https://github.com/react-native-datetimepicker/datetimepicker/pull/868#issuecomment-1983201760

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

marcelwinter04 avatar Mar 13 '24 06:03 marcelwinter04

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

AngrySquirrell avatar Mar 13 '24 11:03 AngrySquirrell

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

marcelwinter04 avatar Mar 13 '24 11:03 marcelwinter04

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

You're a legend !! Thank you sooo much

AngrySquirrell avatar Mar 13 '24 12:03 AngrySquirrell

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

Worked for me. Thank you

Chbilalramzan avatar Mar 15 '24 22:03 Chbilalramzan

Hello, I'm looking for companies or individuals willing to help with the maintenance: https://github.com/react-native-datetimepicker/datetimepicker/pull/868#issuecomment-2003591984

vonovak avatar Mar 18 '24 10:03 vonovak

:tada: This issue has been resolved in version 7.6.3 :tada:

If this package helps you, consider sponsoring us! :rocket:

vonovak avatar Mar 18 '24 19:03 vonovak