feat: allow style overrides for HeaderBackButton (#8626)

This commit is contained in:
Andrei Barabas
2020-07-28 12:09:23 +03:00
committed by GitHub
parent 0d6a43f663
commit 486c3defd2
2 changed files with 6 additions and 1 deletions

View File

@@ -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 = {

View File

@@ -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();
@@ -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 },