Skip to content
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

feat: added headerTitleTestID prop to HeaderOptions and implemented it #11559

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/elements/src/Header/Header.tsx
Expand Up @@ -53,6 +53,7 @@ export function Header(props: Props) {
modal = false,
title,
headerTitle: customTitle,
headerTitleTestID,
headerTitleAlign = Platform.select({
ios: 'center',
default: 'left',
Expand Down Expand Up @@ -272,6 +273,7 @@ export function Header(props: Props) {
allowFontScaling: titleAllowFontScaling,
tintColor: headerTintColor,
style: titleStyle,
testID: headerTitleTestID,
})}
</Animated.View>
<Animated.View
Expand Down
8 changes: 8 additions & 0 deletions packages/elements/src/types.tsx
Expand Up @@ -17,6 +17,10 @@ export type HeaderOptions = {
* The title string is passed in `children`.
*/
headerTitle?: string | ((props: HeaderTitleProps) => React.ReactNode);
/**
* ID to locate the header in tests.
*/
headerTitleTestID?: string;
/**
* How to align the the header title.
* Defaults to `center` on iOS and `left` on Android.
Expand Down Expand Up @@ -145,6 +149,10 @@ export type HeaderTitleProps = {
* Style object for the title element.
*/
style?: Animated.WithAnimatedValue<StyleProp<TextStyle>>;
/**
* ID to locate the header title in tests.
*/
testID?: string;
};

export type HeaderButtonProps = {
Expand Down