From dbe6465e864e6dcc4e030f689ddc431be853aaa0 Mon Sep 17 00:00:00 2001 From: Artur Yorsh Date: Tue, 18 Jun 2019 20:35:25 +0300 Subject: [PATCH] refactor(layout): chat1 navigation options --- .../messaging/chat1/chat1.container.tsx | 26 +++++-------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/src/containers/layouts/messaging/chat1/chat1.container.tsx b/src/containers/layouts/messaging/chat1/chat1.container.tsx index dc5391bdf..069310710 100644 --- a/src/containers/layouts/messaging/chat1/chat1.container.tsx +++ b/src/containers/layouts/messaging/chat1/chat1.container.tsx @@ -34,36 +34,24 @@ export class Chat1Container extends React.Component = ({ navigation, screenProps }) => { - const user: Profile = navigation.getParam('interlocutor'); - const date: string = navigation.getParam('lastSeen'); - const interlocutor: Profile = user ? user : conversation5.interlocutor; - const lastSeen: string = date ? date : 'today'; - const chatHeaderConfig: ChatHeaderNavigationStateParams = { - interlocutor: interlocutor, - lastSeen: lastSeen, + + const headerProps: ChatHeaderNavigationStateParams = { + interlocutor: navigation.getParam('interlocutor', conversation5.interlocutor), + lastSeen: navigation.getParam('lastSeen', 'today'), onBack: navigation.getParam('onBack'), onProfile: navigation.getParam('onProfile'), }; - const renderHeader = (headerProps: NavigationScreenProps, config: ChatHeaderNavigationStateParams) => { + const header = (navigationProps: NavigationScreenProps) => { return ( ); }; - return { - ...navigation, - ...screenProps, - header: (headerProps: NavigationScreenProps): TopNavigationElement => { - return renderHeader(headerProps, chatHeaderConfig); - }, - }; + return { ...navigation, ...screenProps, header }; }; public componentWillMount(): void {