diff --git a/src/components/Drawer/DrawerContent.tsx b/src/components/Drawer/DrawerContent.tsx index 010a1066..1c857f64 100644 --- a/src/components/Drawer/DrawerContent.tsx +++ b/src/components/Drawer/DrawerContent.tsx @@ -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 @@ -41,14 +41,14 @@ const DrawerContent = ({ navigation }: Props) => { source={require('../../assets/main/menuBG.png')} > - + {showSettings ? ( { - + {`${versionNumber} ${VERSION_NAME}`} diff --git a/src/components/Drawer/DrawerItem.tsx b/src/components/Drawer/DrawerItem.tsx index 42fa41ee..4297ee33 100644 --- a/src/components/Drawer/DrawerItem.tsx +++ b/src/components/Drawer/DrawerItem.tsx @@ -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 @@ -26,7 +27,7 @@ const DrawerItem: FunctionComponent = ({ isRTL, icon, iconSize= 18, label return ( - + {LabelComponent} diff --git a/src/components/Drawer/Home.tsx b/src/components/Drawer/Home.tsx index 65722e5c..8d3b7ad5 100644 --- a/src/components/Drawer/Home.tsx +++ b/src/components/Drawer/Home.tsx @@ -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'; @@ -87,7 +88,7 @@ const Home = () => { drawerType="back" screenOptions={{ gestureEnabled: false }} drawerContent={props => } - drawerPosition={isRTL ? 'right' : 'left'} + drawerPosition={LocalizedStyles.side(isRTL)} drawerStyle={{ width: '100%' }} diff --git a/src/components/Drawer/HomeDrawerContent.tsx b/src/components/Drawer/HomeDrawerContent.tsx index 03593dc4..89d136cd 100644 --- a/src/components/Drawer/HomeDrawerContent.tsx +++ b/src/components/Drawer/HomeDrawerContent.tsx @@ -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 @@ -57,13 +58,13 @@ const HomeDrawerContent = ({ navigation, showSettings }: Props) => { style={{ alignItems: 'center', }} label={( <> - {settings.label} + {settings.label} diff --git a/src/components/Drawer/SettingsDrawerContent.tsx b/src/components/Drawer/SettingsDrawerContent.tsx index 96821827..28c44f18 100644 --- a/src/components/Drawer/SettingsDrawerContent.tsx +++ b/src/components/Drawer/SettingsDrawerContent.tsx @@ -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 @@ -34,7 +35,7 @@ const SettingsDrawerContent = ({ navigation, goToMainDrawer }: Props) => { return ( @@ -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) }] }} /> - {settings.label} + {settings.label} @@ -63,11 +64,11 @@ const SettingsDrawerContent = ({ navigation, goToMainDrawer }: Props) => { style={{ alignItems: 'flex-start' }} label={( - {battery.label} + {battery.label} { marginTop: 5 }} /> - {battery[batteryDisabled ? 'batteryOptimized' : 'batteryNotOptimized']} + {battery[batteryDisabled ? 'batteryOptimized' : 'batteryNotOptimized']} ) @@ -92,11 +93,11 @@ const SettingsDrawerContent = ({ navigation, goToMainDrawer }: Props) => { style={{ alignItems: 'flex-start' }} label={( - {bluetooth.label} + {bluetooth.label} { marginTop: 5 }} /> - {bluetooth[enableBle ? 'BLEOn' : 'BLEOff']} + {bluetooth[enableBle ? 'BLEOn' : 'BLEOff']} )} diff --git a/src/components/Main/ExposureInstructions.tsx b/src/components/Main/ExposureInstructions.tsx index 2b139f21..27978efb 100644 --- a/src/components/Main/ExposureInstructions.tsx +++ b/src/components/Main/ExposureInstructions.tsx @@ -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' @@ -110,7 +110,7 @@ const ExposureInstructions = ({ navigation, route }: Props) => { return ( - + {ListText} @@ -119,7 +119,7 @@ const ExposureInstructions = ({ navigation, route }: Props) => { }), [exposures, locale]); const renderActionButton = (icon: number, text: string, buttonText: string, action: () => void) => ( - + {text} @@ -146,7 +146,7 @@ const ExposureInstructions = ({ navigation, route }: Props) => { {exposures.length > 4 && ( { @@ -182,8 +182,8 @@ 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')} > @@ -191,7 +191,7 @@ const ExposureInstructions = ({ navigation, route }: Props) => { width={IS_SMALL_SCREEN ? 20 : 24} source={require('../../assets/main/back.png')} customStyles={{ - transform: [{ rotate: !isRTL ? '0deg' : '180deg' }] + transform: [{ rotate: LocalizedStyles.rotateDegree(isRTL) }] }} /> { {themInstructions} - + {renderActionButton(require('../../assets/main/isolation.png'), goIntoIsolation, allInstructions, () => Linking.openURL(furtherInstructions))} {renderActionButton(require('../../assets/main/report.png'), reportIsolation, reportSite, () => Linking.openURL(reportForm))} diff --git a/src/components/Main/ExposureRelief.tsx b/src/components/Main/ExposureRelief.tsx index 6a04aecf..36e5008d 100644 --- a/src/components/Main/ExposureRelief.tsx +++ b/src/components/Main/ExposureRelief.tsx @@ -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 @@ -30,19 +31,19 @@ const ExposureRelief = ({ navigation }: Props) => { {editBtn} diff --git a/src/components/Main/ExposuresDetected.tsx b/src/components/Main/ExposuresDetected.tsx index 6f0dbf63..216eb7a5 100644 --- a/src/components/Main/ExposuresDetected.tsx +++ b/src/components/Main/ExposuresDetected.tsx @@ -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 @@ -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() }} diff --git a/src/components/Main/ExposuresHistory/ExposureHistoryListItem.tsx b/src/components/Main/ExposuresHistory/ExposureHistoryListItem.tsx index 2a3e844b..fd383bbb 100644 --- a/src/components/Main/ExposuresHistory/ExposureHistoryListItem.tsx +++ b/src/components/Main/ExposuresHistory/ExposureHistoryListItem.tsx @@ -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, @@ -28,7 +29,7 @@ const ExposureHistoryListItem: FunctionComponent = ({ children, style, is const exposureEndHour = time.add(1, 'hour').format('HH:mm'); TimeText = ( - + {`${exposureDate} `} {`${betweenHours} `} {`${exposureStartHour}-${exposureEndHour}`} @@ -36,7 +37,7 @@ const ExposureHistoryListItem: FunctionComponent = ({ children, style, is ); } else { TimeText = ( - + {`${moment(fromTime).format('DD.MM.YY')} `} {`${fromHour} `} {`${moment(fromTime).format('HH:mm')}`} @@ -49,25 +50,25 @@ const ExposureHistoryListItem: FunctionComponent = ({ children, style, is LocationUpdateTag = ( - {BLELocationUpdate} + {BLELocationUpdate} = ({ children, style, is = ({ children, style, is if (Place) { ShowPlaceText = ( <> - {Place} + {Place} - + {showOnMap} @@ -114,13 +115,13 @@ const ExposureHistoryListItem: FunctionComponent = ({ children, style, is style={{ paddingBottom: 20, paddingHorizontal: 15, - flexDirection: isRTL ? 'row-reverse' : 'row', + flexDirection: LocalizedStyles.flexDirection(isRTL), justifyContent: 'center', alignItems: 'center', }} > - + {TimeText} diff --git a/src/components/Main/ExposuresHistory/ExposuresHistory.tsx b/src/components/Main/ExposuresHistory/ExposuresHistory.tsx index 933b9722..bc87dfd6 100644 --- a/src/components/Main/ExposuresHistory/ExposuresHistory.tsx +++ b/src/components/Main/ExposuresHistory/ExposuresHistory.tsx @@ -8,6 +8,7 @@ import { Exposure } from '../../../types'; import { PADDING_TOP, SCREEN_WIDTH, IS_SMALL_SCREEN, MAIN_COLOR, HIT_SLOP, WHITE } from '../../../constants/Constants'; import ExposureHistoryListItem from './ExposureHistoryListItem'; import { showMapModal } from '../../../actions/GeneralActions'; +import * as LocalizedStyles from '../../../constants/LocalizedStyles'; interface Props { navigation: StackNavigationProp, @@ -38,9 +39,9 @@ const ExposuresHistory = ( // show button if list is not empty or all exposures are of type BLE and can't be edited const showEditBtn = useMemo(() => wasThereList.length + wasNotThereList.length > 0 && !pastExposures.every((exposure: Exposure) => exposure.properties.BLETimestamp), [wasThereList, wasNotThereList]); const [tabsLayout, setTabsLayout] = useState({}); - const [lineAnimLeft] = useState(new Animated.Value(isRTL ? SCREEN_WIDTH : 0)); + const [lineAnimLeft] = useState(new Animated.Value(LocalizedStyles.leading(isRTL))); const [lineAnimWidth] = useState(new Animated.Value(0)); - const [listTranslateAnim] = useState(new Animated.Value(isRTL ? SCREEN_WIDTH : 0)); + const [listTranslateAnim] = useState(new Animated.Value(LocalizedStyles.leading(isRTL))); const [firstLoad, setFirstLoad] = useState(true); useEffect(() => { @@ -73,8 +74,8 @@ const ExposuresHistory = ( navigation.navigate('ExposuresHistoryEdit')} > @@ -88,7 +89,7 @@ const ExposuresHistory = ( {title} {subTitle} - + - - + + - + { const dispatch = useDispatch(); @@ -117,7 +117,7 @@ const ExposuresHistoryEdit = ({ navigation }) => { paddingVertical: 10, alignItems: 'center', paddingHorizontal: 16, - flexDirection: isRTL ? 'row-reverse' : 'row', + flexDirection: LocalizedStyles.flexDirection(isRTL), backgroundColor: 'rgb(242,250,253)', }} > @@ -125,7 +125,7 @@ const ExposuresHistoryEdit = ({ navigation }) => { width={16} source={require('../../../assets/main/moreInfo.png')} customStyles={{ - [isRTL ? 'marginLeft' : 'marginRight']: 8 + [LocalizedStyles.marginSide(isRTL, true)]: 8 }} /> { )} /> - + {!BLETimestamp && Place && ( = ({ isRTL, info, moreInfo, onPress }) => { return ( - + - - {info} + + {info} - {moreInfo} + {moreInfo} diff --git a/src/components/Main/NoExposures.tsx b/src/components/Main/NoExposures.tsx index 524abd12..1f6b9637 100644 --- a/src/components/Main/NoExposures.tsx +++ b/src/components/Main/NoExposures.tsx @@ -9,7 +9,7 @@ import InfoModal from './Modals/InfoModal'; import { FadeInView, Text, Icon, TouchableOpacity } from '../common'; import { Strings, Languages, ExternalUrls } from '../../locale/LocaleData'; import { IS_SMALL_SCREEN, HIT_SLOP, PADDING_BOTTOM, SCREEN_WIDTH, IS_IOS } from '../../constants/Constants'; - +import * as LocalizedStyles from '../../constants/LocalizedStyles'; interface NoExposuresProps { isRTL: boolean @@ -86,16 +86,16 @@ const NoExposures: FunctionComponent = ({ exposureState, langu const furtherInstructions = externalUrls.furtherInstructions[relevantLocale]; return ( - Linking.openURL(furtherInstructions)}> + Linking.openURL(furtherInstructions)}> - {instructionLinkUpper} - {instructionLinkLower} + {instructionLinkUpper} + {instructionLinkLower} ); diff --git a/src/components/Main/ScanHomeHeader.tsx b/src/components/Main/ScanHomeHeader.tsx index 53a36c38..21dc99f2 100644 --- a/src/components/Main/ScanHomeHeader.tsx +++ b/src/components/Main/ScanHomeHeader.tsx @@ -5,6 +5,7 @@ import { TouchableOpacity, Icon } from '../common'; import { onError } from '../../services/ErrorService'; import { ExternalUrls, Strings, Languages } from '../../locale/LocaleData'; import { HIT_SLOP, PADDING_TOP, SCREEN_HEIGHT, SCREEN_WIDTH, SHOW_DOT_BY_BUILD_NUMBER, MENU_DOT_LAST_SEEN, VERSION_BUILD } from '../../constants/Constants'; +import * as LocalizedStyles from '../../constants/LocalizedStyles'; interface ScanHomeHeaderProps { isRTL: boolean, @@ -51,7 +52,7 @@ const ScanHomeHeader: FunctionComponent = ({ isRTL, languag resizeMode="stretch" resizeMethod="resize" > - + { diff --git a/src/components/Main/Settings/BatterySettings.tsx b/src/components/Main/Settings/BatterySettings.tsx index 4e09bd6c..9eed3d03 100644 --- a/src/components/Main/Settings/BatterySettings.tsx +++ b/src/components/Main/Settings/BatterySettings.tsx @@ -11,6 +11,7 @@ import { ActionButton, Icon, Text, TouchableOpacity, HeaderButton } from '../../ import { USER_DISABLED_BATTERY } from '../../../constants/ActionTypes'; import { IS_SMALL_SCREEN, MAIN_COLOR, SCREEN_WIDTH, USER_AGREED_TO_BATTERY, PADDING_TOP, PADDING_BOTTOM, BASIC_SHADOW_STYLES, WHITE, HIT_SLOP } from '../../../constants/Constants'; import { LocaleReducer, Store, GeneralReducer } from '../../../types'; +import * as LocalizedStyles from '../../../constants/LocalizedStyles'; interface Props { onEnd(): void @@ -48,7 +49,7 @@ const BatteryPermission: FunctionComponent = ({ navigation }) => { paddingVertical: IS_SMALL_SCREEN ? 16 : 24, paddingHorizontal: IS_SMALL_SCREEN ? 8 : 16, borderRadius: 13, - flexDirection: isRTL ? 'row-reverse' : 'row', + flexDirection: LocalizedStyles.flexDirection(isRTL), }]} > @@ -63,10 +64,10 @@ const BatteryPermission: FunctionComponent = ({ navigation }) => { }} style={{ paddingHorizontal: IS_SMALL_SCREEN ? 8 : 16, backgroundColor: WHITE }} > - {batteryDisabled ? batteryOptimizationOn : batteryOptimizationOff } - + {batteryDisabled ? batteryOptimizationOn : batteryOptimizationOff } + - {settingsBtn} + {settingsBtn} diff --git a/src/components/Main/Settings/BluetoothSettings.tsx b/src/components/Main/Settings/BluetoothSettings.tsx index 46b25128..02528ff4 100644 --- a/src/components/Main/Settings/BluetoothSettings.tsx +++ b/src/components/Main/Settings/BluetoothSettings.tsx @@ -12,6 +12,7 @@ import { USER_DISABLED_BATTERY, ENABLE_BLE } from '../../../constants/ActionType import { IS_SMALL_SCREEN, MAIN_COLOR, SCREEN_WIDTH, USER_AGREED_TO_BATTERY, PADDING_TOP, PADDING_BOTTOM, BASIC_SHADOW_STYLES, WHITE, HIT_SLOP, USER_AGREE_TO_BLE } from '../../../constants/Constants'; import { LocaleReducer, Store, GeneralReducer } from '../../../types'; import { initBLETracing } from '../../../services/BLEService'; +import * as LocalizedStyles from '../../../constants/LocalizedStyles'; interface Props { @@ -49,17 +50,17 @@ const BluetoothSettings: FunctionComponent = ({ navigation }) => { paddingVertical: IS_SMALL_SCREEN ? 16 : 24, paddingHorizontal: IS_SMALL_SCREEN ? 8 : 16, borderRadius: 13, - flexDirection: isRTL ? 'row-reverse' : 'row', + flexDirection: LocalizedStyles.flexDirection(isRTL), justifyContent: 'space-between', alignItems: 'center' }]} > - {enableBle ? BLEOn : BLEOff} + {enableBle ? BLEOn : BLEOff} { dispatch({ type: ENABLE_BLE, payload }); diff --git a/src/components/Onboarding/LocationIOS.tsx b/src/components/Onboarding/LocationIOS.tsx index a217472b..1398b634 100644 --- a/src/components/Onboarding/LocationIOS.tsx +++ b/src/components/Onboarding/LocationIOS.tsx @@ -7,6 +7,7 @@ import { ActionButton, GeneralContainer, TouchableOpacity, Text, OnboardingHeade import { onError } from '../../services/ErrorService'; import { Strings } from '../../locale/LocaleData'; import { IS_SMALL_SCREEN, MAIN_COLOR, SCREEN_WIDTH, ENABLE_BLE } from '../../constants/Constants'; +import * as LocalizedStyles from '../../constants/LocalizedStyles'; interface Props { navigation: StackNavigationProp, @@ -57,7 +58,7 @@ const LocationIOS = ({ navigation, strings: { locationIOS: { title, subTitle1, s Linking.openURL('app-settings:')}> - + {goToSettings} diff --git a/src/components/ShareLocations/ShareLocations.tsx b/src/components/ShareLocations/ShareLocations.tsx index 73d80423..e1de1a44 100644 --- a/src/components/ShareLocations/ShareLocations.tsx +++ b/src/components/ShareLocations/ShareLocations.tsx @@ -9,6 +9,7 @@ import { shareUserLocations } from '../../actions/DeepLinkActions'; import { Strings } from '../../locale/LocaleData'; import { LocaleReducer, Store } from '../../types'; import { IS_SMALL_SCREEN, PADDING_BOTTOM, PADDING_TOP, TEXT_COLOR, IS_IOS, ENABLE_BLE } from '../../constants/Constants'; +import * as LocalizedStyles from '../../constants/LocalizedStyles'; interface Props { route: any, @@ -128,12 +129,12 @@ const ShareLocations = ({ route, navigation }: Props) => { const AgreeToBleCheckbox = () => { if (!IS_IOS && ENABLE_BLE && state === 'beforeShare') { return ( - onValueSelected(!agreeToBle)} accessibilityRole="checkbox" checked={agreeToBle}> + onValueSelected(!agreeToBle)} accessibilityRole="checkbox" checked={agreeToBle}> {agreeToBle && } - {addBleDataText} + {addBleDataText} ); diff --git a/src/components/common/CardIdentifyTag.tsx b/src/components/common/CardIdentifyTag.tsx index 2be00adc..02cddd20 100644 --- a/src/components/common/CardIdentifyTag.tsx +++ b/src/components/common/CardIdentifyTag.tsx @@ -1,6 +1,7 @@ import React, { FunctionComponent } from 'react'; import { View } from 'react-native'; import { Text } from '.'; +import * as LocalizedStyles from '../../constants/LocalizedStyles' interface Props { isRTL: boolean, @@ -16,10 +17,10 @@ const CardIdentifyTag: FunctionComponent = ({ isRTL, text, color, float = paddingHorizontal: 11, paddingVertical: 5 }, { - [isRTL ? 'borderBottomRightRadius' : 'borderBottomLeftRadius']: 13, + [LocalizedStyles.borderBottomSideRadius(isRTL)]: 13, }, float && { position: 'absolute', - [isRTL ? 'left' : 'right']: 0, + [LocalizedStyles.side(isRTL, true)]: 0, }]} > {text} diff --git a/src/components/common/HeaderButton.tsx b/src/components/common/HeaderButton.tsx index 06e5d91a..51f77479 100644 --- a/src/components/common/HeaderButton.tsx +++ b/src/components/common/HeaderButton.tsx @@ -4,6 +4,7 @@ import { useSelector } from 'react-redux'; import { TouchableOpacity, Icon } from '.'; import { LocaleReducer, Store } from '../../types'; import { IS_SMALL_SCREEN, PADDING_TOP, HIT_SLOP } from '../../constants/Constants'; +import * as LocalizedStyles from '../../constants/LocalizedStyles'; interface Props { type?: 'close'|'back', @@ -18,8 +19,8 @@ const HeaderButton = ({ type = 'back', onPress }: Props) => { hitSlop={HIT_SLOP} style={[styles.close, { top: PADDING_TOP(IS_SMALL_SCREEN ? 10 : 20), - [!isRTL ? 'right' : 'left']: IS_SMALL_SCREEN ? 10 : 20, - transform: [{ rotate: !isRTL ? '0deg' : '180deg' }] + [LocalizedStyles.side(isRTL, true)]: IS_SMALL_SCREEN ? 10 : 20, + transform: [{ rotate: LocalizedStyles.rotateDegree(isRTL) }] }]} onPress={onPress} importantForAccessibility="no-hide-descendants" diff --git a/src/components/common/TermsOfUse.tsx b/src/components/common/TermsOfUse.tsx index 9ae24d93..f35b133e 100644 --- a/src/components/common/TermsOfUse.tsx +++ b/src/components/common/TermsOfUse.tsx @@ -3,6 +3,7 @@ import { StyleSheet, View } from 'react-native'; import { Icon, TouchableOpacity, Text } from '.'; import { Strings } from '../../locale/LocaleData'; import { SCREEN_WIDTH, TEXT_COLOR, USAGE_ON_BOARDING } from '../../constants/Constants'; +import * as LocalizedStyles from '../../constants/LocalizedStyles'; interface Props { isRTL: boolean, @@ -14,7 +15,7 @@ interface Props { const TermsOfUse = ({ isRTL, strings: { general: { readTOU, approveTOU }, location: { consent1, consent2 } }, value, onValueSelected, toggleWebview }: Props) => { return ( - + onValueSelected(!value)} accessibilityLabel={approveTOU} accessibilityRole="checkbox" checked={value}> {value && } @@ -22,7 +23,7 @@ const TermsOfUse = ({ isRTL, strings: { general: { readTOU, approveTOU }, locati toggleWebview(true, USAGE_ON_BOARDING)} accessibilityHint={readTOU}> - + {consent1} {consent2} diff --git a/src/constants/LocalizedStyles.ts b/src/constants/LocalizedStyles.ts new file mode 100644 index 00000000..d24d7c87 --- /dev/null +++ b/src/constants/LocalizedStyles.ts @@ -0,0 +1,41 @@ +import {SCREEN_WIDTH} from '../constants/Constants'; + +export const marginSide = (isRTL: boolean, reverse?: boolean) => { + return isRTL && !reverse ? 'marginRight' : 'marginLeft'; +}; + +export const side = (isRTL: boolean, reverse?: boolean) => { + return isRTL && !reverse ? 'right' : 'left'; +}; + +export const flexDirection = (isRTL: boolean, reverse?: boolean) => { + return isRTL && !reverse ? 'row-reverse' : 'row'; +}; + +export const borderBottomSideRadius = (isRTL: boolean) => { + return isRTL ? 'borderBottomRightRadius' : 'borderBottomLeftRadius'; +}; + +export const rotateDegree = (isRTL: boolean, reverse?: boolean) => { + return isRTL && !reverse ? '180deg' : '0deg'; +}; + +export const alignSelf = (isRTL: boolean) => { + return isRTL ? 'flex-end' : 'flex-start'; +}; + +export const alignItems = (isRTL: boolean) => { + return isRTL ? 'flex-end' : 'flex-start'; +}; + +export const paddingSide = (isRTL: boolean) => { + return isRTL ? 'paddingLeft' : 'paddingRight'; +}; + +export const leading = (isRTL: boolean) => { + return isRTL ? SCREEN_WIDTH : 0; +}; + +export const translateAnim = (isRTL: boolean) => { + return isRTL ? -1 : 1; +};