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

chore: update eslint + prettier rules #254

Merged
merged 18 commits into from
Oct 10, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: fixing broken merge
  • Loading branch information
ftonato committed Oct 9, 2019
commit bc31111ec0b07af427327e890e30053f0a3a06f8
44 changes: 44 additions & 0 deletions App/Screens/About/About.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
Platform,
ScrollView,
StyleSheet,
Switch,
Text,
View
} from 'react-native';
Expand All @@ -29,6 +30,7 @@ import { scale } from 'react-native-size-matters';
import { NavigationInjectedProps } from 'react-navigation';
import { BackButton } from '../../components';
import { i18n } from '../../localization';
import { useDistanceUnit } from '../../stores/distanceUnit';
import { trackScreen } from '../../util/amplitude';
import * as theme from '../../util/theme';
import { Box } from './Box';
ftonato marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -88,6 +90,23 @@ const styles = StyleSheet.create({
marginBottom: theme.spacing.normal,
paddingTop: theme.spacing.big
},
distance: {
borderTopColor: theme.iconBackgroundColor,
borderTopWidth: 1,
marginBottom: theme.spacing.big,
paddingTop: theme.spacing.big
},
distanceSwitchWrapper: {
display: 'flex',
flexDirection: 'row',
alignItems: 'center'
},
distanceText: {
...theme.text,
fontSize: scale(14),
paddingLeft: theme.spacing.small,
textTransform: 'capitalize'
},
h2: {
...theme.title,
fontSize: scale(20),
Expand All @@ -112,9 +131,17 @@ const styles = StyleSheet.create({

export function About(props: AboutProps) {
const { navigation } = props;
const {
distanceUnit,
localizedDistanceUnit,
setDistanceUnit
} = useDistanceUnit();

trackScreen('ABOUT');

const toggleDistanceSwitch = (value: boolean) =>
setDistanceUnit(value ? 'km' : 'mile');

return (
<CustomScrollView
scrollIntoViewOptions={scrollViewOptions}
Expand Down Expand Up @@ -204,6 +231,23 @@ export function About(props: AboutProps) {
</Text>
</View>

<View style={styles.distance}>
<Text style={styles.h2}>{i18n.t('about_distance_unit_title')}</Text>
<View style={styles.distanceSwitchWrapper}>
<Switch
onValueChange={toggleDistanceSwitch}
trackColor={{
true: theme.primaryColor,
false: theme.iconBackgroundColor
}}
value={distanceUnit === 'km'}
/>
<Text style={styles.distanceText}>
{localizedDistanceUnit('long')}
</Text>
</View>
</View>

<View style={styles.credits}>
<Text style={styles.h2}>{i18n.t('about_credits_title')}</Text>
<Text style={theme.text}>
Expand Down