diff --git a/navigation/assets/book-deactive.png b/navigation/assets/book-deactive.png new file mode 100644 index 0000000..3bfbc86 Binary files /dev/null and b/navigation/assets/book-deactive.png differ diff --git a/navigation/assets/test-deactive.png b/navigation/assets/test-deactive.png new file mode 100644 index 0000000..894ead8 Binary files /dev/null and b/navigation/assets/test-deactive.png differ 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()} +