Skip to content

Commit

Permalink
Improve dialogs issue (#2941)
Browse files Browse the repository at this point in the history
* Fix collapse, update backdrop color

* Remove test prop

* Remove debug code
  • Loading branch information
estrattonbailey authored Feb 20, 2024
1 parent b52a742 commit 8a169dc
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/components/Dialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export function Outer({
keyboardBlurBehavior="restore"
topInset={insets.top}
{...sheetOptions}
snapPoints={sheetOptions.snapPoints || ['100%']}
ref={sheet}
index={openIndex}
backgroundStyle={{backgroundColor: 'transparent'}}
Expand All @@ -99,6 +100,7 @@ export function Outer({
appearsOnIndex={0}
disappearsOnIndex={-1}
{...props}
style={[flatten(props.style), t.atoms.bg_contrast_300]}
/>
)}
handleIndicatorStyle={{backgroundColor: t.palette.primary_500}}
Expand All @@ -117,7 +119,7 @@ export function Outer({
},
]}
/>
{hasSnapPoints ? children : <View>{children}</View>}
{children}
</Context.Provider>
</BottomSheet>
</Portal>
Expand Down
43 changes: 38 additions & 5 deletions src/view/screens/Storybook/Dialogs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import * as Prompt from '#/components/Prompt'
import {useDialogStateControlContext} from '#/state/dialogs'

export function Dialogs() {
const control = Dialog.useDialogControl()
const scrollable = Dialog.useDialogControl()
const basic = Dialog.useDialogControl()
const prompt = Prompt.usePromptControl()
const {closeAllDialogs} = useDialogStateControlContext()

Expand All @@ -20,8 +21,31 @@ export function Dialogs() {
color="secondary"
size="small"
onPress={() => {
control.open()
scrollable.open()
prompt.open()
basic.open()
}}
label="Open basic dialog">
Open all dialogs
</Button>

<Button
variant="outline"
color="secondary"
size="small"
onPress={() => {
scrollable.open()
}}
label="Open basic dialog">
Open scrollable dialog
</Button>

<Button
variant="outline"
color="secondary"
size="small"
onPress={() => {
basic.open()
}}
label="Open basic dialog">
Open basic dialog
Expand All @@ -48,8 +72,17 @@ export function Dialogs() {
</Prompt.Actions>
</Prompt.Outer>

<Dialog.Outer control={basic}>
<Dialog.Handle />

<Dialog.Inner label="test">
<H3 nativeID="dialog-title">Dialog</H3>
<P nativeID="dialog-description">A basic dialog</P>
</Dialog.Inner>
</Dialog.Outer>

<Dialog.Outer
control={control}
control={scrollable}
nativeOptions={{sheet: {snapPoints: ['100%']}}}>
<Dialog.Handle />

Expand Down Expand Up @@ -77,9 +110,9 @@ export function Dialogs() {
variant="outline"
color="primary"
size="small"
onPress={() => control.close()}
onPress={() => scrollable.close()}
label="Open basic dialog">
Close basic dialog
Close dialog
</Button>
</View>
</View>
Expand Down

0 comments on commit 8a169dc

Please sign in to comment.