primefaces / primereact

The Most Complete React UI Component Library
https://primereact.org
MIT License
6.68k stars 1.01k forks source link

Warning: React does not recognize the `iconPosition` prop on a DOM element. (v10.8.3) #7219

Open lekhnath opened 1 week ago

lekhnath commented 1 week ago

Describe the bug

React does not recognize the iconPosition prop on a DOM element when iconPosition prop in IconField is used with AutoComplete component.

Reproducer

https://stackblitz.com/edit/vitejs-vite-o12afk

System Information

react: 18.3.1
primereact: 10.8.3
typescript: 5.6.2

Steps to reproduce the behavior

  1. Go to issue reproducer link
  2. Inspect the console.

Expected behavior

AutoComplete and IconField are not composable. We should be able to combine any React component with any other component seamlessly.

melloware commented 1 week ago

Looks like the IconField just blindly puts the iconPosition on all child elements.

<div {...rootProps} ref={elementRef}>
                {Children.map(props.children, (child, index) =>
                    cloneElement(child, {
                        iconPosition: props.iconPosition
                    })
                )}
            </div>