From 64409359b33e2a50824b32e6fcb244ed57aa468d Mon Sep 17 00:00:00 2001 From: Fedor Katurov Date: Thu, 7 Nov 2019 16:51:03 +0700 Subject: [PATCH] fixed node rendering --- src/components/node/NodeImageSlideBlock/index.tsx | 6 +++--- src/containers/node/NodeLayout/index.tsx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/node/NodeImageSlideBlock/index.tsx b/src/components/node/NodeImageSlideBlock/index.tsx index cc29c1af..08ef1b80 100644 --- a/src/components/node/NodeImageSlideBlock/index.tsx +++ b/src/components/node/NodeImageSlideBlock/index.tsx @@ -77,11 +77,11 @@ const NodeImageSlideBlock: FC = ({ node, is_loading, updateLayout }) => const { width } = wrap.current.getBoundingClientRect(); + if (is_loading) return setHeight((width * 9) / 16); + const selected = Math.abs(-offset / width); - if (is_loading) { - return setHeight((width * 9) / 16); - } + if (!heights[Math.round(selected)]) return setHeight((width * 9) / 16); const prev = Math.max(heights[Math.floor(selected)] || 320, 320); const next = Math.max(heights[Math.ceil(selected)] || 320, 320); diff --git a/src/containers/node/NodeLayout/index.tsx b/src/containers/node/NodeLayout/index.tsx index 354df176..7c60d204 100644 --- a/src/containers/node/NodeLayout/index.tsx +++ b/src/containers/node/NodeLayout/index.tsx @@ -86,7 +86,7 @@ const NodeLayoutUnconnected: FC = memo( }, [nodeSetCoverImage, node.cover]); return ( - + {block && createElement(block, { node, is_loading, updateLayout, layout })}