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

Non-virtual member function marked 'override' hides virtual member function

skinnynpale opened this issue Β· comments

Hi! πŸ‘‹

Firstly, thanks for your work on this project! πŸ™‚

Today I used patch-package to patch @react-native-community/datetimepicker@7.6.2 for the project I'm working on.

Here is the diff that solved my problem:

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

This issue body was partially generated by patch-package.

commented

Same problem here when using React Native 0.73.5! +1

Hi! πŸ‘‹

Firstly, thanks for your work on this project! πŸ™‚

Today I used patch-package to patch @react-native-community/datetimepicker@7.6.2 for the project I'm working on.

Here is the diff that solved my problem:

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

This issue body was partially generated by patch-package.

I can confirm this has fixed the issue for me. Just to recap:

  1. In the root of your project create a folder /patches, inside it create a file called @react-native-community+datetimepicker+7.6.2.patch (dump the content provided by skinnynpale into this file)
  2. run npx patch-package

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!