Ad

Extending People Picker To Include Form Items Like Labels, Input Boxes And Buttons

- 1 answer

I can finally use a people picker to update a SharePoint list.

How can I extend it to use form elements such as labels, buttons and input boxes?

I saw this code, but it underlines the this.props.data.Name with a message:

property data does not exist on type 'readonly'.

It also underlines onChange saying it doesn't exist on type readonly.

    private _onChange = (e: React.KeyboardEvent) => {
       const name = this.props.data.Name;
       const value = (e.target as HTMLInputElement).value;
       this.props.onChange(name, value);
    }   

This is the beginning of my class including the constructor. I'm worried that if I add more properties to the interface, I could stop the people picker working.

     export default class PnPPeoplePicker extends React.Component<IPnPPeoplePickerProps, IPnPPeoplePickerState> {  
       constructor(props: IPnPPeoplePickerProps, state: IPnPPeoplePickerState) 
       {
         super(props);

         this.state = {
           addUsers: []
         };
       }
Ad

Answer

Ad
source: stackoverflow.com
Ad