diff --git a/App.js b/App.js index a10e755..bd69245 100644 --- a/App.js +++ b/App.js @@ -1,50 +1,22 @@ -import React from "react"; -import { StyleSheet, useColorScheme } from "react-native"; -import AsyncStorage from "@react-native-async-storage/async-storage"; -import { Provider } from "react-redux"; -import { applyMiddleware, createStore, compose } from "redux"; -import { createLogger } from "redux-logger"; -import thunk from "redux-thunk"; -import { persistStore, persistReducer } from "redux-persist"; -import autoMergeLevel2 from "redux-persist/lib/stateReconciler/autoMergeLevel2"; -import allReducers from "./src/reducers"; +import { StyleSheet } from "react-native"; +import { useFonts } from "expo-font"; +import AppLoading from "expo-app-loading"; import Navigation from "./navigation/index"; import AlertModal from "./src/components/AlertModal"; +import { Provider } from "react-redux"; +import store from './src/redux/store'; -const persistConfig = { - key: "root", - storage: AsyncStorage, - stateReconciler: autoMergeLevel2, // see "Merge Process" section for details. - whitelist: ["profile"], -}; -const pReducer = persistReducer(persistConfig, allReducers); - -const middleWare = []; - -middleWare.push(thunk); - -const loggerMiddleware = createLogger({ - predicate: () => process.env.NODE_ENV === "development", -}); -middleWare.push(loggerMiddleware); - -const store = createStore(pReducer, compose(applyMiddleware(...middleWare))); - -const persistor = persistStore(store); - -const ReactNative = require("react-native"); -try { - ReactNative.I18nManager.allowRTL(true); - // enableScreens(); -} catch (e) { - console.log(e); -} - -console.disableYellowBox = true; const App = () => { - const isDarkMode = useColorScheme() === "dark"; - + let [fontsLoaded] = useFonts({ + light : require("./assets/fonts/Farsi/IRANSansXFaNum-Light.ttf"), + regular: require("./assets/fonts/Farsi/IRANSansXFaNum-Regular.ttf"), + bold: require("./assets/fonts/Farsi/IRANSansXFaNum-Medium.ttf"), + }); + + if (!fontsLoaded) { + return ; + } return ( diff --git a/assets/fonts/Farsi/IRANSansXFaNum-Black.ttf b/assets/fonts/Farsi/IRANSansXFaNum-Black.ttf new file mode 100644 index 0000000..a073217 Binary files /dev/null and b/assets/fonts/Farsi/IRANSansXFaNum-Black.ttf differ diff --git a/assets/fonts/Farsi/IRANSansXFaNum-Bold.ttf b/assets/fonts/Farsi/IRANSansXFaNum-Bold.ttf new file mode 100644 index 0000000..84d2767 Binary files /dev/null and b/assets/fonts/Farsi/IRANSansXFaNum-Bold.ttf differ diff --git a/assets/fonts/Farsi/IRANSansXFaNum-DemiBold.ttf b/assets/fonts/Farsi/IRANSansXFaNum-DemiBold.ttf new file mode 100644 index 0000000..4fd2c73 Binary files /dev/null and b/assets/fonts/Farsi/IRANSansXFaNum-DemiBold.ttf differ diff --git a/assets/fonts/Farsi/IRANSansXFaNum-ExtraBold.ttf b/assets/fonts/Farsi/IRANSansXFaNum-ExtraBold.ttf new file mode 100644 index 0000000..21d4fbf Binary files /dev/null and b/assets/fonts/Farsi/IRANSansXFaNum-ExtraBold.ttf differ diff --git a/assets/fonts/Farsi/IRANSansXFaNum-Light.ttf b/assets/fonts/Farsi/IRANSansXFaNum-Light.ttf new file mode 100644 index 0000000..4807f62 Binary files /dev/null and b/assets/fonts/Farsi/IRANSansXFaNum-Light.ttf differ diff --git a/assets/fonts/Farsi/IRANSansXFaNum-Medium.ttf b/assets/fonts/Farsi/IRANSansXFaNum-Medium.ttf new file mode 100644 index 0000000..4d88319 Binary files /dev/null and b/assets/fonts/Farsi/IRANSansXFaNum-Medium.ttf differ diff --git a/assets/fonts/Farsi/IRANSansXFaNum-Regular.ttf b/assets/fonts/Farsi/IRANSansXFaNum-Regular.ttf new file mode 100644 index 0000000..385e013 Binary files /dev/null and b/assets/fonts/Farsi/IRANSansXFaNum-Regular.ttf differ diff --git a/assets/fonts/Farsi/IRANSansXFaNum-Thin.ttf b/assets/fonts/Farsi/IRANSansXFaNum-Thin.ttf new file mode 100644 index 0000000..da257b5 Binary files /dev/null and b/assets/fonts/Farsi/IRANSansXFaNum-Thin.ttf differ diff --git a/assets/fonts/Farsi/IRANSansXFaNum-UltraLight.ttf b/assets/fonts/Farsi/IRANSansXFaNum-UltraLight.ttf new file mode 100644 index 0000000..d8a5468 Binary files /dev/null and b/assets/fonts/Farsi/IRANSansXFaNum-UltraLight.ttf differ diff --git a/navigation/BottomNavigation.js b/navigation/BottomNavigation.js deleted file mode 100644 index c4c19e3..0000000 --- a/navigation/BottomNavigation.js +++ /dev/null @@ -1,54 +0,0 @@ -import React from "react"; -import { createBottomTabNavigator } from "@react-navigation/bottom-tabs"; -import Home from "../src/screens/Home"; -import ShoppingCart from '../src/screens/ShoppingCart'; -import Products from "../src/screens/Products"; -import { Entypo, FontAwesome } from "@expo/vector-icons"; - -const Tab = createBottomTabNavigator(); - -const BottomTabNavigator = () => { - return ( - - ( - - ), - }} - /> - ( - - ), - }} - /> - ( - - ), - }} - /> - - ); -}; - -export default BottomTabNavigator; \ No newline at end of file diff --git a/navigation/index.js b/navigation/index.js index d2b66ca..bfe77d6 100644 --- a/navigation/index.js +++ b/navigation/index.js @@ -1,9 +1,13 @@ import React from "react"; import { NavigationContainer } from "@react-navigation/native"; import { createNativeStackNavigator } from "@react-navigation/native-stack"; -import BottomTabNavigator from "./BottomNavigation"; +import { createBottomTabNavigator } from "@react-navigation/bottom-tabs"; +import { Entypo, FontAwesome, Ionicons } from "@expo/vector-icons"; +import OrderDetails from "../src/screens/OrderDetails"; +import { Dimensions } from "react-native"; import Splash from "../src/screens/Splash"; import Home from "../src/screens/Home"; +import Products from "../src/screens/Products"; import Login from "../src/screens/Login"; import Otp from "../src/screens/Otp"; import Product from "../src/screens/Product"; @@ -14,7 +18,114 @@ import { useTranslation } from "react-i18next"; import Profile from "../src/screens/Profile"; import Videos from "../src/screens/Videos"; import Exams from "../src/screens/Exams"; -import OrderDetails from "../src/screens/OrderDetails"; +import ShoppingCart from "../src/screens/ShoppingCart"; + +const width = Dimensions.get("window").width; + +const Tab = createBottomTabNavigator(); +const BottomTabNavigator = () => { + return ( + + ( + + ), + }} + /> + ( + + ), + }} + /> + ( + + ), + }} + /> + ( + + ), + }} + /> + + ); +}; + +const HomeStack = createNativeStackNavigator(); +const HomeStackScreen = () => { + return ( + + + + + + ); +}; + +const ProductsStack = createNativeStackNavigator(); +const ProductsStackScreen = () => { + return ( + + + + + + ); +}; + +const AuthStack = createNativeStackNavigator(); +const AuthStackScreen = () => { + return ( + + + + + + ); +}; const Stack = createNativeStackNavigator(); @@ -26,11 +137,6 @@ const Navigation = () => { screenOptions={{ headerShown: false }} > - - - - - ); diff --git a/package.json b/package.json index 99cc228..1ac3f82 100644 --- a/package.json +++ b/package.json @@ -10,14 +10,18 @@ "eject": "expo eject" }, "dependencies": { + "@expo-google-fonts/noto-sans": "^0.2.0", "@react-native-async-storage/async-storage": "~1.15.0", "@react-navigation/bottom-tabs": "^6.0.9", + "@react-navigation/drawer": "^6.1.8", "@react-navigation/native": "^6.0.6", "@react-navigation/native-stack": "^6.2.5", "expo": "^44.0.1", + "expo-app-loading": "~1.3.0", "expo-barcode-scanner": "~11.2.0", "expo-camera": "~12.1.0", "expo-device": "~4.1.0", + "expo-font": "^10.0.4", "expo-status-bar": "~1.2.0", "i18next": "^21.6.3", "install": "^0.13.0", diff --git a/src/assets/video.mp4 b/src/assets/video.mp4 deleted file mode 100644 index fd6954b..0000000 Binary files a/src/assets/video.mp4 and /dev/null differ diff --git a/src/components/CustomTextInput.js b/src/components/CustomTextInput.js index 4d84604..64e63cb 100644 --- a/src/components/CustomTextInput.js +++ b/src/components/CustomTextInput.js @@ -1,6 +1,8 @@ import React, {useState} from 'react'; import {TextInput, View, Text, Dimensions, StyleSheet} from 'react-native'; -import tw from 'tailwind-react-native-classnames'; +import tw from 'tailwind-rn'; + +const width = Dimensions.get('window').width; const FloatingLabelInput = ({ label, @@ -8,48 +10,47 @@ const FloatingLabelInput = ({ direction, labelBackgroundColor, onChange, - value, name, + value, + color, + maxLength, + autoFocus, ...props }) => { const [isFocused, setIsFocused] = useState(false); const styles = StyleSheet.create({ labelStyle: { - position: 'absolute', - right: 15, - backgroundColor: 'white', - zIndex: 100, - paddingHorizontal: 5, - textAlign: 'center', - top: !isFocused ? '50%' : 0, - fontSize: !isFocused ? Dimensions.get('window').width / 27 : 14, - transform: [{translateY: -Dimensions.get('window').width / 35}], - color: !isFocused ? '#555' : '#6CBE44', - // transition: Transitions.all(Transitions.) + fontFamily: 'regular', + top: !isFocused ? '50%' : 1, + fontSize: !isFocused ? width / 36 : width / 40, + transform: [{translateY: -width / 35}], + color: !isFocused ? '#555' : '#196EC0', }, inputStyle: { - fontSize: Dimensions.get('window').width / 25, + fontSize: Dimensions.get('window').width / 27, color: '#000', - borderWidth: 0.5, - borderColor: isFocused ? '#6CBE44' : '#555', - paddingVertical: 15, - paddingHorizontal: 10, - direction: 'rtl', - textAlign: 'right', + borderWidth: 1, + borderColor: isFocused ? '#196EC0' : '#777', + textAlign: textAlign, + fontFamily: 'light' }, }); return ( - + + style={[styles.labelStyle, tw('px-1 z-10 bg-white absolute right-4 text-center')]}> {label} onChange(name, text)} + placeholder={'09123456789'} onFocus={() => setIsFocused(true)} + autoFocus={autoFocus} + underlineColorAndroid={"transparent"} + maxLength={maxLength} onBlur={() => - value ? setIsFocused(() => true) : setIsFocused(() => false) + value ? setIsFocused(() => false) : setIsFocused(() => false) } /> diff --git a/src/components/Header.js b/src/components/Header.js index 9aa2911..693d7fc 100644 --- a/src/components/Header.js +++ b/src/components/Header.js @@ -17,14 +17,14 @@ export default function Header({icon, title, description, background}) { {title} {description} diff --git a/src/components/Navbar.js b/src/components/Navbar.js index f9017d9..f407809 100644 --- a/src/components/Navbar.js +++ b/src/components/Navbar.js @@ -57,7 +57,7 @@ const Navbar = ({ notification }) => { )} navigation.navigate("Home")} + onPress={() => navigation.navigate("خانه")} style={tw("absolute right-1/2 top-1/2")} > - {title} + {title} ); } diff --git a/src/components/Progress.js b/src/components/Progress.js index 0c5dc68..d54489a 100644 --- a/src/components/Progress.js +++ b/src/components/Progress.js @@ -5,7 +5,7 @@ import tw from 'tailwind-rn'; //Color import Color from '../constants/Colors'; -function Progress({percent}) { +function Progress({percent, alignItems}) { const [delayPercent, setDelayPercent] = useState(0); useEffect(() => { setTimeout(() => { @@ -15,14 +15,14 @@ function Progress({percent}) { return ( { const styles = StyleSheet.create({ inputStyle: { - fontSize: width / 30, + fontSize: width / 36, color: '#000', borderWidth: 0.5, borderColor: '#DBDBDB', @@ -29,6 +29,7 @@ const Search = ({ direction: direction, textAlign: textAlign, backgroundColor: '#F9F9F9', + fontFamily : 'light' }, }); return ( @@ -40,7 +41,7 @@ const Search = ({ placeholderTextColor={'#cccccc'} value={value} /> - + diff --git a/src/components/Select.js b/src/components/Select.js index 4f38377..223434e 100644 --- a/src/components/Select.js +++ b/src/components/Select.js @@ -15,16 +15,18 @@ function Select({iconPosition, options, onChange, value, width, defaultValue}) { borderRadius: 6, height: 36, backgroundColor: '#F9F9F9', + fontFamily : 'light' }} - rowTextStyle={{fontSize: Dimensions.get('window').width / 30}} + rowTextStyle={{fontSize: Dimensions.get('window').width / 36, fontFamily : 'light'}} defaultButtonText={defaultValue} statusBarTranslucent={true} buttonTextStyle={{ textAlign: 'center', justifyContent: 'flex-end', flex: 0, - fontSize: Dimensions.get('window').width / 30, + fontSize: Dimensions.get('window').width / 36, color: '#707070', + fontFamily : 'light' // display: 'inline' }} dropdownIconPosition={iconPosition} diff --git a/src/reducers/index.js b/src/reducers/index.js index f0b0c71..1d0c85e 100644 --- a/src/reducers/index.js +++ b/src/reducers/index.js @@ -11,4 +11,4 @@ const allReducers = combineReducers({ }), }); -export default allReducers; +export default allReducers; \ No newline at end of file diff --git a/src/redux/store.js b/src/redux/store.js new file mode 100644 index 0000000..32172bb --- /dev/null +++ b/src/redux/store.js @@ -0,0 +1,40 @@ +import AsyncStorage from "@react-native-async-storage/async-storage"; +import { applyMiddleware, createStore, compose } from "redux"; +import { createLogger } from "redux-logger"; +import thunk from "redux-thunk"; +import { persistStore, persistReducer } from "redux-persist"; +import autoMergeLevel2 from "redux-persist/lib/stateReconciler/autoMergeLevel2"; +import allReducers from "../reducers"; + +const persistConfig = { + key: "root", + storage: AsyncStorage, + stateReconciler: autoMergeLevel2, // see "Merge Process" section for details. + whitelist: ["profile"], +}; +const pReducer = persistReducer(persistConfig, allReducers); + +const middleWare = []; + +middleWare.push(thunk); + +const loggerMiddleware = createLogger({ + predicate: () => process.env.NODE_ENV === "development", +}); +middleWare.push(loggerMiddleware); + +const store = createStore(pReducer, compose(applyMiddleware(...middleWare))); + +const persistor = persistStore(store); + +const ReactNative = require("react-native"); +try { + ReactNative.I18nManager.allowRTL(true); + // enableScreens(); +} catch (e) { + console.log(e); +} + +console.disableYellowBox = true; + +export default store; \ No newline at end of file diff --git a/src/screens/Home/components/Blogs.js b/src/screens/Home/components/Blogs.js index 15c79e4..44e2431 100644 --- a/src/screens/Home/components/Blogs.js +++ b/src/screens/Home/components/Blogs.js @@ -1,4 +1,4 @@ -import React from 'react'; +import React from "react"; import { View, Image, @@ -6,74 +6,99 @@ import { Dimensions, TouchableOpacity, FlatList, -} from 'react-native'; +} from "react-native"; -const width = Dimensions.get('window').width; -const height = Dimensions.get('window').height; +const width = Dimensions.get("window").width; +const height = Dimensions.get("window").height; -import Header from '../components/Header'; -import tw from 'tailwind-rn'; +import Header from "../components/Header"; +import tw from "tailwind-rn"; -import {connect} from 'react-redux'; +import { connect } from "react-redux"; //asssets -import foodImage from '../assets/food.png'; -import userImage from '../assets/user.png'; -import messageIcon from '../assets/message.png'; +import foodImage from "../assets/food.png"; +import userImage from "../assets/user.png"; +import messageIcon from "../assets/message.png"; //Color -import Color from '../../../constants/Colors'; +import Color from "../../../constants/Colors"; -function Blogs({products}) { +function Blogs({ products }) { return ( - - -
+ + +
} + renderItem={({ item }) => } + keyExtractor={item => item.id} /> ); } -const Blog = ({blog}) => { +const Blog = ({ blog }) => { return ( navigation.navigate('Product')} > - + + { transform: [{ translateY: -20 }], marginHorizontal: 10 }, + tw("flex flex-col bg-white rounded-md p-2"), + ]} + > + tw("mb-2"), + { + color: Color.theme1.light.blue7, + fontFamily: "bold", + fontSize: width / 36, + }, + ]} + > آیا مواد غذای پر فیبر مفید هستند؟ - - + + - + حامد دژبانی نسب - - ۳۰ دقیقه + + + ۳۰ دقیقه + @@ -82,7 +107,7 @@ const Blog = ({blog}) => { ); }; -const mapStateToProps = state => ({ +const mapStateToProps = (state) => ({ // features: state.publicApi.home?.features, }); export default connect(mapStateToProps, {})(Blogs); @@ -91,27 +116,35 @@ Blogs.defaultProps = { products: [ { imageUrl: foodImage, + id: 0, }, { imageUrl: foodImage, + id: 1, }, { imageUrl: foodImage, + id: 2, }, { imageUrl: foodImage, + id: 3, }, { imageUrl: foodImage, + id: 4, }, { imageUrl: foodImage, + id: 5, }, { imageUrl: foodImage, + id: 6, }, { imageUrl: foodImage, + id: 7, }, ], }; diff --git a/src/screens/Home/components/Header.js b/src/screens/Home/components/Header.js index 251bf82..affa8ef 100644 --- a/src/screens/Home/components/Header.js +++ b/src/screens/Home/components/Header.js @@ -1,22 +1,32 @@ -import React from 'react'; -import {View, Text, Image, Pressable} from 'react-native'; -import {useNavigation} from '@react-navigation/native'; -import tw from 'tailwind-rn'; +import React from "react"; +import { View, Text, Image, Pressable, Dimensions } from "react-native"; +import {Entypo} from '@expo/vector-icons'; +import { useNavigation } from "@react-navigation/native"; +import tw from "tailwind-rn"; //assets -import arrowIcon from '../assets/arrow.png'; +import arrowIcon from "../assets/arrow.png"; //Color -import Color from '../../../constants/Colors'; +import Color from "../../../constants/Colors"; -const Header = ({title, route}) => { +const width = Dimensions.get('window').width; + +const Header = ({ title, route }) => { const navigation = useNavigation(); return ( - + + style={[ + { + color: Color.theme1.light.blue5, + fontFamily : 'bold', + fontSize : width / 30 + }, + ]} + > {title} navigation.navigate(route)}> - + ); diff --git a/src/screens/Home/components/MyBooks.js b/src/screens/Home/components/MyBooks.js index 03b13ea..c923949 100644 --- a/src/screens/Home/components/MyBooks.js +++ b/src/screens/Home/components/MyBooks.js @@ -1,4 +1,4 @@ -import React, {useState, useEffect} from 'react'; +import React, { useState, useEffect } from "react"; import { View, Text, @@ -6,82 +6,103 @@ import { TouchableOpacity, Dimensions, FlatList, -} from 'react-native'; -import tw from 'tailwind-rn'; -import {connect} from 'react-redux'; -// import { book } from "../../../../../redux/actions"; -import Progress from '../../../components/Progress'; +} from "react-native"; +import tw from "tailwind-rn"; +import {useNavigation} from '@react-navigation/native'; +import { connect } from "react-redux"; +import Progress from "../../../components/Progress"; //assets -import bookImage from '../assets/zist11.png'; +import bookImage from "../assets/zist11.png"; //Color -import Color from '../../../constants/Colors'; +import Color from "../../../constants/Colors"; -const width = Dimensions.get('window').width; -const height = Dimensions.get('window').height; +const width = Dimensions.get("window").width; +const height = Dimensions.get("window").height; -function MyBooks({getList, list, grades}) { +function MyBooks({ getList, list, grades }) { return ( - + + ]} + > + style={[ + { + color: Color.theme1.light.blue5, + fontFamily: "bold", + fontSize: width / 30, + }, + ]} + > کتابهای من } + renderItem={({ item }) => } + keyExtractor={(book) => book.name} /> ); } -const Book = ({book, grades}) => { +const Book = ({ book, grades }) => { + const navigation = useNavigation(); return ( - + navigation.navigate("Product")} + > - {'نام کتاب'} + tw("mt-2 pr-1"), + { + color: Color.theme1.light.blue6, + fontFamily: "bold", + fontSize: width / 36, + }, + ]} + > + {"نام کتاب"} {`پایه ${'اول'}`} - + tw("mt-1 pr-1"), + { + color: Color.theme1.light.blue5, + fontFamily: "light", + fontSize: width / 40, + }, + ]} + >{`پایه ${"اول"}`} + ); }; -const mapStateToProps = state => ({ +const mapStateToProps = (state) => ({ // list: state.book.list, // grades : state.publicApi.grades }); @@ -89,5 +110,5 @@ const mapStateToProps = state => ({ export default connect(mapStateToProps, {})(MyBooks); MyBooks.defaultProps = { - list: [{name: 1}, {name: 2}, {name: 3}, {name: 4}, {name: 5}], + list: [{ name: 1 }, { name: 2 }, { name: 3 }, { name: 4 }, { name: 5 }], }; diff --git a/src/screens/Home/components/Videos.js b/src/screens/Home/components/Videos.js index 28e039e..c4c9765 100644 --- a/src/screens/Home/components/Videos.js +++ b/src/screens/Home/components/Videos.js @@ -24,11 +24,11 @@ const height = Dimensions.get('window').height; function Videos({getList, list, grades}) { return ( - +
@@ -37,7 +37,8 @@ function Videos({getList, list, grades}) { horizontal={true} inverted={true} data={list} - renderItem={(video, index) =>