update 5 files

master
Reza_ashrafi 3 years ago
parent 5f0efb356b
commit 0aa0fec1c4
  1. 30
      App.js
  2. 2
      src/components/Drawer.js
  3. 4
      src/navigation.js
  4. 11
      src/screens/Home/index.js
  5. 55
      src/screens/Products/index.js

@ -1,28 +1,28 @@
import Navigation from "./src/navigation"; import Navigation from './src/navigation';
import AlertModal from "./src/components/AlertModal"; import AlertModal from './src/components/AlertModal';
import { Provider } from "react-redux"; // import {SafeAreaView, useSafeAreaInsets} from 'react-native-safe-area-context';
import { store, persistor } from "./src/redux/store"; import {Provider} from 'react-redux';
import React from "react"; import {store, persistor} from './src/redux/store';
import { PersistGate } from "redux-persist/integration/react"; import React from 'react';
import { copilot } from "react-native-copilot"; import {PersistGate} from 'redux-persist/integration/react';
import {copilot} from 'react-native-copilot';
const App = () => { const App = props => {
return ( return (
<Provider store={store}> <Provider store={store}>
<PersistGate loading={null} persistor={persistor}> <PersistGate loading={null} persistor={persistor}>
<Navigation /> <Navigation startUserGuide={() => props.start()} />
<AlertModal /> <AlertModal />
</PersistGate> </PersistGate>
</Provider> </Provider>
); );
}; };
export default copilot({ export default copilot({
labels: { labels: {
previous: "قبلی", previous: 'قبلی',
next: "بعدی", next: 'بعدی',
skip: "رد کردن", skip: 'رد کردن',
finish: "پایان", finish: 'پایان',
}, },
})(App); })(App);

