Skip to content

Commit

Permalink
feat: allow style overrides for HeaderBackButton (#8626)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreibarabas authored Jul 28, 2020
1 parent 0d6a43f commit 486c3de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/stack/src/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,10 @@ export type StackHeaderLeftButtonProps = {
* Accessibility label for the button for screen readers.
*/
accessibilityLabel?: string;
/**
* Style object for the button.
*/
style?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
};

export type StackHeaderTitleProps = {
Expand Down
3 changes: 2 additions & 1 deletion packages/stack/src/views/Header/HeaderBackButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default function HeaderBackButton({
titleLayout,
truncatedLabel = 'Back',
accessibilityLabel = label && label !== 'Back' ? `${label}, back` : 'Go back',
style,
}: Props) {
const { dark, colors } = useTheme();

Expand Down Expand Up @@ -160,7 +161,7 @@ export default function HeaderBackButton({
delayPressIn={0}
onPress={disabled ? undefined : handlePress}
pressColor={pressColorAndroid}
style={[styles.container, disabled && styles.disabled]}
style={[styles.container, disabled && styles.disabled, style]}
hitSlop={Platform.select({
ios: undefined,
default: { top: 16, right: 16, bottom: 16, left: 16 },
Expand Down

0 comments on commit 486c3de

Please sign in to comment.