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

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

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 115
  • Comments: 72 (2 by maintainers)

Most upvoted comments

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

🎉 This issue has been resolved in version 7.6.3 🎉

If this package helps you, consider sponsoring us! 🚀

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

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


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

This change breaks RN 0.71. When i changed back to YGNodeRef it was able to build with Xcode 15.3

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.

Got the same issue on Expo

Please fix.

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 ⁠

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+

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

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.

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

The opposite worked for me. I changed YGNodeConstRef to YGNodeRef.

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

Updated package to "@react-native-community/datetimepicker": "7.6.3", and it fixed the issue for me, thanks!

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 🪄

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

Confirm upgrading to 7.6.3 fixed it. Cheers 🍻

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

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

works

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

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!!!

Issue still exists:

v7.6.3 only applies to RN 0.73

It might be a good idea to consider this a breaking change. Starting a version support table on the README.md might be a good first issue for someone to pick up

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

I did the opposite of this, and it resolved my issue.

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 (https://github.com/react-native-datetimepicker/datetimepicker/issues/866#issuecomment-1980375427)

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

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

🎉 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

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

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

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

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

It 's same issue.

@KubilayKartega I have the same issue. It doesn’t work since Xcode 15.4 update 😦 with “@react-native-community/datetimepicker”: “^8.1.1”

whelp its broken again. I suspect Xcode 15.4 update. Using “react-native”: “0.72.10”, tried both “@react-native-community/datetimepicker”: “^8.1.1”, and “@react-native-community/datetimepicker”: “^8.0.1”,

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

when building

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

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

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

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