react-native-datetimepicker / datetimepicker

React Native date & time picker component for iOS, Android and Windows

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[iOS] Build error with React Fabric/New Architecture and RN 0.73.3

omniphx opened this issue · comments

Bug report

Summary

iOS Builds with the new RN architecture enabled are running into errors:

ComponentDescriptors.h:21:62 Non-virtual member function marked 'override' hides virtual member function

ComponentDescriptors.h:37:42 Non-const lvalue reference to type 'ShadowNode' cannot bind to a value of unrelated type 'const ShadowNode::Unshared' (aka 'const shared_ptr<ShadowNode>')

Screenshot 2024-01-31 at 3 14 54 PM

Reproducible sample code

n/a

Steps to reproduce

Clone: https://github.com/omniphx/rn-datetime-reproduction

  1. npm i
  2. cd ios
  3. RCT_NEW_ARCH_ENABLED=1 npx pod-install
  4. Run build

Describe what you expected to happen:

The build should be successful

Environment info

System:
  OS: macOS 13.6.3
  CPU: (10) arm64 Apple M2 Pro
  Memory: 75.98 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.18.0
    path: ~/.nvm/versions/node/v18.18.0/bin/node
  Yarn:
    version: 1.22.21
    path: ~/.nvm/versions/node/v18.18.0/bin/yarn
  npm:
    version: 9.8.1
    path: ~/.nvm/versions/node/v18.18.0/bin/npm
  Watchman:
    version: 2023.12.04.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.3
    path: /Users/MITCHMX20/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - visionOS 1.0
      - watchOS 10.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2022.3 AI-223.8836.35.2231.10671973
  Xcode:
    version: 15.2/15C500b
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.8
    path: /usr/bin/javac
  Ruby:
    version: 2.7.6
    path: /Users/MITCHMX20/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react: Not Found
  react-native: Not Found
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: true

datetimepicker version: 7.6.2
XCode version: 15.2
iOS / Android version: n/a
React Native: 0.73.3

I was able to get past this error by deleting the ios/fabric directory inside the npm module, which will cause codegen to run on this package when you run pod install.

I have the same issue and deleting that folder didn't work for me.

I was able to get past this error by deleting the ios/fabric directory inside the npm module, which will cause codegen to run on this package when you run pod install.

I was able to get past this error by deleting the ios/fabric directory inside the npm module, which will cause codegen to run on this package when you run pod install.

i ended up with

Showing All Messages
Undefined symbol: _RNDateTimePickerCls

any workaround on the issue?

A quick workaround until this is properly fixed...

I could move forward using React Native 0.73.4 by patching (patch-package) the module:

diff --git a/node_modules/@react-native-community/datetimepicker/ios/fabric/cpp/react/renderer/components/RNDateTimePicker/ComponentDescriptors.h b/node_modules/@react-native-community/datetimepicker/ios/fabric/cpp/react/renderer/components/RNDateTimePicker/ComponentDescriptors.h
index 4a1a8e2..30a0086 100644
--- a/node_modules/@react-native-community/datetimepicker/ios/fabric/cpp/react/renderer/components/RNDateTimePicker/ComponentDescriptors.h
+++ b/node_modules/@react-native-community/datetimepicker/ios/fabric/cpp/react/renderer/components/RNDateTimePicker/ComponentDescriptors.h
@@ -18,7 +18,7 @@ class RNDateTimePickerComponentDescriptor final : public ConcreteComponentDescri
   public:
     using ConcreteComponentDescriptor::ConcreteComponentDescriptor;
 
-    void adopt(ShadowNode::Unshared const &shadowNode) const override {
+    void adopt(ShadowNode::Unshared const &shadowNode) const {
       react_native_assert(std::dynamic_pointer_cast<RNDateTimePickerShadowNode>(shadowNode));
       auto pickerShadowNode = std::static_pointer_cast<RNDateTimePickerShadowNode>(shadowNode);
 
@@ -34,7 +34,7 @@ class RNDateTimePickerComponentDescriptor final : public ConcreteComponentDescri
         layoutableShadowNode->setSize(Size{stateData.frameSize.width, stateData.frameSize.height});
       }
 
-      ConcreteComponentDescriptor::adopt(shadowNode);
+      ConcreteComponentDescriptor::adopt((ShadowNode&)shadowNode);
     }
 };

Hello this should be fixed in v8 https://github.com/react-native-datetimepicker/datetimepicker/releases/tag/v8.0.0

Please open a new issue if the problem persists

Thank you!