From 40a2d527a0a41b267ea2f05014f0c5b3141ba058 Mon Sep 17 00:00:00 2001 From: hamed Date: Tue, 23 Nov 2021 19:12:10 +0330 Subject: [PATCH] bottom tab navigator added & multi language added --- navigation.js | 62 ++++++++++++++----- package-lock.json | 40 ++++++++++++ package.json | 3 + src/actions/actionTypes.js | 3 +- src/reducers/index.js | 3 + src/screens/Home/components/carousel.js | 5 +- src/services/i18n/index.js | 14 +++++ src/services/i18n/locales/en/translation.json | 28 +++++++++ src/services/i18n/locales/fa/translation.json | 29 +++++++++ src/services/i18n/locales/index.js | 11 ++++ 10 files changed, 180 insertions(+), 18 deletions(-) create mode 100644 src/services/i18n/index.js create mode 100644 src/services/i18n/locales/en/translation.json create mode 100644 src/services/i18n/locales/fa/translation.json create mode 100644 src/services/i18n/locales/index.js diff --git a/navigation.js b/navigation.js index a475881..66262f9 100644 --- a/navigation.js +++ b/navigation.js @@ -1,6 +1,7 @@ import * as React from 'react'; import {NavigationContainer} from '@react-navigation/native'; import {createNativeStackNavigator} from '@react-navigation/native-stack'; +import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; import Splash from './src/screens/Splash'; import Home from './src/screens/Home'; import Login from './src/screens/Login'; @@ -10,16 +11,51 @@ import Products from './src/screens/Products'; import ShoppingCart from './src/screens/ShoppingCart'; import QR from './src/screens/QR/index'; import {connect} from 'react-redux'; +import i18n from "./src/services/i18n"; +import {useTranslation} from "react-i18next"; +import Profile from "./src/screens/Profile"; const mapStateToProps = state => { return { profile: state.profile, + config: state.config, }; }; const Stack = createNativeStackNavigator(); +const Tab = createBottomTabNavigator(); + +function BottomTab(props) { + + const {t} = useTranslation('translation', {keyPrefix: 'main'}); + + return ( + + + + + + + + ) +} function Navigator(props) { + + React.useEffect(() => { + i18n.changeLanguage(props.config.lan) + }, [props.config]) + return ( @@ -28,21 +64,17 @@ function Navigator(props) { name="Splash" component={Splash} /> - <> - - - - <> - - + + +