Closed vndpal closed 1 month ago
@vndpal actually it is due to a issue in react-native-paper library itself.
Thanks for the confirmation. I checked the issue in the react-native-paper library, it seems they have fixed this issue and will release it soon.
In the meantime, I did a workaround for react-native-paper-dropdown to continue working on my project.
I copied the files from the src
folder and manually added them to my project. Then in my local copy, I changed the problematic element <TextInput.Icon>
to <Icon/>
. Although it doesn't show the icons, dropdowns are working just fine.
function Dropdown(props: DropdownProps, ref: React.Ref<DropdownRef>) {
const {
options,
mode,
placeholder,
label,
menuUpIcon = <Icon source="camera" color={MD3Colors.error50} size={20} />, // changed this
menuDownIcon = <Icon source="camera" color={MD3Colors.error50} size={20} />, // and this
value,
onSelect,
maxMenuHeight,
menuContentStyle,
CustomDropdownItem = DropdownItem,
CustomDropdownInput = DropdownInput,
Touchable = TouchableRipple,
disabled = false,
error = false,
testID,
menuTestID,
} = props;
I will again install react-native-paper-dropdown
once the issue is fixed by react-native-paper.
Let me know if there is any better workaround. Thanks!
@vndpal i mean it is just a warning for now so you can either ignore that or if you don't want the icon you can replace it with Fragment also. Closing this as this issue has to be closed from react-native-paper.
Dropdown component is throwing an error as " ERROR Warning: TextInput.Icon: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead."
Sample usage:
library version: ^2.1.0 expo version: ^51.0.11