Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 4 additions & 4 deletions src/components/Drawer/DrawerContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from '../../constants/Constants';
import SettingsDrawerContent from './SettingsDrawerContent';
import HomeDrawerContent from './HomeDrawerContent';

import * as LocalizedStyles from '../../constants/LocalizedStyles';

interface Props {
navigation: DrawerNavigationProp<any, 'DrawerStack'>
Expand All @@ -41,14 +41,14 @@ const DrawerContent = ({ navigation }: Props) => {
source={require('../../assets/main/menuBG.png')}
>
<TouchableOpacity
style={[styles.close, { [isRTL ? 'left' : 'right']: 20 }]}
style={[styles.close, { [LocalizedStyles.side(isRTL, true)]: 20 }]}
hitSlop={HIT_SLOP}
onPress={navigation.closeDrawer}
>
<Icon source={require('../../assets/main/menuClose.png')} width={12} height={18} />
</TouchableOpacity>

<View style={{ flex: 1, flexDirection: isRTL ? 'row-reverse' : 'row' }}>
<View style={{ flex: 1, flexDirection: LocalizedStyles.flexDirection(isRTL) }}>
{showSettings ?
(<SettingsDrawerContent
navigation={navigation}
Expand All @@ -63,7 +63,7 @@ const DrawerContent = ({ navigation }: Props) => {

</View>

<View style={[styles.footerContainer, { alignSelf: isRTL ? 'flex-end' : 'flex-start' }]}>
<View style={[styles.footerContainer, { alignSelf: LocalizedStyles.alignSelf(isRTL) }]}>
<Text style={styles.versionText}>{`${versionNumber} ${VERSION_NAME}`}</Text>
</View>
</ImageBackground>
Expand Down
3 changes: 2 additions & 1 deletion src/components/Drawer/DrawerItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { FunctionComponent, useMemo } from 'react';
import { View, StyleSheet, ViewStyle } from 'react-native';
import { Icon, Text, TouchableOpacity } from '../common';
import { type } from 'os';
import * as LocalizedStyles from '../../constants/LocalizedStyles';

interface Props {
isRTL: boolean
Expand All @@ -26,7 +27,7 @@ const DrawerItem: FunctionComponent<Props> = ({ isRTL, icon, iconSize= 18, label


return (
<TouchableOpacity style={[styles.container, { flexDirection: isRTL ? 'row-reverse' : 'row' }, style]} onPress={onPress}>
<TouchableOpacity style={[styles.container, { flexDirection: LocalizedStyles.flexDirection(isRTL) }, style]} onPress={onPress}>
<Icon source={icon} width={iconSize} />
{LabelComponent}
</TouchableOpacity>
Expand Down
3 changes: 2 additions & 1 deletion src/components/Drawer/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import MapModal from '../Main/Modals/MapModal';
import { INIT_ROUTE_NAME } from '../../constants/Constants';
import BatteryModal from '../Main/Modals/BatteryModal';
import BatterySettings from '../Main/Settings/BatterySettings';
import * as LocalizedStyles from '../../constants/LocalizedStyles';

import { LocaleReducer, ExposuresReducer, Store } from '../../types';
import BluetoothSettings from '../Main/Settings/BluetoothSettings';
Expand Down Expand Up @@ -87,7 +88,7 @@ const Home = () => {
drawerType="back"
screenOptions={{ gestureEnabled: false }}
drawerContent={props => <DrawerContent {...props} />}
drawerPosition={isRTL ? 'right' : 'left'}
drawerPosition={LocalizedStyles.side(isRTL)}
drawerStyle={{
width: '100%'
}}
Expand Down
5 changes: 3 additions & 2 deletions src/components/Drawer/HomeDrawerContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
} from '../../constants/Constants';
import { toggleWebview } from '../../actions/GeneralActions';
import { USER_DISABLED_BATTERY } from '../../constants/ActionTypes';
import * as LocalizedStyles from '../../constants/LocalizedStyles';

interface Props {
navigation: DrawerNavigationProp<any, 'DrawerStack'>
Expand Down Expand Up @@ -57,13 +58,13 @@ const HomeDrawerContent = ({ navigation, showSettings }: Props) => {
style={{ alignItems: 'center', }}
label={(
<>
<Text style={{ paddingHorizontal: 19, fontSize: 18, textAlign: isRTL ? 'right' : 'left' }}>{settings.label}</Text>
<Text style={{ paddingHorizontal: 19, fontSize: 18, textAlign: LocalizedStyles.side(isRTL) }}>{settings.label}</Text>
<View style={{ position: 'absolute', top: 0, bottom: 0, right: 19, justifyContent: 'center' }}>

<Icon
width={13}
source={require('../../assets/main/menuBack.png')}
customStyles={{ transform: [{ rotateY: isRTL ? '180deg' : '0deg' }] }}
customStyles={{ transform: [{ rotateY: LocalizedStyles.rotateDegree(isRTL) }] }}
/>
</View>
</>
Expand Down
25 changes: 13 additions & 12 deletions src/components/Drawer/SettingsDrawerContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
} from '../../constants/Constants';
import { toggleWebview } from '../../actions/GeneralActions';
import { USER_DISABLED_BATTERY } from '../../constants/ActionTypes';
import * as LocalizedStyles from '../../constants/LocalizedStyles';

interface Props {
navigation: DrawerNavigationProp<any, 'DrawerStack'>
Expand All @@ -34,7 +35,7 @@ const SettingsDrawerContent = ({ navigation, goToMainDrawer }: Props) => {
return (
<View style={styles.container}>
<TouchableOpacity
style={[styles.close, { [!isRTL ? 'left' : 'right']: 20, flexDirection: isRTL ? 'row-reverse' : 'row' }]}
style={[styles.close, { [LocalizedStyles.side(isRTL)]: 20, flexDirection: LocalizedStyles.flexDirection(isRTL) }]}
hitSlop={HIT_SLOP}
onPress={goToMainDrawer}
>
Expand All @@ -44,11 +45,11 @@ const SettingsDrawerContent = ({ navigation, goToMainDrawer }: Props) => {
customStyles={{
borderLeftWidth: StyleSheet.hairlineWidth,
borderColor: 'rgb(32, 49, 94)',
[!isRTL ? 'paddingRight' : 'paddingLeft']: 25,
transform: [{ rotateY: isRTL ? '0deg' : '180deg' }]
[LocalizedStyles.paddingSide(isRTL)]: 25,
transform: [{ rotateY: LocalizedStyles.rotateDegree(isRTL, true) }]
}}
/>
<Text style={[{ color: 'rgb(32, 49, 94)', [isRTL ? 'marginRight' : 'marginLeft']: 7, }]} bold>{settings.label}</Text>
<Text style={[{ color: 'rgb(32, 49, 94)', [LocalizedStyles.marginSide(isRTL)]: 7, }]} bold>{settings.label}</Text>
</TouchableOpacity>


Expand All @@ -63,11 +64,11 @@ const SettingsDrawerContent = ({ navigation, goToMainDrawer }: Props) => {
style={{ alignItems: 'flex-start' }}
label={(
<View style={{ paddingHorizontal: 19, alignItems: 'stretch' }}>
<Text style={{ fontSize: 18, textAlign: isRTL ? 'right' : 'left' }}>{battery.label}</Text>
<Text style={{ fontSize: 18, textAlign: LocalizedStyles.side(isRTL) }}>{battery.label}</Text>
<View style={{
flexDirection: isRTL ? 'row-reverse' : 'row',
flexDirection: LocalizedStyles.flexDirection(isRTL),
marginTop: IS_SMALL_SCREEN ? 5 : 8,
[isRTL ? 'marginRight' : 'marginRight']: IS_SMALL_SCREEN ? 65 : 85
[LocalizedStyles.marginSide(isRTL)]: IS_SMALL_SCREEN ? 65 : 85
}}
>
<View style={{
Expand All @@ -78,7 +79,7 @@ const SettingsDrawerContent = ({ navigation, goToMainDrawer }: Props) => {
marginTop: 5
}}
/>
<Text style={{ fontSize: 14, textAlign: isRTL ? 'right' : 'left', marginHorizontal: 8 }}>{battery[batteryDisabled ? 'batteryOptimized' : 'batteryNotOptimized']}</Text>
<Text style={{ fontSize: 14, textAlign: LocalizedStyles.side(isRTL), marginHorizontal: 8 }}>{battery[batteryDisabled ? 'batteryOptimized' : 'batteryNotOptimized']}</Text>
</View>
</View>
)
Expand All @@ -92,11 +93,11 @@ const SettingsDrawerContent = ({ navigation, goToMainDrawer }: Props) => {
style={{ alignItems: 'flex-start' }}
label={(
<View style={{ paddingHorizontal: 19, alignItems: 'stretch' }}>
<Text style={{ fontSize: 18, textAlign: isRTL ? 'right' : 'left' }}>{bluetooth.label}</Text>
<Text style={{ fontSize: 18, textAlign: LocalizedStyles.side(isRTL) }}>{bluetooth.label}</Text>
<View style={{
flexDirection: isRTL ? 'row-reverse' : 'row',
flexDirection: LocalizedStyles.flexDirection(isRTL),
marginTop: IS_SMALL_SCREEN ? 5 : 8,
[isRTL ? 'marginRight' : 'marginRight']: IS_SMALL_SCREEN ? 65 : 85
[isRTL ? 'marginRight' : 'marginRight']: IS_SMALL_SCREEN ? 65 : 85 // is this a bug marginRight for both directions
}}
>
<View
Expand All @@ -108,7 +109,7 @@ const SettingsDrawerContent = ({ navigation, goToMainDrawer }: Props) => {
marginTop: 5
}}
/>
<Text style={{ fontSize: 14, textAlign: isRTL ? 'right' : 'left', marginHorizontal: 8 }}>{bluetooth[enableBle ? 'BLEOn' : 'BLEOff']}</Text>
<Text style={{ fontSize: 14, textAlign: LocalizedStyles.side(isRTL), marginHorizontal: 8 }}>{bluetooth[enableBle ? 'BLEOn' : 'BLEOff']}</Text>
</View>
</View>
)}
Expand Down
16 changes: 8 additions & 8 deletions src/components/Main/ExposureInstructions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
import { Icon, Text, TouchableOpacity } from '../common';
import { Exposure, Store, LocaleReducer } from '../../types';
import { moveAllToPastExposures } from '../../actions/ExposuresActions';

import * as LocalizedStyles from '../../constants/LocalizedStyles';

if (
Platform.OS === 'android'
Expand Down Expand Up @@ -110,7 +110,7 @@ const ExposureInstructions = ({ navigation, route }: Props) => {


return (
<Text style={{ fontSize: IS_SMALL_SCREEN ? 14 : 16, lineHeight: 17, marginVertical: IS_SMALL_SCREEN ? 5 : 10, letterSpacing: 0.2, textAlign: isRTL ? 'right' : 'left' }} key={exposure.properties.OBJECTID}>
<Text style={{ fontSize: IS_SMALL_SCREEN ? 14 : 16, lineHeight: 17, marginVertical: IS_SMALL_SCREEN ? 5 : 10, letterSpacing: 0.2, textAlign: LocalizedStyles.side(isRTL) }} key={exposure.properties.OBJECTID}>
<Text bold>• </Text>
{ListText}

Expand All @@ -119,7 +119,7 @@ const ExposureInstructions = ({ navigation, route }: Props) => {
}), [exposures, locale]);

const renderActionButton = (icon: number, text: string, buttonText: string, action: () => void) => (
<View style={[styles.actionButtonContainer, IS_SMALL_SCREEN ? styles.actionButtonContainerSmall : styles.actionButtonContainerBig, IS_SMALL_SCREEN && { flexDirection: isRTL ? 'row-reverse' : 'row' }]}>
<View style={[styles.actionButtonContainer, IS_SMALL_SCREEN ? styles.actionButtonContainerSmall : styles.actionButtonContainerBig, IS_SMALL_SCREEN && { flexDirection: LocalizedStyles.flexDirection(isRTL) }]}>
<Icon source={icon} width={22} height={35} />

<Text style={styles.actionText}>{text}</Text>
Expand All @@ -146,7 +146,7 @@ const ExposureInstructions = ({ navigation, route }: Props) => {
{exposures.length > 4 && (
<TouchableOpacity
style={{
flexDirection: isRTL ? 'row' : 'row-reverse',
flexDirection: LocalizedStyles.flexDirection(isRTL, true),
alignItems: 'center'
}}
onPress={() => {
Expand Down Expand Up @@ -182,16 +182,16 @@ const ExposureInstructions = ({ navigation, route }: Props) => {
alignItems: 'center',
position: 'absolute',
top: PADDING_TOP(IS_SMALL_SCREEN ? 10 : 28),
flexDirection: isRTL ? 'row' : 'row-reverse',
[!isRTL ? 'right' : 'left']: IS_SMALL_SCREEN ? 10 : 25,
flexDirection: LocalizedStyles.flexDirection(isRTL, true),
[LocalizedStyles.side(isRTL, true)]: IS_SMALL_SCREEN ? 10 : 25,
}}
onPress={() => navigation.navigate('ExposureDetected')}
>
<Icon
width={IS_SMALL_SCREEN ? 20 : 24}
source={require('../../assets/main/back.png')}
customStyles={{
transform: [{ rotate: !isRTL ? '0deg' : '180deg' }]
transform: [{ rotate: LocalizedStyles.rotateDegree(isRTL) }]
}}
/>
<Text
Expand All @@ -215,7 +215,7 @@ const ExposureInstructions = ({ navigation, route }: Props) => {
</View>
<View style={{ justifyContent: 'space-between' }}>
<Text style={{ marginBottom: IS_SMALL_SCREEN ? 12 : 25 }} bold>{themInstructions}</Text>
<View style={!IS_SMALL_SCREEN && { width: SCREEN_WIDTH - (23 * 2), flexDirection: isRTL ? 'row-reverse' : 'row', flexWrap: 'wrap', justifyContent: 'space-between', }}>
<View style={!IS_SMALL_SCREEN && { width: SCREEN_WIDTH - (23 * 2), flexDirection: LocalizedStyles.flexDirection(isRTL), flexWrap: 'wrap', justifyContent: 'space-between', }}>
{renderActionButton(require('../../assets/main/isolation.png'), goIntoIsolation, allInstructions, () => Linking.openURL(furtherInstructions))}
{renderActionButton(require('../../assets/main/report.png'), reportIsolation, reportSite, () => Linking.openURL(reportForm))}
</View>
Expand Down
7 changes: 4 additions & 3 deletions src/components/Main/ExposureRelief.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Text, Icon, ActionButton, TouchableOpacity } from '../common';
import { IS_SMALL_SCREEN, HIT_SLOP, PADDING_TOP, MAIN_COLOR } from '../../constants/Constants';
import { Store, LocaleReducer } from '../../types';
import { moveAllToPastExposures } from '../../actions/ExposuresActions';
import * as LocalizedStyles from '../../constants/LocalizedStyles';

interface Props {
navigation: StackNavigationProp<any>
Expand All @@ -30,19 +31,19 @@ const ExposureRelief = ({ navigation }: Props) => {
<TouchableOpacity
hitSlop={HIT_SLOP}
style={{
flexDirection: isRTL ? 'row' : 'row-reverse',
flexDirection: LocalizedStyles.flexDirection(isRTL, true),
alignContent: 'center',
alignItems: 'center',
position: 'absolute',
top: PADDING_TOP(28),
[!isRTL ? 'right' : 'left']: IS_SMALL_SCREEN ? 10 : 25,
[LocalizedStyles.side(isRTL, true)]: IS_SMALL_SCREEN ? 10 : 25,
}}
onPress={navigation.goBack}
>
<Icon
width={IS_SMALL_SCREEN ? 20 : 24}
source={require('../../assets/main/back.png')}
customStyles={{ transform: [{ rotate: !isRTL ? '0deg' : '180deg' }] }}
customStyles={{ transform: [{ rotate: LocalizedStyles.rotateDegree(isRTL) }] }}
/>
<Text style={{ fontSize: IS_SMALL_SCREEN ? 13 : 15, color: MAIN_COLOR, marginHorizontal: IS_SMALL_SCREEN ? 5 : 8 }} bold>{editBtn}</Text>
</TouchableOpacity>
Expand Down
3 changes: 2 additions & 1 deletion src/components/Main/ExposuresDetected.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
import { showMapModal } from '../../actions/GeneralActions';
import { dismissExposures, setExposureSelected } from '../../actions/ExposuresActions';
import CardIdentifyTag from '../common/CardIdentifyTag';
import * as LocalizedStyles from '../../constants/LocalizedStyles';

interface ExposuresDetectedProps {
navigation: StackNavigationProp<any>
Expand Down Expand Up @@ -252,7 +253,7 @@ const ExposuresDetected = ({ navigation }: ExposuresDetectedProps) => {
height: SCREEN_HEIGHT * 0.08,
backgroundColor: MAIN_COLOR,
justifyContent: 'center',
flexDirection: isRTL ? 'row-reverse' : 'row',
flexDirection: LocalizedStyles.flexDirection(isRTL),
alignItems: 'center',
paddingBottom: PADDING_BOTTOM()
}}
Expand Down
23 changes: 12 additions & 11 deletions src/components/Main/ExposuresHistory/ExposureHistoryListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Icon, Text, TouchableOpacity } from '../../common';
import { Strings } from '../../../locale/LocaleData';
import { BASIC_SHADOW_STYLES, MAIN_COLOR, SCREEN_WIDTH } from '../../../constants/Constants';
import CardIdentifyTag from '../../common/CardIdentifyTag';
import * as LocalizedStyles from '../../../constants/LocalizedStyles';

interface Props {
isRTL: boolean,
Expand All @@ -28,15 +29,15 @@ const ExposureHistoryListItem: FunctionComponent<Props> = ({ children, style, is
const exposureEndHour = time.add(1, 'hour').format('HH:mm');

TimeText = (
<Text style={{ textAlign: isRTL ? 'right' : 'left' }}>
<Text style={{ textAlign: LocalizedStyles.side(isRTL) }}>
<Text style={styles.text} bold>{`${exposureDate} `}</Text>
<Text style={styles.text}>{`${betweenHours} `}</Text>
<Text style={styles.text} bold>{`${exposureStartHour}-${exposureEndHour}`}</Text>
</Text>
);
} else {
TimeText = (
<Text style={{ textAlign: isRTL ? 'right' : 'left' }}>
<Text style={{ textAlign: LocalizedStyles.side(isRTL) }}>
<Text style={styles.text} bold>{`${moment(fromTime).format('DD.MM.YY')} `}</Text>
<Text style={styles.text}>{`${fromHour} `}</Text>
<Text style={styles.text} bold>{`${moment(fromTime).format('HH:mm')}`}</Text>
Expand All @@ -49,25 +50,25 @@ const ExposureHistoryListItem: FunctionComponent<Props> = ({ children, style, is
LocationUpdateTag = (
<View
style={{
flexDirection: isRTL ? 'row-reverse' : 'row',
flexDirection: LocalizedStyles.flexDirection(isRTL),
paddingBottom: 10
}}
>
<View
style={{
flex: 1,
flexDirection: isRTL ? 'row-reverse' : 'row',
flexDirection: LocalizedStyles.flexDirection(isRTL),


}}
>
<View style={{ width: 6, height: 6, borderRadius: 3, backgroundColor: 'rgb(44,191,220)', marginHorizontal: 6 }} />
<Text style={{ fontSize: 12, letterSpacing: -0.09, textAlign: isRTL ? 'right' : 'left' }}>{BLELocationUpdate}</Text>
<Text style={{ fontSize: 12, letterSpacing: -0.09, textAlign: LocalizedStyles.side(isRTL) }}>{BLELocationUpdate}</Text>
</View>
<View
style={{
flex: 1,
flexDirection: isRTL ? 'row-reverse' : 'row',
flexDirection: LocalizedStyles.flexDirection(isRTL),
alignItems: 'flex-start',
justifyContent: 'flex-end',
}}
Expand All @@ -81,7 +82,7 @@ const ExposureHistoryListItem: FunctionComponent<Props> = ({ children, style, is
<View
style={{
flex: 1,
flexDirection: isRTL ? 'row' : 'row-reverse',
flexDirection: LocalizedStyles.flexDirection(isRTL, true),
alignContent: 'center',
justifyContent: 'space-between',
paddingBottom: 10
Expand All @@ -96,9 +97,9 @@ const ExposureHistoryListItem: FunctionComponent<Props> = ({ children, style, is
if (Place) {
ShowPlaceText = (
<>
<Text style={[styles.text, { textAlign: isRTL ? 'right' : 'left' }]} bold>{Place}</Text>
<Text style={[styles.text, { textAlign: LocalizedStyles.side(isRTL) }]} bold>{Place}</Text>
<TouchableOpacity onPress={showExposureOnMap}>
<View style={{ flexDirection: isRTL ? 'row-reverse' : 'row', alignItems: 'center' }}>
<View style={{ flexDirection: LocalizedStyles.flexDirection(isRTL), alignItems: 'center' }}>
<Icon source={require('../../../assets/main/map.png')} width={12} height={10} />
<Text style={styles.showOnMap} bold>{showOnMap}</Text>
</View>
Expand All @@ -114,13 +115,13 @@ const ExposureHistoryListItem: FunctionComponent<Props> = ({ children, style, is
style={{
paddingBottom: 20,
paddingHorizontal: 15,
flexDirection: isRTL ? 'row-reverse' : 'row',
flexDirection: LocalizedStyles.flexDirection(isRTL),
justifyContent: 'center',
alignItems: 'center',
}}
>
<Icon source={require('../../../assets/main/exposuresSmall.png')} width={32} height={20} customStyles={{ marginHorizontal: 7.5 }} />
<View style={[styles.textContainer, { alignItems: isRTL ? 'flex-end' : 'flex-start' }]}>
<View style={[styles.textContainer, { alignItems: LocalizedStyles.alignItems(isRTL) }]}>

{TimeText}

Expand Down
Loading