Skip to content

Commit

Permalink
Fixing layout issues with statusbar on android
Browse files Browse the repository at this point in the history
  • Loading branch information
steniowagner committed May 3, 2019
1 parent ab98460 commit 23519a2
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 22 deletions.
1 change: 0 additions & 1 deletion src/ThemeContextProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ class ThemeContextProvider extends Component<Props, State> {
<StatusBar
backgroundColor={appTheme.colors.androidToolbarColor}
barStyle={isDarkThemeActivated ? 'light-content' : 'dark-content'}
translucent
animated
/>
{children}
Expand Down
5 changes: 4 additions & 1 deletion src/components/common/ScreenTitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import styled from 'styled-components';

const Title = styled(Text)`
width: 100%;
margin-top: ${({ theme }) => theme.metrics.getWidthFromDP('15%')}px;
margin-top: ${({ theme }) => {
const percentage = Platform.OS === 'android' ? '8%' : '15%';
return theme.metrics.getWidthFromDP(percentage);
}}px;
margin-left: ${({ theme }) => theme.metrics.largeSize}px;
font-size: ${({ theme }) => theme.metrics.extraLargeSize * 1.7}px;
font-family: CircularStd-Black;
Expand Down
3 changes: 1 addition & 2 deletions src/components/common/player/components/PlayerComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,8 @@ const PlayerComponent = ({
}: Props): Object => (
<Wrapper>
<StatusBar
backgroundColor="transparent"
backgroundColor="#111"
barStyle="light-content"
translucent
animated
/>
<BackgroundImage
Expand Down
1 change: 0 additions & 1 deletion src/components/common/player/components/PodcastImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const Wrapper = styled(View)`
width: 100%;
justify-content: center;
align-content: center;
margin-top: ${({ theme }) => theme.metrics.mediumSize}px;
`;

const ImageContainer = styled(View)`
Expand Down
2 changes: 1 addition & 1 deletion src/components/screens/home/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const RootStack = createStackNavigator(
),
navigationOptions: () => ({
headerBackTitle: null,
header: null,
headerTransparent: true,
}),
},

Expand Down
18 changes: 12 additions & 6 deletions src/components/screens/search/components/SearchAuthorTextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const Wrapper = styled(View)`
align-items: center;
margin-vertical: ${({ theme }) => theme.metrics.largeSize}px;
padding-horizontal: ${({ theme }) => theme.metrics.smallSize}px;
height: ${({ theme }) => theme.metrics.getHeightFromDP('6%')};
border-radius: 4px;
background-color: ${({ theme }) => theme.colors.white};
`;
Expand All @@ -35,6 +34,11 @@ const Input = styled(TextInput).attrs(({ theme }) => ({
color: ${({ theme }) => theme.colors.darkText};
`;

const IconWrapper = styled(View)`
padding-top: ${({ theme }) => theme.metrics.mediumSize};
padding-bottom: ${({ theme }) => theme.metrics.getWidthFromDP('2.5%')};
`;

type Props = {
onSearchForAuthor: Function,
onToggleDarkLayer: Function,
Expand All @@ -58,11 +62,13 @@ const SearchAuthorTextInput = ({
elevation: 4,
}}
>
<Icon
name="magnify"
color={appStyles.colors.darkText}
size={20}
/>
<IconWrapper>
<Icon
name="magnify"
color={appStyles.colors.darkText}
size={20}
/>
</IconWrapper>
<Input
onChangeText={text => onTypeAuthorName(text)}
onFocus={() => onToggleDarkLayer(true)}
Expand Down
1 change: 0 additions & 1 deletion src/routes/mainStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import HomeRoutes from '~/components/screens/home/routes';
import SearchRoutes from '~/components/screens/search/routes';
import LibraryRoutes from '~/components/screens/library/routes';
import SettingsRoutes from '~/components/screens/settings/routes';
import isEqualsOrLargestThanIphoneX from '~/utils/isEqualsOrLargestThanIphoneX';
import appStyles from '~/styles';

export const ROUTE_NAMES = {
Expand Down
9 changes: 0 additions & 9 deletions src/routes/utils/navigationOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export const getPlayerNavigationOption = (navigation: Object): Object => {
return {
...DEFAULT_HEADER_STYLE,
headerStyle: {
marginTop: Platform.OS === 'android' ? StatusBar.currentHeight : 0,
backgroundColor: 'transparent',
borderBottomWidth: 0,
},
Expand Down Expand Up @@ -69,7 +68,6 @@ export const getDefaultHeaderWithTitle = (
headerTransparent: false,
headerStyle: {
backgroundColor: theme.colors.secondaryColor,
marginTop: Platform.OS === 'android' ? StatusBar.currentHeight : 0,
borderBottomWidth: 0,
elevation: 0,
},
Expand Down Expand Up @@ -134,12 +132,5 @@ export const getHiddenHeaderLayout = (
...DEFAULT_HEADER_STYLE,
headerTintColor: colorOverride || theme.colors.textColor,
headerBackTitle: null,
...Platform.select({
android: {
headerStyle: {
marginTop: StatusBar.currentHeight,
},
},
}),
};
};

0 comments on commit 23519a2

Please sign in to comment.