Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Fix error about being unable to pass ref to function component (#10707)
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy authored Apr 27, 2023
1 parent e1f7b0a commit 96bcfc5
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/components/views/messages/DecryptionFailureBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import React from "react";
import React, { forwardRef } from "react";
import { MatrixEvent } from "matrix-js-sdk/src/matrix";

import { _t } from "../../../languageHandler";
Expand All @@ -27,6 +27,12 @@ function getErrorMessage(mxEvent?: MatrixEvent): string {
}

// A placeholder element for messages that could not be decrypted
export function DecryptionFailureBody({ mxEvent }: Partial<IBodyProps>): JSX.Element {
return <div className="mx_DecryptionFailureBody mx_EventTile_content">{getErrorMessage(mxEvent)}</div>;
}
export const DecryptionFailureBody = forwardRef<HTMLDivElement, Partial<IBodyProps>>(
({ mxEvent }, ref): JSX.Element => {
return (
<div className="mx_DecryptionFailureBody mx_EventTile_content" ref={ref}>
{getErrorMessage(mxEvent)}
</div>
);
},
);

0 comments on commit 96bcfc5

Please sign in to comment.