Skip to content

IncubatorDialog - add topAccessory #2621

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/incubator/Dialog/DialogHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ const DialogHeader = (props: DialogHeaderProps = {}) => {
showDivider = true,
leadingAccessory,
trailingAccessory,
topAccessory,
bottomAccessory,
contentContainerStyle,
onPress,
bottomAccessory,
style,
...others
} = props;
Expand Down Expand Up @@ -75,10 +76,11 @@ const DialogHeader = (props: DialogHeaderProps = {}) => {
}
}, [showDivider]);

if (knob || content || bottomAccessory || divider) {
if (knob || content || topAccessory || bottomAccessory || divider) {
return (
<View {...others} style={style}>
{knob}
{topAccessory}
{content}
{bottomAccessory}
{divider}
Expand Down
19 changes: 11 additions & 8 deletions src/incubator/Dialog/dialogHeader.api.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@
{"name": "showDivider", "type": "boolean", "description": "Show the header's divider", "default": "true"},
{"name": "leadingAccessory", "type": "ReactElement", "description": "Pass to render a leading element"},
{"name": "trailingAccessory", "type": "ReactElement", "description": "Pass to render a trailing element"},
{
"name": "topAccessory",
"type": "ReactElement",
"description": "Pass to render a top element above the title"
},
{
"name": "bottomAccessory",
"type": "ReactElement",
"description": "Pass to render a bottom element below the subtitle"
},
{
"name": "contentContainerStyle",
"type": "ViewProps['style']",
Expand All @@ -22,14 +32,7 @@
"name": "onPress",
"type": "() => void",
"description": "onPress callback for the inner content"
},
{
"name": "bottomAccessory",
"type": "ReactElement",
"description": "Pass to render a bottom element below the input"
}
],
"snippet": [
"<Dialog.Header title={'Title'$1} subtitle={'Subtitle'$2} trailingAccessory={renderAccessory$3}/>"
]
"snippet": ["<Dialog.Header title={'Title'$1} subtitle={'Subtitle'$2} trailingAccessory={renderAccessory$3}/>"]
}
14 changes: 9 additions & 5 deletions src/incubator/Dialog/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,21 @@ export interface DialogHeaderProps extends ViewProps {
*/
trailingAccessory?: ReactElement;
/**
* Style for the leading + content + trailing components (without the bottomAccessory)
* Pass to render a top element above the title
*/
topAccessory?: ReactElement;
/**
* Pass to render a bottom element below the subtitle
*/
bottomAccessory?: ReactElement;
/**
* Style for the leading + content + trailing components (without the topAccessory\bottomAccessory)
*/
contentContainerStyle?: ViewProps['style'];
/**
* onPress callback for the inner content
*/
onPress?: () => void;
/**
* Pass to render a bottom element below the input
*/
bottomAccessory?: ReactElement;
}

export interface _DialogProps extends AlignmentModifiers, Pick<ViewProps, 'useSafeArea'> {
Expand Down