From 8b60cef7c2cbad2f4bcd982808e499a0388a93fd Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Fri, 25 Feb 2022 22:52:19 +0200 Subject: [PATCH] Transition: Allow static children --- .../common/MessageOutgoingStatus.tsx | 4 +- src/components/common/ProfileInfo.tsx | 2 +- .../left/ConnectionStatusOverlay.tsx | 2 +- src/components/left/main/Badge.tsx | 2 +- src/components/left/main/LeftMainHeader.tsx | 12 +- src/components/left/search/LeftSearch.tsx | 4 +- src/components/mediaViewer/MediaViewer.tsx | 168 ++++++++------- .../mediaViewer/SlideTransition.tsx | 4 +- src/components/middle/MiddleColumn.tsx | 196 +++++++++--------- src/components/middle/MiddleHeader.tsx | 2 +- src/components/payment/PaymentModal.tsx | 8 +- src/components/right/Profile.tsx | 2 +- src/components/right/RightHeader.tsx | 2 +- src/components/ui/SearchInput.tsx | 4 +- src/components/ui/ShowTransition.tsx | 7 +- src/components/ui/Transition.tsx | 12 +- 16 files changed, 209 insertions(+), 222 deletions(-) diff --git a/src/components/common/MessageOutgoingStatus.tsx b/src/components/common/MessageOutgoingStatus.tsx index f86c6881f..4f86957d2 100644 --- a/src/components/common/MessageOutgoingStatus.tsx +++ b/src/components/common/MessageOutgoingStatus.tsx @@ -18,9 +18,7 @@ const MessageOutgoingStatus: FC = ({ status }) => { return (
- {() => ( - - )} +
); diff --git a/src/components/common/ProfileInfo.tsx b/src/components/common/ProfileInfo.tsx index 916267795..2426a08ef 100644 --- a/src/components/common/ProfileInfo.tsx +++ b/src/components/common/ProfileInfo.tsx @@ -191,7 +191,7 @@ const ProfileInfo: FC = ({
{renderPhotoTabs()} - {renderPhoto} + {renderPhoto()} {!isFirst && ( diff --git a/src/components/left/ConnectionStatusOverlay.tsx b/src/components/left/ConnectionStatusOverlay.tsx index 5e513b68d..72cee0b13 100644 --- a/src/components/left/ConnectionStatusOverlay.tsx +++ b/src/components/left/ConnectionStatusOverlay.tsx @@ -27,7 +27,7 @@ const ConnectionStatusOverlay: FC = ({
- {() => connectionStatusText} + {connectionStatusText}
diff --git a/src/components/left/search/LeftSearch.tsx b/src/components/left/search/LeftSearch.tsx index 724dd31b7..121ecd5be 100644 --- a/src/components/left/search/LeftSearch.tsx +++ b/src/components/left/search/LeftSearch.tsx @@ -90,7 +90,7 @@ const LeftSearch: FC = ({ renderCount={TRANSITION_RENDER_COUNT} activeKey={currentContent} > - {() => { + {(() => { switch (currentContent) { case GlobalSearchContent.ChatList: if (chatId) { @@ -136,7 +136,7 @@ const LeftSearch: FC = ({ default: return undefined; } - }} + })()} ); diff --git a/src/components/mediaViewer/MediaViewer.tsx b/src/components/mediaViewer/MediaViewer.tsx index 3ed92730b..0300e9b71 100644 --- a/src/components/mediaViewer/MediaViewer.tsx +++ b/src/components/mediaViewer/MediaViewer.tsx @@ -461,96 +461,92 @@ const MediaViewer: FC = ({ className={isZoomed ? 'zoomed' : ''} isOpen={isOpen} > - {() => ( - <> -
- {IS_SINGLE_COLUMN_LAYOUT && ( - - )} - - {renderSenderInfo} - - -
- + {IS_SINGLE_COLUMN_LAYOUT && ( + + )} + + {renderSenderInfo()} + + + + + + {(isActive: boolean) => ( + )} - {!isLast && !IS_TOUCH_ENV && ( - - - )} - {isMessagingDisabled && ( -
-
- - {messageSendingRestrictionReason} - -
-
- )} - {IS_SINGLE_COLUMN_LAYOUT && renderingCanSubscribe && ( -
- -
- )} - {IS_SINGLE_COLUMN_LAYOUT && renderingCanStartBot && ( -
- -
- )} - {IS_SINGLE_COLUMN_LAYOUT && renderingCanRestartBot && ( -
- -
- )} - - - - - + )} + {isPinnedMessageList && ( +
+
- - )} + )} + {isMessagingDisabled && ( +
+
+ + {messageSendingRestrictionReason} + +
+
+ )} + {IS_SINGLE_COLUMN_LAYOUT && renderingCanSubscribe && ( +
+ +
+ )} + {IS_SINGLE_COLUMN_LAYOUT && renderingCanStartBot && ( +
+ +
+ )} + {IS_SINGLE_COLUMN_LAYOUT && renderingCanRestartBot && ( +
+ +
+ )} + + + + + + = ({ name={shouldSkipHistoryAnimations ? 'none' : 'slide-fade'} activeKey={currentTransitionKey} > - {renderInfo} + {renderInfo()} = ({ {step !== undefined ? ( - {() => ( -
- {renderModalContent(step)} -
- )} +
+ {renderModalContent(step)} +
) : (
diff --git a/src/components/right/Profile.tsx b/src/components/right/Profile.tsx index 3a7fd7907..02c3830a8 100644 --- a/src/components/right/Profile.tsx +++ b/src/components/right/Profile.tsx @@ -445,7 +445,7 @@ const Profile: FC = ({ onStart={applyTransitionFix} onStop={handleTransitionStop} > - {renderContent} + {renderContent()}
diff --git a/src/components/right/RightHeader.tsx b/src/components/right/RightHeader.tsx index 86b068845..54a859a65 100644 --- a/src/components/right/RightHeader.tsx +++ b/src/components/right/RightHeader.tsx @@ -428,7 +428,7 @@ const RightHeader: FC = ({ name={(shouldSkipTransition || shouldSkipAnimation) ? 'none' : 'slide-fade'} activeKey={renderingContentKey} > - {renderHeaderContent} + {renderHeaderContent()} ); diff --git a/src/components/ui/SearchInput.tsx b/src/components/ui/SearchInput.tsx index 8cd2cbaf5..a09650d14 100644 --- a/src/components/ui/SearchInput.tsx +++ b/src/components/ui/SearchInput.tsx @@ -134,9 +134,7 @@ const SearchInput: FC = ({ /> - {() => ( - - )} + {!isLoading && (value || canClose) && onReset && (