Refactor lightbox prop drilling (#6073)
* Refactor lightbox footer to render prop * Unify lightbox types * Unindent * Refactor LightboxFooter props * Move LightboxFooter into the implementation file
This commit is contained in:
+3
-20
@@ -1,32 +1,15 @@
|
||||
import React from 'react'
|
||||
import type {MeasuredDimensions} from 'react-native-reanimated'
|
||||
import {AppBskyActorDefs} from '@atproto/api'
|
||||
|
||||
import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback'
|
||||
import {Dimensions} from '#/lib/media/types'
|
||||
import {ImageSource} from '#/view/com/lightbox/ImageViewing/@types'
|
||||
|
||||
type ProfileImageLightbox = {
|
||||
type: 'profile-image'
|
||||
profile: AppBskyActorDefs.ProfileViewDetailed
|
||||
thumbDims: null
|
||||
}
|
||||
|
||||
type ImagesLightboxItem = {
|
||||
uri: string
|
||||
thumbUri: string
|
||||
alt?: string
|
||||
dimensions: Dimensions | null
|
||||
}
|
||||
|
||||
type ImagesLightbox = {
|
||||
type: 'images'
|
||||
images: ImagesLightboxItem[]
|
||||
type Lightbox = {
|
||||
images: ImageSource[]
|
||||
thumbDims: MeasuredDimensions | null
|
||||
index: number
|
||||
}
|
||||
|
||||
type Lightbox = ProfileImageLightbox | ImagesLightbox
|
||||
|
||||
const LightboxContext = React.createContext<{
|
||||
activeLightbox: Lightbox | null
|
||||
}>({
|
||||
|
||||
Reference in New Issue
Block a user