@ -367,7 +367,7 @@ const Drawer = ({
> >
<View <View
style={[ style={[
tw("flex items-end pt-12 px-4"), tw("flex items-end pt-6 px-4"),
{ {
backgroundColor: backgroundColor:
theme === "light" theme === "light"

@ -15,7 +15,7 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
// import OrdersFollowUp from "../src/screens/OrdersFollowUp"; // import OrdersFollowUp from "../src/screens/OrdersFollowUp";
import Splash from "../src/screens/Splash"; import Splash from "../src/screens/Splash";
import Home from "../src/screens/Home"; import Home from "../src/screens/Home";
// import Products from "../src/screens/Products"; import Products from "../src/screens/Products";
import Login from "../src/screens/Login"; import Login from "../src/screens/Login";
import Otp from "../src/screens/Otp"; import Otp from "../src/screens/Otp";
// import Product from "../src/screens/Product"; // import Product from "../src/screens/Product";
@ -519,7 +519,7 @@ const ProductsStackScreen = ({ theme }) => {
}} }}
initialRouteName="Products" initialRouteName="Products"
> >
<ProductsStack.Screen name="Products" children={() => <View></View>} /> <ProductsStack.Screen name="Products" children={() => <Products />} />
{/* <ProductsStack.Screen name="Product" component={Product} /> {/* <ProductsStack.Screen name="Product" component={Product} />
<ProductsStack.Screen name="Sample" component={Sample} /> <ProductsStack.Screen name="Sample" component={Sample} />
<ProductsStack.Screen name="Info" component={Info} /> */} <ProductsStack.Screen name="Info" component={Info} /> */}

@ -1,7 +1,6 @@
import React, {useState} from 'react'; import React, {useState} from 'react';
import {connect} from 'react-redux'; import {connect} from 'react-redux';
import {blog, book, userProduct, publicApi} from '../../redux/actions'; import {blog, book, userProduct} from '../../redux/actions';
import {useNavigation} from '@react-navigation/native';
import AsyncStorage from '@react-native-async-storage/async-storage'; import AsyncStorage from '@react-native-async-storage/async-storage';
import {SafeAreaView, useSafeAreaInsets} from 'react-native-safe-area-context'; import {SafeAreaView, useSafeAreaInsets} from 'react-native-safe-area-context';
@ -9,8 +8,6 @@ import {
View, View,
StyleSheet, StyleSheet,
ScrollView, ScrollView,
Platform,
StatusBar,
LayoutAnimation, LayoutAnimation,
Dimensions, Dimensions,
} from 'react-native'; } from 'react-native';
@ -57,7 +54,7 @@ const Home = ({
setTimeout(() => { setTimeout(() => {
startUserGuide(); startUserGuide();
AsyncStorage.setItem('firstLogin', JSON.stringify(true)); AsyncStorage.setItem('firstLogin', JSON.stringify(true));
}, 800); }, 1200);
} }
}, []); }, []);
@ -111,10 +108,6 @@ const Home = ({
// Later on in your styles.. // Later on in your styles..
const styles = StyleSheet.create({ const styles = StyleSheet.create({
safeStyle: {
// paddingTop: Platform.OS === "android" ? StatusBar.currentHeight : 0,
flex: 1,
},
contentContainerStyle: { contentContainerStyle: {
paddingBottom: height / 10, paddingBottom: height / 10,

@ -1,26 +1,20 @@
import React, { useState, useEffect } from "react"; import React, {useState, useEffect} from 'react';
import {View, ScrollView, Dimensions, LayoutAnimation} from 'react-native';
import { import {SafeAreaView, useSafeAreaInsets} from 'react-native-safe-area-context';
View, import {connect} from 'react-redux';
ScrollView, import {book, config} from '../../redux/actions';
SafeAreaView,
StatusBar,
Dimensions,
LayoutAnimation,
} from "react-native";
import { connect } from "react-redux";
import { book, config } from "../../redux/actions";
//components //components
import Drawer from "../../components/Drawer"; import Drawer from '../../components/Drawer';
import Header from "./components/Header"; import Header from './components/Header';
import Main from "./components/Main"; import Main from './components/Main';
import Navbar from "../../components/Navbar"; import Navbar from '../../components/Navbar';
//style //style
import tw from 'tailwind-rn';
//variables //variables
const {height} = Dimensions.get("window"); const {height} = Dimensions.get('window');
function Products({ function Products({
books, books,
@ -29,40 +23,37 @@ function Products({
route, route,
setFilterOptions, setFilterOptions,
filterOptions, filterOptions,
getFilters getFilters,
}) { }) {
const [position, setPosition] = useState("100%"); const insets = useSafeAreaInsets();
const [position, setPosition] = useState('100%');
useEffect(() => { useEffect(() => {
getFilters(); getFilters();
getBooks({ vod: true }); getBooks({vod: true});
}, []); }, []);
const setBoxPosition = () => { const setBoxPosition = () => {
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut); LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
setPosition(position === "100%" ? "0%" : "100%"); setPosition(position === '100%' ? '0%' : '100%');
}; };
useEffect(() => { useEffect(() => {
if (route?.params?.productType === "دوره ویدئویی") { if (route?.params?.productType === 'دوره ویدئویی') {
setFilterOptions({ ...filterOptions, productType: "محصولات ویدیویی" }); setFilterOptions({...filterOptions, productType: 'محصولات ویدیویی'});
} }
}, [route]); }, [route]);
return ( return (
<SafeAreaView <SafeAreaView
style={{ style={{flex: 1, paddingTop: insets.top, paddingBottom: insets.bottom}}>
paddingTop: Platform.OS === "android" ? StatusBar.currentHeight : 0,
position: "relative",
}}
>
<Navbar <Navbar
setBoxPosition={setBoxPosition} setBoxPosition={setBoxPosition}
headerOptions={{ headerOptions={{
logo: true, logo: true,
menu: false, menu: false,
hamburgerMenu: true, hamburgerMenu: true,
title: "", title: '',
bookmark: false, bookmark: false,
qr: true, qr: true,
back: false, back: false,
@ -70,14 +61,14 @@ function Products({
/> />
<Drawer setBoxPosition={setBoxPosition} position={position} /> <Drawer setBoxPosition={setBoxPosition} position={position} />
<Header /> <Header />
<ScrollView contentContainerStyle={{ paddingBottom: height / 2 }}> <ScrollView contentContainerStyle={{paddingBottom: height / 2}}>
<Main books={books} grades={grades} /> <Main books={books} grades={grades} />
</ScrollView> </ScrollView>
</SafeAreaView> </SafeAreaView>
); );
} }
const mapStateToProps = (state) => ({ const mapStateToProps = state => ({
grades: state.publicApi.grades, grades: state.publicApi.grades,
books: state.book.list, books: state.book.list,
filterOptions: state.book.filterOptions, filterOptions: state.book.filterOptions,
@ -86,7 +77,7 @@ const mapStateToProps = (state) => ({
const mapDispatchToProps = { const mapDispatchToProps = {
getBooks: book.list, getBooks: book.list,
setFilterOptions: book.setFilterOptions, setFilterOptions: book.setFilterOptions,
getFilters: config.getFilters getFilters: config.getFilters,
}; };
export default connect(mapStateToProps, mapDispatchToProps)(Products); export default connect(mapStateToProps, mapDispatchToProps)(Products);
Loading…
Cancel
Save