Skip to content

fix use defaultProps on android #757

New issue

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

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

Already on GitHub? Sign in to your account

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 [email protected] 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

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

No branches or pull requests

2 participants