Add options to hide header and composer of room view for the module api (#31095)

* feat: add props to hide header in `RoomView`

* feat: add props to hide composer in `RoomView`

* feat: pass `RoomViewProps` to room view in `renderRoomView`

* refactor: add doc and use existing types

* test: add tests for new room view props
This commit is contained in:
Florian Duros
2025-11-05 13:52:10 +01:00
committed by GitHub
parent 52eb8a9979
commit 4d66a85e73
4 changed files with 491 additions and 29 deletions

View File

@@ -165,6 +165,16 @@ interface IRoomProps extends RoomViewProps {
* Omitting this will mean that RoomView renders for the room held in SDKContext.RoomViewStore.
*/
roomId?: string;
/*
* If true, hide the header
*/
hideHeader?: boolean;
/*
* If true, hide the composer
*/
hideComposer?: boolean;
}
export { MainSplitContentType };
@@ -2455,6 +2465,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
let messageComposer;
const showComposer =
!this.props.hideComposer &&
!isRoomEncryptionLoading &&
// joined and not showing search results
myMembership === KnownMembership.Join &&
@@ -2665,10 +2676,12 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
ref={this.roomViewBody}
data-layout={this.state.layout}
>
<RoomHeader
room={this.state.room}
additionalButtons={this.state.viewRoomOpts.buttons}
/>
{!this.props.hideHeader && (
<RoomHeader
room={this.state.room}
additionalButtons={this.state.viewRoomOpts.buttons}
/>
)}
{mainSplitBody}
</div>
</MainSplit>