Cleanup unused props from dialogs (#5665)

This commit is contained in:
Hailey
2024-10-09 14:50:54 -07:00
committed by GitHub
parent 86b0d3b498
commit 9f070cd9cd
7 changed files with 15 additions and 35 deletions
+11 -11
View File
@@ -153,18 +153,18 @@ export function Outer({
)
return (
<Context.Provider value={context}>
<BottomSheet
ref={ref}
cornerRadius={20}
backgroundColor={t.atoms.bg.backgroundColor}
{...nativeOptions}
onSnapPointChange={onSnapPointChange}
onStateChange={onStateChange}
disableDrag={disableDrag}>
<BottomSheet
ref={ref}
cornerRadius={20}
backgroundColor={t.atoms.bg.backgroundColor}
{...nativeOptions}
onSnapPointChange={onSnapPointChange}
onStateChange={onStateChange}
disableDrag={disableDrag}>
<Context.Provider value={context}>
<View testID={testID}>{children}</View>
</BottomSheet>
</Context.Provider>
</Context.Provider>
</BottomSheet>
)
}
-2
View File
@@ -6,7 +6,6 @@ import type {
} from 'react-native'
import {ViewStyleProp} from '#/alf'
import {PortalComponent} from '#/components/Portal'
import {BottomSheetViewProps} from '../../../modules/bottom-sheet'
import {BottomSheetSnapPoint} from '../../../modules/bottom-sheet/src/BottomSheet.types'
@@ -61,7 +60,6 @@ export type DialogOuterProps = {
nativeOptions?: Omit<BottomSheetViewProps, 'children'>
webOptions?: {}
testID?: string
Portal?: PortalComponent
}
type DialogInnerPropsBase<T> = React.PropsWithChildren<ViewStyleProp> & T
+1 -5
View File
@@ -18,7 +18,6 @@ import {
ItemTextProps,
TriggerProps,
} from '#/components/Menu/types'
import {PortalComponent} from '#/components/Portal'
import {Text} from '#/components/Typography'
export {
@@ -78,11 +77,9 @@ export function Trigger({children, label}: TriggerProps) {
export function Outer({
children,
showCancel,
Portal,
}: React.PropsWithChildren<{
showCancel?: boolean
style?: StyleProp<ViewStyle>
Portal?: PortalComponent
}>) {
const context = React.useContext(Context)
const {_} = useLingui()
@@ -90,8 +87,7 @@ export function Outer({
return (
<Dialog.Outer
control={context.control}
nativeOptions={{preventExpansion: true}}
Portal={Portal}>
nativeOptions={{preventExpansion: true}}>
<Dialog.Handle />
{/* Re-wrap with context since Dialogs are portal-ed to root */}
<Context.Provider value={context}>
-2
View File
@@ -12,8 +12,6 @@ type ComponentMap = {
[id: string]: Component
}
export type PortalComponent = ({children}: {children?: React.ReactNode}) => null
export function createPortalGroup() {
const Context = React.createContext<ContextType>({
outlet: null,
+1 -7
View File
@@ -6,7 +6,6 @@ import {useLingui} from '@lingui/react'
import {atoms as a, useBreakpoints, useTheme} from '#/alf'
import {Button, ButtonColor, ButtonText} from '#/components/Button'
import * as Dialog from '#/components/Dialog'
import {PortalComponent} from '#/components/Portal'
import {Text} from '#/components/Typography'
import {BottomSheetViewProps} from '../../modules/bottom-sheet'
@@ -27,12 +26,10 @@ export function Outer({
children,
control,
testID,
Portal,
nativeOptions,
}: React.PropsWithChildren<{
control: Dialog.DialogControlProps
testID?: string
Portal?: PortalComponent
nativeOptions?: Omit<BottomSheetViewProps, 'children'>
}>) {
const {gtMobile} = useBreakpoints()
@@ -48,7 +45,6 @@ export function Outer({
<Dialog.Outer
control={control}
testID={testID}
Portal={Portal}
nativeOptions={{preventExpansion: true, ...nativeOptions}}>
<Dialog.Handle />
<Context.Provider value={context}>
@@ -190,7 +186,6 @@ export function Basic({
onConfirm,
confirmButtonColor,
showCancel = true,
Portal,
}: React.PropsWithChildren<{
control: Dialog.DialogOuterProps['control']
title: string
@@ -207,10 +202,9 @@ export function Basic({
onConfirm: (e: GestureResponderEvent) => void
confirmButtonColor?: ButtonColor
showCancel?: boolean
Portal?: PortalComponent
}>) {
return (
<Outer control={control} testID="confirmModal" Portal={Portal}>
<Outer control={control} testID="confirmModal">
<TitleText>{title}</TitleText>
<DescriptionText>{description}</DescriptionText>
<Actions>