mmazzarolo / react-native-modal-datetime-picker

A React-Native datetime-picker for Android and iOS
MIT License
2.96k stars 396 forks source link

WARN: `defaultProps` will be removed from memo components #748

Open ChromeQ opened 4 months ago

ChromeQ commented 4 months ago

Environment

System:
  OS: Linux 6.5 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
  CPU: (16) x64 12th Gen Intel(R) Core(TM) i7-1270P
  Memory: 11.53 GB / 30.78 GB
  Shell:
    version: 5.1.16
    path: /bin/bash
Binaries:
  Node:
    version: 20.13.1
    path: ~/.nvm/versions/node/v20.13.1/bin/node
  Yarn:
    version: 1.22.22
    path: ~/.yarn/bin/yarn
  npm:
    version: 10.5.2
    path: ~/.nvm/versions/node/v20.13.1/bin/npm
  Watchman: Not Found
SDKs:
  Android SDK:
    Android NDK: 26.1.10909125
IDEs:
  Android Studio: Not Found
Languages:
  Java:
    version: 17.0.10
    path: /usr/bin/javac
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.1
    wanted: 0.74.1
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Platforms

Only tested Android

Versions

Description

Updating to the latest expo (v51.0.4) updated react-native to 0.74.1 and now opening my app using this package throws the following warning:

 ERROR  Warning: Unknown: Support for defaultProps will be removed from memo components in a future major release. Use JavaScript default parameters instead.
    in RCTView (created by View)
    in View (created by MemoTimeInput)

Tracked it down to my component MemoTimeInput which renders this package like so:

import DateTimePickerModal, { ReactNativeModalDateTimePickerProps } from 'react-native-modal-datetime-picker';
// ...
<DateTimePickerModal
        isVisible={true}
        mode="time"
        date={new Date()}
        onConfirm={() => {}}
        onCancel={() => {}}
        minuteInterval={15}
        is24Hour={false}
      />

Looking at source code I see the following: https://github.com/mmazzarolo/react-native-modal-datetime-picker/blob/56cc719a5e20cbe6aab7606a50b5e84765e1c391/src/DateTimePickerModal.android.js#L75

Commenting those defaultProps out fixes the issue.

kenil84 commented 4 months ago

Hello, have you been able to find a solution for this? I am also getting warning in my project.

ChromeQ commented 4 months ago

The solution is to refactor or rewrite the component, or use patch-package to comment it out.

Unfortunately not much will happen without @mmazzarolo, happy to create a PR if you would merge it @mmazzarolo?

Last commit was over 8 months ago so I won't hold my breath for a quick turnaround to this one. I might fork and fix and let you know.

ruamess commented 2 months ago

I fixed that problem, check this out https://github.com/mmazzarolo/react-native-modal-datetime-picker/pull/755

Nantris commented 2 weeks ago

I think this is closeable as of 18.x.