callstack / react-native-paper

Material Design for React Native (Android & iOS)
https://reactnativepaper.com
MIT License
12.37k stars 2.04k forks source link

React depreciation warning of defaultProps occurring on TextInput.Icon (Suggested solution) #4402

Closed sethimcclaine closed 3 weeks ago

sethimcclaine commented 3 weeks ago

Current behaviour

Updating to "react-native": "0.74.1 / "react": "18.2.0" results in depreciation warning of defaultProps

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

This is noticed in TextInput.Icon, but grepping code base for defaultProps will likely reveal other instances

Expected behaviour

No deprication warnings

How to reproduce?

Preview

Screenshot 2024-05-09 at 10 50 26 AM

What have you tried so far?

updating src/components/TextInput/Adornment/TextInputIcon.tsx

ln 132
+ forceTextInputFocus = true,
- forceTextInputFocus,
ln 179-180
- TextInputIcon.defaultProps = {
-   forceTextInputFocus: true,
- };

Your Environment

software version
ios x
android x
react-native x.x.x
react-native-paper x.x.x
node x.x.x
npm or yarn x.x.x
expo sdk x.x.x
gedu commented 3 weeks ago

Already in a PR: https://github.com/callstack/react-native-paper/pull/4385, Closing to avoid duplication