diff --git a/samples/react-list-form/src/webparts/listForm/components/ListForm.tsx b/samples/react-list-form/src/webparts/listForm/components/ListForm.tsx index 359b08bad..2a3e02e16 100644 --- a/samples/react-list-form/src/webparts/listForm/components/ListForm.tsx +++ b/samples/react-list-form/src/webparts/listForm/components/ListForm.tsx @@ -1,4 +1,5 @@ import * as React from 'react'; +import { autobind } from 'office-ui-fabric-react/lib/Utilities'; import { IFieldConfiguration } from './IFieldConfiguration'; import { IListFormProps } from './IListFormProps'; import { IListFormState } from './IListFormState'; @@ -232,7 +233,8 @@ class ListForm extends React.Component { } } - private readSchema = async (listUrl: string, formType: ControlMode): Promise => { + @autobind + private async readSchema(listUrl: string, formType: ControlMode): Promise { try { if (!listUrl) { this.setState({ ...this.state, isLoadingSchema: false, fieldsSchema: null, errors: [strings.ConfigureListMessage] }); @@ -291,7 +293,8 @@ class ListForm extends React.Component { } } - private readData = async (listUrl: string, formType: ControlMode, id?: number): Promise => { + @autobind + private async readData(listUrl: string, formType: ControlMode, id?: number): Promise { try { if ((formType === ControlMode.New) || !id) { const data = this.state.fieldsSchema @@ -330,7 +333,8 @@ class ListForm extends React.Component { } } - private valueChanged = async (fieldName: string, newValue: any) => { + @autobind + private async valueChanged(fieldName: string, newValue: any) { let schema = this.state.fieldsSchema.filter((item) => item.InternalName === fieldName)[0]; if (schema.Type == "User" || schema.Type === "UserMulti") { for (let i = 0; i < newValue.length; i++) {