remaining headers added with localisation

This commit is contained in:
Kashif Shehzad Baloch 2024-01-09 12:18:43 +05:00
parent 8c829be3df
commit 4fe9049c1e
10 changed files with 46 additions and 14 deletions

1
RiderApp/.gitignore vendored
View File

@ -1 +1,2 @@
/node_modules /node_modules
/dist

View File

@ -148,4 +148,8 @@ export const de = {
Assigntome: 'Toewijzen aan mij', Assigntome: 'Toewijzen aan mij',
'About Us': 'Over Ons', 'About Us': 'Over Ons',
'Product Page': 'Product Pagina', 'Product Page': 'Product Pagina',
Order: 'Bestelling',
OrderMarkedAs: 'Bestelling gemarkeerd als',
titleLogin: 'Inloggen',
Picked: 'Gekozen',
} }

View File

@ -146,5 +146,9 @@ export const en = {
Subtotal: 'Subtotal', Subtotal: 'Subtotal',
Assigntome: 'Assign to me', Assigntome: 'Assign to me',
'About Us': 'About Us', 'About Us': 'About Us',
'Product Page': 'Product Page' 'Product Page': 'Product Page',
Order: 'Order',
OrderMarkedAs: 'Order marked as',
titleLogin: 'Login',
Picked: 'Picked'
} }

View File

@ -148,4 +148,8 @@ export const fr = {
Assigntome: 'Attribuer à moi', Assigntome: 'Attribuer à moi',
'About Us': 'À Propos de Nous', 'About Us': 'À Propos de Nous',
'Product Page': 'Page Produit', 'Product Page': 'Page Produit',
Order: 'Commande',
OrderMarkedAs: 'Commande marquée comme',
titleLogin: 'Connexion',
Picked: 'Choisi',
} }

View File

@ -145,4 +145,7 @@ export const km = {
Assigntome: 'ផ្ដល់ទៅខ្លួនឯង', Assigntome: 'ផ្ដល់ទៅខ្លួនឯង',
'About Us': 'អំពីយើង', 'About Us': 'អំពីយើង',
'Product Page': 'ទំព័រផលិតផល', 'Product Page': 'ទំព័រផលិតផល',
Order: 'បញ្ជាទិញ',
OrderMarkedAs: 'បញ្ជាតម្រៀបជានៅជិត',
Picked: 'បានជ្រើសរើស',
} }

View File

@ -141,4 +141,8 @@ export const zh = {
Assigntome: '分配给我', Assigntome: '分配给我',
'About Us': '关于我们', 'About Us': '关于我们',
'Product Page': '产品页面', 'Product Page': '产品页面',
Order: '订单',
OrderMarkedAs: '标记为订单',
titleLogin: '登录',
Picked: '已选取',
} }

View File

@ -1,6 +1,6 @@
import { Feather, FontAwesome } from '@expo/vector-icons' import { Feather, FontAwesome } from '@expo/vector-icons'
import { useNavigation } from '@react-navigation/native' import { useNavigation } from '@react-navigation/native'
import React, { useCallback, useEffect, useState } from 'react' import React, { useCallback, useEffect, useState, useLayoutEffect } from 'react'
import { Keyboard, View } from 'react-native' import { Keyboard, View } from 'react-native'
import { import {
Bubble, Bubble,
@ -13,6 +13,7 @@ import { alignment } from '../../utilities/alignment'
import colors from '../../utilities/colors' import colors from '../../utilities/colors'
import { scale } from '../../utilities/scaling' import { scale } from '../../utilities/scaling'
import useStyle from './styles' import useStyle from './styles'
import i18n from '../../../i18n'
const UserInfo = { const UserInfo = {
_id: 1, _id: 1,
@ -42,7 +43,7 @@ function Chat() {
useEffect(() => { useEffect(() => {
navigation.setOptions({ navigation.setOptions({
title: 'Chat' headerTitle: i18n.t('titleChat')
}) })
setMessages([ setMessages([
{ {

View File

@ -4,7 +4,7 @@ import { useNavigation } from '@react-navigation/native'
import Constants from 'expo-constants' import Constants from 'expo-constants'
import * as Notifications from 'expo-notifications' import * as Notifications from 'expo-notifications'
import gql from 'graphql-tag' import gql from 'graphql-tag'
import React, { useContext, useEffect, useState } from 'react' import React, { useContext, useEffect, useState,useLayoutEffect } from 'react'
import { import {
KeyboardAvoidingView, KeyboardAvoidingView,
Platform, Platform,
@ -38,11 +38,13 @@ export default function Login() {
const { setTokenAsync } = useContext(AuthContext) const { setTokenAsync } = useContext(AuthContext)
useEffect(() => {
useLayoutEffect(() => {
navigation.setOptions({ navigation.setOptions({
headerLeft: null headerRight: null,
headerTitle: i18n.t('titleHelp')
}) })
}, []) }, [navigation])
const [mutate, { loading }] = useMutation(RIDER_LOGIN, { const [mutate, { loading }] = useMutation(RIDER_LOGIN, {
onCompleted, onCompleted,

View File

@ -71,13 +71,13 @@ function OrderDetail() {
useLayoutEffect(() => { useLayoutEffect(() => {
if (!selectedOrder) return; if (!selectedOrder) return;
navigation.setOptions({ navigation.setOptions({
title: `Order ${selectedOrder.order_id}`, title: `${i18n.t('Order')} ${selectedOrder.order_id}`,
}); });
}, [selectedOrder]); }, [selectedOrder]);
async function onCompleted({ updateOrderStatusRider, assignOrder }) { async function onCompleted({ updateOrderStatusRider, assignOrder }) {
if (updateOrderStatusRider) { if (updateOrderStatusRider) {
FlashMessage({ FlashMessage({
message: `Order marked as ${updateOrderStatusRider.order_status}`, message: `${i18n.t('OrderMarkedAs')} ${updateOrderStatusRider.order_status}`,
}); });
if (updateOrderStatusRider.order_status === "DELIVERED") { if (updateOrderStatusRider.order_status === "DELIVERED") {
navigation.goBack(); navigation.goBack();

View File

@ -1,4 +1,5 @@
import React, { useEffect, useState } from 'react' import React, { useEffect, useState, useLayoutEffect } from 'react'
import { useNavigation } from '@react-navigation/native'
import { import {
ImageBackground, ImageBackground,
StatusBar, StatusBar,
@ -15,11 +16,19 @@ const BACKGROUND_IMAGE = require('../../../assets/images/ui/BG.png')
export default function Orders() { export default function Orders() {
const styles = useStyle() const styles = useStyle()
const [isNewOrderSelected, setIsNewOrderSelected] = useState(false) const [isNewOrderSelected, setIsNewOrderSelected] = useState(false)
const navigation = useNavigation()
useEffect(() => { useEffect(() => {
StatusBar.setBarStyle('light-content') StatusBar.setBarStyle('light-content')
}, [isNewOrderSelected]) }, [isNewOrderSelected])
useLayoutEffect(() => {
navigation.setOptions({
headerRight: null,
headerTitle: i18n.t('Orders')
})
}, [navigation])
return ( return (
<View style={[styles.flex, styles.bottom]}> <View style={[styles.flex, styles.bottom]}>
<ImageBackground style={styles.imageContainer} source={BACKGROUND_IMAGE}> <ImageBackground style={styles.imageContainer} source={BACKGROUND_IMAGE}>