react-native-paper icon indicating copy to clipboard operation
react-native-paper copied to clipboard

TextInput.Icon: Support for defaultProps will be removed from function components in a future major release.

Open yannick-softwerft opened this issue 10 months ago • 3 comments

Current behaviour

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

Expected behaviour

No warning.

image

Your Environment

software version
react-native 0.74.0
react-native-paper 5.12.3
node 18.18.0
npm or yarn 9.8.1
expo sdk No Expo

yannick-softwerft avatar Apr 24 '24 09:04 yannick-softwerft

I am facing the same. Will this deprecate ? If yes, then what I should use instead?

choudhary-github avatar Apr 25 '24 20:04 choudhary-github

same issue #4386

zkteco-home avatar Apr 26 '24 14:04 zkteco-home

same issue, same environment

sa1utep1z avatar Apr 28 '24 03:04 sa1utep1z

same issue here, any way to fix this?

keehui9292 avatar May 17 '24 02:05 keehui9292

You can ignore the warning until the following PR is merged and released https://github.com/callstack/react-native-paper/pull/4385

raajnadar avatar May 17 '24 06:05 raajnadar

i handle this warning

  1. go this address node_modules/react-native-paper/src/components/TextInput/Adornment/TextInputIcon.tsx
  2. comment These lines // TextInputIcon.defaultProps = { // forceTextInputFocus: true, // };

pooria226 avatar Jul 02 '24 06:07 pooria226

i handle this warning

  1. go this address node_modules/react-native-paper/src/components/TextInput/Adornment/TextInputIcon.tsx
  2. comment These lines // TextInputIcon.defaultProps = { // forceTextInputFocus: true, // };

Confirmed this works, thanks man!

dillontl avatar Jul 03 '24 03:07 dillontl

If I ignore this, will the error prevent me from publishing my app?

Donald646 avatar Jul 09 '24 15:07 Donald646

i handle this warning

  1. go this address node_modules/react-native-paper/src/components/TextInput/Adornment/TextInputIcon.tsx
  2. comment These lines // TextInputIcon.defaultProps = { // forceTextInputFocus: true, // };

still getting same issue

hashreepriya avatar Jul 18 '24 06:07 hashreepriya

Same issue

intentodepirata avatar Jul 28 '24 14:07 intentodepirata

i handle this warning

  1. go this address node_modules/react-native-paper/src/components/TextInput/Adornment/TextInputIcon.tsx
  2. comment These lines // TextInputIcon.defaultProps = { // forceTextInputFocus: true, // };

Before this current PR is merged and you really need this update up, you can use patch-package to apply a patch to the react-native-paper package, follow these steps:

If you are using yarn:

  1. Install patch-package and postinstall-postinstall as dev dependencies:

    yarn add patch-package postinstall-postinstall --dev
    

    postinstall-postinstall is used to ensure that patches are applied after each install.

  2. Create the Patch: First, modify the file node_modules/react-native-paper/src/components/TextInput/Adornment/TextInputIcon.tsx as suggested above, see lines 179-181:

    // TextInputIcon.defaultProps = {
    //   forceTextInputFocus: true,
    // };
    

    Then, create a patch file using patch-package. Run:

    npx patch-package react-native-paper
    

    This command will generate a patch file in the patches directory with a name like react-native-paper+<version>.patch.

  3. Add a Postinstall Script: Update your package.json to include a postinstall script that applies the patch automatically after each install. Add the following to your scripts section:

    "scripts": {
      "postinstall": "patch-package"
    }
    

    This script will ensure that your patches are applied after every yarn install.

You can verify your patch by installing the package again and checking if the changes you made are correctly applied to the node_modules directory. The lines should be commented out in TextInputIcon.tsx.

Remember to remove the patch after the fix to this issue has been released as a new version.

ttebify avatar Aug 19 '24 20:08 ttebify