You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
88 lines
2.1 KiB
88 lines
2.1 KiB
import React, { useState, useEffect } from "react"; |
|
import { |
|
SafeAreaView, |
|
ScrollView, |
|
StatusBar, |
|
LayoutAnimation, |
|
Platform, |
|
Dimensions, |
|
View, |
|
} from "react-native"; |
|
import { connect } from "react-redux"; |
|
import { publicApi } from "../../redux/actions"; |
|
|
|
import Navbar from "../../components/Navbar"; |
|
import Drawer from "../../components/Drawer"; |
|
import Book from "./components/Book"; |
|
|
|
import tw from "tailwind-rn"; |
|
|
|
const { height } = Dimensions.get("window"); |
|
const ios = Platform.OS === "ios"; |
|
|
|
function AR({ getArList, arList, mobile }) { |
|
const [position, setPosition] = useState("100%"); |
|
|
|
useEffect(() => { |
|
getArList(); |
|
}, []); |
|
|
|
const setBoxPosition = () => { |
|
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut); |
|
setPosition(position === "100%" ? "0%" : "100%"); |
|
}; |
|
|
|
return ( |
|
<SafeAreaView |
|
style={{ |
|
paddingTop: Platform.OS === "android" ? StatusBar.currentHeight : 0, |
|
position: "relative", |
|
flex: 1, |
|
}} |
|
> |
|
<Navbar |
|
setBoxPosition={setBoxPosition} |
|
headerOptions={{ |
|
logo: false, |
|
menu: false, |
|
hamburgerMenu: false, |
|
title: "واقعیت افزوده", |
|
bookmark: false, |
|
qr: false, |
|
back: true, |
|
}} |
|
/> |
|
<Drawer setBoxPosition={setBoxPosition} position={position} /> |
|
<ScrollView |
|
style={{ |
|
paddingHorizontal: 16, |
|
height: height, |
|
}} |
|
contentContainerStyle={{ paddingBottom: 60 }} |
|
> |
|
<View |
|
style={tw( |
|
`flex justify-between flex-wrap ${ |
|
ios ? "flex-row-reverse" : "flex-row" |
|
}` |
|
)} |
|
> |
|
{arList.length |
|
? arList.map((book, index) => <Book book={book} key={index} />) |
|
: null} |
|
</View> |
|
</ScrollView> |
|
</SafeAreaView> |
|
); |
|
} |
|
|
|
const mapStateToProps = (state) => ({ |
|
arList: state.publicApi.arList, |
|
mobile: state.publicApi.mobile, |
|
}); |
|
|
|
const mapDispatchToProps = { |
|
getArList: publicApi.getArList, |
|
}; |
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(AR);
|
|
|