import React, { useState, useEffect } from "react"; import { SafeAreaView, ScrollView, StatusBar, LayoutAnimation, Platform, Dimensions, View, } from "react-native"; import { connect } from "react-redux"; import { userProduct } from "../../redux/actions"; //components import Navbar from "../../components/Navbar"; import Drawer from "../../components/Drawer"; import Book from "./components/Book"; import Empty from "../../components/Empty"; //style import tw from "tailwind-rn"; const { height } = Dimensions.get("window"); const ios = Platform.OS === "ios"; function AR({ getUserProducts, userProducts, mobile, theme }) { const [position, setPosition] = useState("100%"); useEffect(() => { getUserProducts(); StatusBar.setBarStyle( `${theme === "light" ? "dark" : "light"}-content`, true ); }, []); useEffect(() => { StatusBar.setBarStyle( `${theme === "light" ? "dark" : "light"}-content`, true ); }, [theme]); const setBoxPosition = () => { LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut); setPosition(position === "100%" ? "0%" : "100%"); }; return ( {userProducts?.length ? ( {userProducts ?.filter( (product) => (product?.productType === 2 || product?.productType === 3) && product?.condition >= 2 ) ?.map((book, index) => ( ))} ) : ( navigation.push("Products")} /> )} ); } const mapStateToProps = (state) => ({ userProducts: state.userProduct.list, mobile: state.publicApi.mobile, theme: state.publicApi.theme, }); const mapDispatchToProps = { getUserProducts: userProduct.list, }; export default connect(mapStateToProps, mapDispatchToProps)(AR);