Skip to content

Commit

Permalink
feat: Header title first focus (#651)
Browse files Browse the repository at this point in the history
* fix: Accessible header + header content reorder

* fix: reorder + accessible header title for animated header

* Remove unused imports
  • Loading branch information
rikkekantega authored Nov 6, 2020
1 parent 222c2b0 commit e453a6a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/ScreenHeader/animated-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ const AnimatedScreenHeader: React.FC<ScreenHeaderProps> = ({

return (
<View style={style.container} {...props}>
<View style={style.iconContainerLeft}>{leftIcon}</View>
<View
accessible={true}
accessibilityRole="header"
Expand All @@ -62,10 +61,13 @@ const AnimatedScreenHeader: React.FC<ScreenHeaderProps> = ({
{transform: [{translateY: titleOffset}]},
]}
>
<ThemeText type="paragraphHeadline">{title}</ThemeText>
<View accessible={true} accessibilityRole="header">
<ThemeText type="paragraphHeadline">{title}</ThemeText>
</View>
</Animated.View>
{altTitle}
</View>
<View style={style.iconContainerLeft}>{leftIcon}</View>
<View style={style.iconContainerRight}>{rightIcon}</View>
</View>
);
Expand Down
10 changes: 6 additions & 4 deletions src/ScreenHeader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ const ScreenHeader: React.FC<ScreenHeaderProps> = ({

return (
<View style={[css.container, style]}>
<View accessible={true} accessibilityRole="header">
<ThemeText type="paragraphHeadline">{title}</ThemeText>
</View>
<View style={css.iconContainerLeft}>{leftIcon}</View>
<ThemeText type="paragraphHeadline">{title}</ThemeText>
<View style={css.iconContainerRight}>{rightIcon}</View>
</View>
);
Expand All @@ -37,14 +39,14 @@ const useHeaderStyle = StyleSheet.createThemeHook((theme) => ({
alignItems: 'center',
justifyContent: 'center',
padding: theme.spacings.medium,
height: 64,
minHeight: 64,
},
iconContainerLeft: {
position: 'absolute',
left: 12,
left: theme.spacings.medium,
},
iconContainerRight: {
position: 'absolute',
right: 12,
right: theme.spacings.medium,
},
}));

0 comments on commit e453a6a

Please sign in to comment.