Skip to content
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

Remove defaultProps - it is causing errors #526

Open
KhrystynaPeryk opened this issue Jun 24, 2024 · 16 comments
Open

Remove defaultProps - it is causing errors #526

KhrystynaPeryk opened this issue Jun 24, 2024 · 16 comments

Comments

@KhrystynaPeryk
Copy link

Issue Description

When using CountryPicker, there are lots of errors in the console regarding defaultProps:

Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.

Steps to Reproduce / Code Snippets

Install the package in bare expo project
Import and use CountryPicker component

Expected Results

No errors in console

Additional Information

  • Nodejs version: 18.17.0
  • React version: 18.2.0
  • React Native version: 0.74.2
  • react-native-country-picker-modal version: 2.0.0
  • Platform(s) (iOS, Android, web, or all?): only tried on Android
  • TypeScript version: not used in my project
@TarunBardawa
Copy link

+1

@mahdiguliyev
Copy link

I am so facing with the same problem. Please resolve issue.

@chico-oliveira
Copy link

+1

5 similar comments
@Krcma
Copy link

Krcma commented Jul 18, 2024

+1

@novaakpatrik
Copy link

+1

@staniszewski
Copy link

+1

@S4mm4ael
Copy link

+1

@rxyces
Copy link

rxyces commented Jul 26, 2024

+1

@anhtuan219
Copy link

+1
Meanwhile, I'm using this to suppress that error

const error = console.error;
console.error = (...args: any) => {
  if (/defaultProps/.test(args[0])) return;
  error(...args);
};

@betocolon23
Copy link

Same problem. Please help!

@trongbinh15
Copy link

+1

3 similar comments
@iliassanati
Copy link

+1

@just-dodo
Copy link

+1

@devphenom
Copy link

+1

@TarunBardawa
Copy link

react-native-country-picker-modal+2.0.0.patch

As of now, I have manually removed defaultProps and created a patch using patch-package to suppress this warning.

@A
Copy link

A commented Oct 28, 2024

One solution is to monkeypatch console, another is to patch node_modules. IDK which one is even better.

image

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