Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
haileyok committed Oct 1, 2024
1 parent d0149a9 commit 40030ba
Showing 1 changed file with 7 additions and 32 deletions.
39 changes: 7 additions & 32 deletions src/components/Dialog/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {useImperativeHandle} from 'react'
import {ScrollView, StyleProp, View, ViewStyle} from 'react-native'
import {StyleProp, View, ViewStyle} from 'react-native'
import {useSafeAreaInsets} from 'react-native-safe-area-context'
import {
BottomSheetFlatList,
Expand All @@ -12,6 +12,7 @@ import {BlueskyBottomSheetView} from '@haileyok/bluesky-bottom-sheet'

import {logger} from '#/logger'
import {useDialogStateControlContext} from '#/state/dialogs'
import {ScrollView} from '#/view/com/util/Views'
import {atoms as a, flatten, useTheme} from '#/alf'
import {Context} from '#/components/Dialog/context'
import {
Expand Down Expand Up @@ -41,7 +42,6 @@ export function Outer({
const closeCallbacks = React.useRef<(() => void)[]>([])
const {setDialogIsOpen} = useDialogStateControlContext()
// @TODO DIALOG REFACTOR - can i get rid of this? seems pointless tbh
const [isOpen, setIsOpen] = React.useState(false)

const callQueuedCallbacks = React.useCallback(() => {
for (const cb of closeCallbacks.current) {
Expand All @@ -58,14 +58,12 @@ export function Outer({
const open = React.useCallback<DialogControlProps['open']>(() => {
// Run any leftover callbacks that might have been queued up before calling `.open()`
callQueuedCallbacks()
setIsOpen(true)
setDialogIsOpen(control.id, true)
ref.current?.present()
}, [setDialogIsOpen, control.id, callQueuedCallbacks])

// This is the function that we call when we want to dismiss the dialog.
const close = React.useCallback<DialogControlProps['close']>(cb => {
setIsOpen(false)
if (typeof cb === 'function') {
closeCallbacks.current.push(cb)
}
Expand Down Expand Up @@ -106,26 +104,15 @@ export function Outer({
<BlueskyBottomSheetView
// handleIndicatorStyle={{backgroundColor: t.palette.primary_500}} // @TODO DIALOG REFACTOR need to add this to lib!*/
ref={ref}
topInset={insets.top}
topInset={30}
bottomInset={insets.bottom}
onStateChange={e => {
if (e.nativeEvent.state === 'closed') {
onCloseAnimationComplete()
}
}}>
}}
cornerRadius={20}>
<View testID={testID} style={[t.atoms.bg]}>
{/*<View*/}
{/* style={[*/}
{/* a.absolute,*/}
{/* a.inset_0,*/}
{/* t.atoms.bg,*/}
{/* {*/}
{/* borderTopLeftRadius: 40,*/}
{/* borderTopRightRadius: 40,*/}
{/* height: Dimensions.get('window').height * 2,*/}
{/* },*/}
{/* ]}*/}
{/*/>*/}
{children}
</View>
</BlueskyBottomSheetView>
Expand Down Expand Up @@ -158,22 +145,10 @@ export const ScrollableInner = React.forwardRef<ScrollView, DialogInnerProps>(
function ScrollableInner({children, style}, ref) {
const insets = useSafeAreaInsets()
return (
<View
// style={[
// a.p_xl,
// a.h_full,
// {
// paddingTop: 40,
// borderTopLeftRadius: 40,
// borderTopRightRadius: 40,
// },
// style,
// ]}
// ref={ref}
>
<ScrollView style={[a.px_xl, style]} ref={ref}>
{children}
<View style={{height: insets.bottom + a.pt_5xl.paddingTop}} />
</View>
</ScrollView>
)
},
)
Expand Down

0 comments on commit 40030ba

Please sign in to comment.