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, 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. * 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, 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. * 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> { class JitsiModal extends PureComponent<Props> {
static defaultProps = { static defaultProps = {
position: 'bottom' position: 'bottom',
hideHeaderWithNavigation: false
}; };
/** /**
@ -111,7 +112,7 @@ class JitsiModal extends PureComponent<Props> {
footerComponent, footerComponent,
headerProps, headerProps,
position, position,
showHeaderWithNavigation, hideHeaderWithNavigation,
style style
} = this.props; } = this.props;
@ -132,10 +133,10 @@ class JitsiModal extends PureComponent<Props> {
_styles.page, _styles.page,
style style
] }> ] }>
{showHeaderWithNavigation <HeaderWithNavigation
&& <HeaderWithNavigation
{ ...headerProps } { ...headerProps }
onPressBack = { this._onRequestClose } />} hideHeaderWithNavigation = { hideHeaderWithNavigation }
onPressBack = { this._onRequestClose } />
<SafeAreaView style = { styles.safeArea }> <SafeAreaView style = { styles.safeArea }>
{ children } { children }
</SafeAreaView> </SafeAreaView>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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