diff options
author | dan <dan.abramov@gmail.com> | 2024-11-04 21:31:21 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-04 21:31:21 +0000 |
commit | 26c48373e29643ca7a3248315506131d53d05b8b (patch) | |
tree | 7931136c51cf779cad1a94cce28af78cc7cb0c6e /src/view/com/lightbox/Lightbox.web.tsx | |
parent | 174988bc5ab00774d200a882312985f55d903d81 (diff) | |
download | voidsky-26c48373e29643ca7a3248315506131d53d05b8b.tar.zst |
Refactor lightbox prop drilling (#6073)
* Refactor lightbox footer to render prop * Unify lightbox types * Unindent * Refactor LightboxFooter props * Move LightboxFooter into the implementation file
Diffstat (limited to 'src/view/com/lightbox/Lightbox.web.tsx')
-rw-r--r-- | src/view/com/lightbox/Lightbox.web.tsx | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/src/view/com/lightbox/Lightbox.web.tsx b/src/view/com/lightbox/Lightbox.web.tsx index 9a0fa5d33..2ba7d06cc 100644 --- a/src/view/com/lightbox/Lightbox.web.tsx +++ b/src/view/com/lightbox/Lightbox.web.tsx @@ -38,24 +38,8 @@ export function Lightbox() { return null } - const initialIndex = - activeLightbox.type === 'images' ? activeLightbox.index : 0 - - let imgs: Img[] | undefined - if (activeLightbox.type === 'profile-image') { - const opts = activeLightbox - if (opts.profile.avatar) { - imgs = [{uri: opts.profile.avatar}] - } - } else if (activeLightbox.type === 'images') { - const opts = activeLightbox - imgs = opts.images - } - - if (!imgs) { - return null - } - + const initialIndex = activeLightbox.index + const imgs = activeLightbox.images return ( <LightboxInner imgs={imgs} |