From 47a08eda39a710a1c5dc59f34e4e0c0250f54801 Mon Sep 17 00:00:00 2001 From: Reza_ashrafi Date: Fri, 21 Jan 2022 19:37:45 +0330 Subject: [PATCH] reza added some page --- navigation/assets/book-deactive.png | Bin 0 -> 816 bytes navigation/assets/test-deactive.png | Bin 0 -> 843 bytes navigation/index.js | 50 +++++- package.json | 1 + src/components/Drawer.js | 1 - src/components/MusicPlayer.js | 206 ++++--------------------- src/components/Navbar.js | 9 +- src/components/Pressable.js | 6 +- src/redux/actions/public.js | 2 + src/redux/reducers/public.js | 3 +- src/screens/AR/components/Book.js | 26 ++++ src/screens/AR/index.js | 81 ++++++++-- src/screens/Home/index.js | 1 - src/screens/OrdersFollowUp/index.js | 10 +- src/screens/Product/components/Book.js | 9 +- src/screens/Product/index.js | 1 - src/screens/Products/index.js | 2 +- src/screens/QR/Scan/index.js | 17 +- src/screens/QR/assets/laptop.png | Bin 1133739 -> 179108 bytes src/screens/QRContent/Content/PDF.js | 14 +- src/screens/QRContent/Content/Video.js | 26 +++- src/screens/QRContent/Content/Voice.js | 8 +- src/screens/QRContent/Content/index.js | 18 +-- src/screens/QRContent/Tab/index.js | 21 +-- src/screens/QRContent/index.js | 49 +++--- src/screens/Tests/index.js | 12 ++ src/screens/Video/index.js | 4 +- yarn.lock | 10 +- 28 files changed, 301 insertions(+), 286 deletions(-) create mode 100644 navigation/assets/book-deactive.png create mode 100644 navigation/assets/test-deactive.png create mode 100644 src/screens/AR/components/Book.js create mode 100644 src/screens/Tests/index.js diff --git a/navigation/assets/book-deactive.png b/navigation/assets/book-deactive.png new file mode 100644 index 0000000000000000000000000000000000000000..3bfbc86a2938bd17126ca063c58cdff2a0cf7da5 GIT binary patch literal 816 zcmV-01JC@4P)56fi)F0;_nNgyHet_x|qb*FV#i4c;;y+HRm) z^X_1eho3;19V^EkkUg>7t5#0DRn`31{GNRk z!=EJl3=_i59RThB`+;5pbgGrp^Kgv_=tJ|iqYvFm5wgx604xBo2CzIJ2ZpIJw3(|64a<1;MnMpdE)LcL zKx^Jw*t10}dAEFexH3@q!vG8rQUb&{D}=jDwuTV+hf5pv=539cF5Pl55@uFOYt^vqbip?F1Jzi9q5Na(7{g*%rO~&LyWyDesFHd`83ZbO5 znfWXNLOH;zp4}MGtVG`drImnS}n7j}D8mdX{Yy?Q(FiU3QIx=KCTC+9+G%svB zpsh^mUC7pYxuVD2ua=8PX|a!g{}>>@V?gf3w!*D^q18zMq#h5W`o+1O1OMK}gH3%S5NwLfqd z6fz7k%CNc8vbaDm2Y8_kKQ_` z-Y!t#8V;njY@fXpPk2HO;}#Su@w2^kz~hwcX=~ z@QesVbwSKM5k3NKW<6wq>Uh_8OgwJ7mHG+@CWk64yoL(wMTbfNI{ehCSB~O9?$kTB zX%;nifu|mee_@Iq4p9ZjH;6W}$dhRXBRC3uX}Oj5HlAalxf>QLG5HQa^rFFl7nOx` znDa~F|2KlnJxLJM;s-PZaX-N?wDy)r5CFN1j~&|~zyOKnHi85P6DN8RTybE!qIw0u zJ;es3YrAQ9ovvkpjUdl46NHZ#l!M-uV}*IvtAM0|{|{on(!cv6>P0i!8=84VU*}a{ z42<2 zN$b_zc>M>{q*l!uuaj*7m_oHH!6lH;b}v;fhBeBfE?&~&N;?s%9tCc@RXe%Z)@$e` zea`g&aWJEO$2Na#gB4WT_O z2G2;-1{Rdp#gR>DVW)^@tziZ}dtd4%T*3C~ck2EZ(G^~izAZ@&vgzi3JHIm^e*kX~ V@G)vceLnyI002ovPDHLkV1iN!e~|zH literal 0 HcmV?d00001 diff --git a/navigation/index.js b/navigation/index.js index fc2d372..cf213f7 100644 --- a/navigation/index.js +++ b/navigation/index.js @@ -18,6 +18,7 @@ import Products from "../src/screens/Products"; import Login from "../src/screens/Login"; import Otp from "../src/screens/Otp"; import Product from "../src/screens/Product"; +import AR from "../src/screens/AR"; import QR from "../src/screens/QR"; import QRContent from "../src/screens/QRContent"; import Faq from "../src/screens/Faq"; @@ -30,6 +31,7 @@ import ShoppingCart from "../src/screens/ShoppingCart"; import Video from "../src/screens/Video"; import VideoDisplay from "../src/screens/VideoDisplay"; import Contact from "../src/screens/Contact"; +import Tests from "../src/screens/Tests"; import { user } from "../src/redux/actions"; //assets @@ -37,6 +39,9 @@ import homeDeactiveIcon from "./assets/home-deactive.png"; import homeActiveIcon from "./assets/home-active.png"; import videoActiveIcon from "./assets/video-active.png"; import videoDeactiveIcon from "./assets/video-deactive.png"; +import bookDeactiveIcon from "./assets/book-deactive.png"; + +import testDeactiveIcon from "./assets/test-deactive.png"; const width = Dimensions.get("window").width; @@ -52,13 +57,12 @@ const BottomTabNavigator = () => { tabBarStyle: { backgroundColor: "#CCE6FF", zIndex: 10, - paddingVertical: 10, - height: 60, + height: 70, }, tabBarLabelStyle: { - fontSize: width / 36, + fontSize: width / 34, fontFamily: "regular", - marginTop: 5, + transform: [{translateY : -7}] }, tabBarShowLabel: true, // tabBarLabel : 'reza' @@ -68,19 +72,44 @@ const BottomTabNavigator = () => { name="ShoppingCartTab" component={ShoppingCart} options={{ + tabBarStyle: { + flex : 'flex-col', + display: 'flex', + + }, + title : 'سبد خرید', tabBarIcon: ({ focused, color }) => ( ), }} /> + ( focused ? + : + + ), + }} + /> focused ? ( { name="ProductsTab" component={ProductsStackScreen} options={{ - tabBarIcon: ({ focused, color }) => ( - + title : 'کتاب‌ها', + tabBarIcon: ({ focused, color }) => ( focused ? + : + ), }} /> @@ -108,6 +142,7 @@ const BottomTabNavigator = () => { name="HomeTab" component={HomeStackScreen} options={{ + title : "خانه", tabBarIcon: ({ focused, color }) => focused ? ( { + ); diff --git a/package.json b/package.json index 1e6eecc..a64b329 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "react-i18next": "^11.15.1", "react-native": "0.64.3", "react-native-awesome-alerts": "^1.5.2", + "react-native-openanything": "^0.0.6", "react-native-qrcode-scanner": "^1.5.4", "react-native-restart": "^0.0.22", "react-native-safe-area-context": "3.3.2", diff --git a/src/components/Drawer.js b/src/components/Drawer.js index 45f8c56..e67fa80 100644 --- a/src/components/Drawer.js +++ b/src/components/Drawer.js @@ -95,7 +95,6 @@ const Drawer = ({ position, setBoxPosition }) => { }; return ( console.log(e.currentTarget._nativeTag)} style={[ tw(`absolute z-50 top-0 flex flex-row justify-end `), { diff --git a/src/components/MusicPlayer.js b/src/components/MusicPlayer.js index 653aa6b..e1e0af3 100644 --- a/src/components/MusicPlayer.js +++ b/src/components/MusicPlayer.js @@ -1,185 +1,31 @@ -import React, { useState, useEffect } from "react"; -import { StyleSheet, TouchableOpacity, View, Image, Text } from "react-native"; -import { Ionicons } from "@expo/vector-icons"; -import { Audio } from "expo-av"; +import * as React from 'react'; +import { View, Button } from 'react-native'; +import { Audio } from 'expo-av'; + +export default function VoicePlayer({fileIds}) { + const [sound, setSound] = React.useState(); + + async function playSound() { + console.log('Loading Sound'); + const { sound } = await Audio.Sound.createAsync( + {uri : `https://dnvn.ir/api/v1/file/${fileIds}`} + ); + setSound(sound); + + console.log('Playing Sound'); + await sound.playAsync(); } + + React.useEffect(() => { + return sound + ? () => { + console.log('Unloading Sound'); + sound.unloadAsync(); } + : undefined; + }, [sound]); -const audioBookPlaylist = [ - { - title: "Hamlet - Act I", - author: "William Shakespeare", - source: "Librivox", - uri: "", - imageSource: - "http://www.archive.org/download/LibrivoxCdCoverArt8/hamlet_1104.jpg", - }, - -]; - -const MusicPlayer = () => { - const [isPlaying, setIsPlaying] = useState(false); - const [playbackInstance, setPlaybackInstance] = useState(null); - const [currentIndex, setCurrentIndex] = useState(0); - const [volume, setVolume] = useState(1.0); - const [isBuffering, setIsBuffering] = useState(true); - - useEffect( async () => { - try { - await Audio.setAudioModeAsync({ - allowsRecordingIOS: false, - interruptionModeIOS: Audio.INTERRUPTION_MODE_IOS_DO_NOT_MIX, - playsInSilentModeIOS: true, - interruptionModeAndroid: Audio.INTERRUPTION_MODE_ANDROID_DO_NOT_MIX, - shouldDuckAndroid: true, - staysActiveInBackground: true, - playThroughEarpieceAndroid: true, - }); - - loadAudio(); - } catch (e) { - console.log(e); - } - }); - - const loadAudio = async () => { - try { - const playbackInstance = new Audio.Sound(); - const source = { - uri: audioBookPlaylist[currentIndex].uri, - }; - - const status = { - shouldPlay: isPlaying, - volume: volume, - }; - - playbackInstance.setOnPlaybackStatusUpdate(onPlaybackStatusUpdate); - await playbackInstance.loadAsync(source, status, false); - setPlaybackInstance(playbackInstance); - } catch (e) { - console.log(e); - } - }; - - const onPlaybackStatusUpdate = (status) => { - setIsBuffering(status.isBuffering); - }; - - const handlePlayPause = async () => { - if(isPlaying) { - await playbackInstance.pauseAsync(); - }else{ - await playbackInstance.playAsync(); - } - - setIsPlaying(() => !isPlaying); - }; - - const handlePreviousTrack = async () => { - let { playbackInstance, currentIndex } = state; - if (playbackInstance) { - await playbackInstance.unloadAsync(); - setCurrentIndex( - currentIndex === 0 ? audioBookPlaylist.length - 1 : currentIndex - 1 - ); - loadAudio(); - } - }; - - const handleNextTrack = async () => { - if (playbackInstance) { - await playbackInstance.unloadAsync(); - setCurrentIndex( - currentIndex + 1 > audioBookPlaylist.length - 1 ? 0 : currentIndex + 1 - ); - loadAudio(); - } - }; - - const renderFileInfo = () => { - return playbackInstance ? ( - - - {audioBookPlaylist[currentIndex].title} - - - {audioBookPlaylist[currentIndex].author} - - - {audioBookPlaylist[currentIndex].source} - - - ) : null; - }; return ( - - - handlePreviousTrack()} - > - - - handlePlayPause()} - > - {isPlaying ? ( - - ) : ( - - )} - - handleNextTrack()} - > - - - - {renderFileInfo()} +