Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix use defaultProps on android #757

Open
gluhenko-dv opened this issue Jul 23, 2024 · 1 comment
Open

fix use defaultProps on android #757

gluhenko-dv opened this issue Jul 23, 2024 · 1 comment

Comments

@gluhenko-dv
Copy link

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-modal-datetime-picker@17.1.0 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-modal-datetime-picker/src/DateTimePickerModal.android.js b/node_modules/react-native-modal-datetime-picker/src/DateTimePickerModal.android.js
index 3495d1b..5e8d431 100644
--- a/node_modules/react-native-modal-datetime-picker/src/DateTimePickerModal.android.js
+++ b/node_modules/react-native-modal-datetime-picker/src/DateTimePickerModal.android.js
@@ -11,7 +11,15 @@ const areEqual = (prevProps, nextProps) => {
 };
 
 const DateTimePickerModal = memo(
-  ({ date, mode, isVisible, onCancel, onConfirm, onHide, ...otherProps }) => {
+  ({
+    date = new Date(),
+    mode,
+    isVisible = false,
+    onCancel,
+    onConfirm,
+    onHide = () => {},
+    ...otherProps
+  }) => {
     const currentDateRef = useRef(date);
     const [currentMode, setCurrentMode] = useState(null);
 
@@ -72,10 +80,4 @@ DateTimePickerModal.propTypes = {
   minimumDate: PropTypes.instanceOf(Date),
 };
 
-DateTimePickerModal.defaultProps = {
-  date: new Date(),
-  isVisible: false,
-  onHide: () => {},
-};
-
 export { DateTimePickerModal };
diff --git a/node_modules/react-native-modal-datetime-picker/src/DateTimePickerModal.ios.js b/node_modules/react-native-modal-datetime-picker/src/DateTimePickerModal.ios.js
index 6ef0b0a..baf7a97 100644
--- a/node_modules/react-native-modal-datetime-picker/src/DateTimePickerModal.ios.js
+++ b/node_modules/react-native-modal-datetime-picker/src/DateTimePickerModal.ios.js
@@ -22,6 +22,9 @@ export const BUTTON_FONT_SIZE = 20;
 export const HIGHLIGHT_COLOR_DARK = "#444444";
 export const HIGHLIGHT_COLOR_LIGHT = "#ebebeb";
 
+
+
+
 export class DateTimePickerModal extends React.PureComponent {
   static propTypes = {
     buttonTextColorIOS: PropTypes.string,

This issue body was partially generated by patch-package.

@marcofuentes05
Copy link

This patch fixes issue issue 748 👀 I would keep an eye on it

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

No branches or pull requests

2 participants