feat(native-participants-pane) simplified props for hiding header with navigation

This commit is contained in:
Calin Chitu 2021-06-02 13:25:32 +03:00 committed by Hristo Terezov
parent ee101f8947
commit 24550777c6
9 changed files with 35 additions and 30 deletions

View File

@ -50,6 +50,11 @@ type Props = {
*/
headerProps: Object,
/**
* True if the header with navigation should be hidden, false otherwise.
*/
hideHeaderWithNavigation?: boolean,
/**
* The ID of the modal that is being rendered. This is used to show/hide the modal.
*/
@ -66,11 +71,6 @@ type Props = {
*/
position?: string,
/**
* True if the header with navigation should be shown, false otherwise.
*/
showHeaderWithNavigation: boolean,
/**
* Additional style to be appended to the View containing the content of the modal.
*/
@ -83,7 +83,8 @@ type Props = {
*/
class JitsiModal extends PureComponent<Props> {
static defaultProps = {
position: 'bottom'
position: 'bottom',
hideHeaderWithNavigation: false
};
/**
@ -111,7 +112,7 @@ class JitsiModal extends PureComponent<Props> {
footerComponent,
headerProps,
position,
showHeaderWithNavigation,
hideHeaderWithNavigation,
style
} = this.props;
@ -132,10 +133,10 @@ class JitsiModal extends PureComponent<Props> {
_styles.page,
style
] }>
{showHeaderWithNavigation
&& <HeaderWithNavigation
<HeaderWithNavigation
{ ...headerProps }
onPressBack = { this._onRequestClose } />}
hideHeaderWithNavigation = { hideHeaderWithNavigation }
onPressBack = { this._onRequestClose } />
<SafeAreaView style = { styles.safeArea }>
{ children }
</SafeAreaView>

View File

@ -27,6 +27,11 @@ type Props = {
*/
headerLabelKey: ?string,
/**
* True if the header with navigation should be hidden, false otherwise.
*/
hideHeaderWithNavigation?: boolean,
/**
* Callback to be invoked on pressing the back button.
*/
@ -48,10 +53,13 @@ class HeaderWithNavigation extends Component<Props> {
* @inheritdoc
*/
render() {
const { onPressBack, onPressForward } = this.props;
const { hideHeaderWithNavigation, onPressBack, onPressForward } = this.props;
return (
<Header>
<>
{
!hideHeaderWithNavigation
&& <Header>
{ onPressBack && <BackButton onPress = { onPressBack } /> }
<HeaderLabel labelKey = { this.props.headerLabelKey } />
{ onPressForward && <ForwardButton
@ -59,6 +67,8 @@ class HeaderWithNavigation extends Component<Props> {
labelKey = { this.props.forwardLabelKey }
onPress = { onPressForward } /> }
</Header>
}
</>
);
}
}

View File

@ -44,8 +44,7 @@ class Chat extends AbstractChat<Props> {
headerLabelKey: 'chat.title'
}}
modalId = { CHAT_VIEW_MODAL_ID }
onClose = { this._onClose }
showHeaderWithNavigation = { true }>
onClose = { this._onClose }>
<MessageContainer messages = { this.props._messages } />
<MessageRecipient />

View File

@ -78,7 +78,6 @@ class SharedDocument extends PureComponent<Props> {
headerLabelKey: 'documentSharing.title'
}}
modalId = { SHARE_DOCUMENT_VIEW_ID }
showHeaderWithNavigation = { true }
style = { styles.webView }>
<WebView
onError = { this._onError }

View File

@ -33,8 +33,7 @@ class HelpView extends PureComponent<Props> {
headerProps = {{
headerLabelKey: 'helpView.header'
}}
modalId = { HELP_VIEW_MODAL_ID }
showHeaderWithNavigation = { true }>
modalId = { HELP_VIEW_MODAL_ID }>
<WebView source = {{ uri: this.props._url }} />
</JitsiModal>
);

View File

@ -176,8 +176,7 @@ class AddPeopleDialog extends AbstractAddPeopleDialog<Props, State> {
headerLabelKey: 'inviteDialog.header',
onPressForward: this._onInvite
}}
modalId = { ADD_PEOPLE_DIALOG_VIEW_ID }
showHeaderWithNavigation = { true }>
modalId = { ADD_PEOPLE_DIALOG_VIEW_ID }>
<View
style = { styles.searchFieldWrapper }>
<View style = { styles.searchIconWrapper }>

View File

@ -58,7 +58,6 @@ class DialInSummary extends Component<Props> {
headerLabelKey: 'info.label'
}}
modalId = { DIAL_IN_SUMMARY_VIEW_ID }
showHeaderWithNavigation = { true }
style = { styles.backDrop }>
<WebView
onError = { this._onError }

View File

@ -32,7 +32,7 @@ export function ParticipantsPane() {
return (
<JitsiModal
showHeaderWithNavigation = { false }
hideHeaderWithNavigation = { true }
style = { styles.participantsPane }>
<View style = { styles.header }>
<Button

View File

@ -158,8 +158,7 @@ class SettingsView extends AbstractSettingsView<Props, State> {
headerLabelKey: 'settingsView.header'
}}
modalId = { SETTINGS_VIEW_ID }
onClose = { this._onClose }
showHeaderWithNavigation = { true }>
onClose = { this._onClose }>
<ScrollView>
<FormSectionAccordion
accordion = { false }