From 0aa0fec1c4e46c2d2a538f0594f17d94941aafad Mon Sep 17 00:00:00 2001 From: Reza_ashrafi Date: Sun, 5 Jun 2022 17:46:18 +0430 Subject: [PATCH] update 5 files --- App.js | 30 +++++++++--------- src/components/Drawer.js | 2 +- src/navigation.js | 4 +-- src/screens/Home/index.js | 11 ++----- src/screens/Products/index.js | 57 +++++++++++++++-------------------- 5 files changed, 44 insertions(+), 60 deletions(-) diff --git a/App.js b/App.js index 1ca105e..41a490b 100644 --- a/App.js +++ b/App.js @@ -1,28 +1,28 @@ -import Navigation from "./src/navigation"; -import AlertModal from "./src/components/AlertModal"; -import { Provider } from "react-redux"; -import { store, persistor } from "./src/redux/store"; -import React from "react"; -import { PersistGate } from "redux-persist/integration/react"; -import { copilot } from "react-native-copilot"; +import Navigation from './src/navigation'; +import AlertModal from './src/components/AlertModal'; +// import {SafeAreaView, useSafeAreaInsets} from 'react-native-safe-area-context'; +import {Provider} from 'react-redux'; +import {store, persistor} from './src/redux/store'; +import React from 'react'; +import {PersistGate} from 'redux-persist/integration/react'; +import {copilot} from 'react-native-copilot'; -const App = () => { +const App = props => { return ( - - + props.start()} /> + ); }; - export default copilot({ labels: { - previous: "قبلی", - next: "بعدی", - skip: "رد کردن", - finish: "پایان", + previous: 'قبلی', + next: 'بعدی', + skip: 'رد کردن', + finish: 'پایان', }, })(App); diff --git a/src/components/Drawer.js b/src/components/Drawer.js index 9070585..5cb3632 100644 --- a/src/components/Drawer.js +++ b/src/components/Drawer.js @@ -367,7 +367,7 @@ const Drawer = ({ > { }} initialRouteName="Products" > - } /> + } /> {/* */} diff --git a/src/screens/Home/index.js b/src/screens/Home/index.js index 5602465..89219e3 100644 --- a/src/screens/Home/index.js +++ b/src/screens/Home/index.js @@ -1,7 +1,6 @@ import React, {useState} from 'react'; import {connect} from 'react-redux'; -import {blog, book, userProduct, publicApi} from '../../redux/actions'; -import {useNavigation} from '@react-navigation/native'; +import {blog, book, userProduct} from '../../redux/actions'; import AsyncStorage from '@react-native-async-storage/async-storage'; import {SafeAreaView, useSafeAreaInsets} from 'react-native-safe-area-context'; @@ -9,8 +8,6 @@ import { View, StyleSheet, ScrollView, - Platform, - StatusBar, LayoutAnimation, Dimensions, } from 'react-native'; @@ -57,7 +54,7 @@ const Home = ({ setTimeout(() => { startUserGuide(); AsyncStorage.setItem('firstLogin', JSON.stringify(true)); - }, 800); + }, 1200); } }, []); @@ -111,10 +108,6 @@ const Home = ({ // Later on in your styles.. const styles = StyleSheet.create({ - safeStyle: { - // paddingTop: Platform.OS === "android" ? StatusBar.currentHeight : 0, - flex: 1, - }, contentContainerStyle: { paddingBottom: height / 10, diff --git a/src/screens/Products/index.js b/src/screens/Products/index.js index 8319c5b..0be3983 100644 --- a/src/screens/Products/index.js +++ b/src/screens/Products/index.js @@ -1,26 +1,20 @@ -import React, { useState, useEffect } from "react"; - -import { - View, - ScrollView, - SafeAreaView, - StatusBar, - Dimensions, - LayoutAnimation, -} from "react-native"; -import { connect } from "react-redux"; -import { book, config } from "../../redux/actions"; +import React, {useState, useEffect} from 'react'; +import {View, ScrollView, Dimensions, LayoutAnimation} from 'react-native'; +import {SafeAreaView, useSafeAreaInsets} from 'react-native-safe-area-context'; +import {connect} from 'react-redux'; +import {book, config} from '../../redux/actions'; //components -import Drawer from "../../components/Drawer"; -import Header from "./components/Header"; -import Main from "./components/Main"; -import Navbar from "../../components/Navbar"; +import Drawer from '../../components/Drawer'; +import Header from './components/Header'; +import Main from './components/Main'; +import Navbar from '../../components/Navbar'; //style +import tw from 'tailwind-rn'; //variables -const {height} = Dimensions.get("window"); +const {height} = Dimensions.get('window'); function Products({ books, @@ -29,40 +23,37 @@ function Products({ route, setFilterOptions, filterOptions, - getFilters + getFilters, }) { - const [position, setPosition] = useState("100%"); + const insets = useSafeAreaInsets(); + const [position, setPosition] = useState('100%'); useEffect(() => { getFilters(); - getBooks({ vod: true }); + getBooks({vod: true}); }, []); const setBoxPosition = () => { LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut); - setPosition(position === "100%" ? "0%" : "100%"); + setPosition(position === '100%' ? '0%' : '100%'); }; useEffect(() => { - if (route?.params?.productType === "دوره ویدئویی") { - setFilterOptions({ ...filterOptions, productType: "محصولات ویدیویی" }); + if (route?.params?.productType === 'دوره ویدئویی') { + setFilterOptions({...filterOptions, productType: 'محصولات ویدیویی'}); } }, [route]); return ( + style={{flex: 1, paddingTop: insets.top, paddingBottom: insets.bottom}}>
- +
); } -const mapStateToProps = (state) => ({ +const mapStateToProps = state => ({ grades: state.publicApi.grades, books: state.book.list, filterOptions: state.book.filterOptions, @@ -86,7 +77,7 @@ const mapStateToProps = (state) => ({ const mapDispatchToProps = { getBooks: book.list, setFilterOptions: book.setFilterOptions, - getFilters: config.getFilters + getFilters: config.getFilters, }; -export default connect(mapStateToProps, mapDispatchToProps)(Products); \ No newline at end of file +export default connect(mapStateToProps, mapDispatchToProps)(Products);