From 05d05f79f744e69c974e97198cca10293a7e071d Mon Sep 17 00:00:00 2001 From: Adolfo Reyna Date: Sun, 8 Jan 2023 22:15:43 -0500 Subject: [PATCH] Floating video --- App.js | 6 ++- Views/Courses.js | 22 +++++--- components/Media.js | 6 ++- components/MediaView.js | 109 ++++++++++++++++++++++++++++++++++++++ components/VideoPlayer.js | 9 ++-- contexts/GlobalState.js | 1 + 6 files changed, 140 insertions(+), 13 deletions(-) create mode 100644 components/MediaView.js diff --git a/App.js b/App.js index 9cf0939..756a935 100644 --- a/App.js +++ b/App.js @@ -3,7 +3,7 @@ import React, { useState, useRef, useEffect } from 'react'; import { NavigationContainer } from '@react-navigation/native'; import { createNativeStackNavigator } from '@react-navigation/native-stack'; import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; -import { Provider as PaperProvider, DefaultTheme, Appbar, Button } from 'react-native-paper'; +import { Provider as PaperProvider, DefaultTheme, Appbar, Button, Text } from 'react-native-paper'; import MaterialIcons from 'react-native-vector-icons/MaterialIcons'; import Login from "./Views/Login.js" import Feed from "./Views/Feed.js" @@ -22,6 +22,7 @@ import { TouchableOpacity, View, Image } from 'react-native'; import MenuView from './Views/Menu.js'; import ProfileSettings from './Views/ProfileSettings.js'; import InviteView from './Views/Invite.js'; +import MediaView from './components/MediaView.js'; const Tab = createBottomTabNavigator(); @@ -114,6 +115,7 @@ const MainNavigation = () => { return ( + <> { />*/} + ) } @@ -277,6 +280,7 @@ export default function App() { + ); } diff --git a/Views/Courses.js b/Views/Courses.js index c0b8efd..e2725f0 100644 --- a/Views/Courses.js +++ b/Views/Courses.js @@ -1,7 +1,6 @@ import React, { useEffect } from "react"; -import { Searchbar } from 'react-native-paper'; -import { ScrollView, ActivityIndicator, StyleSheet, SafeAreaView, FlatList } from 'react-native'; -import { Title } from 'react-native-paper'; +import { Searchbar, Title } from 'react-native-paper'; +import { ScrollView, ActivityIndicator, StyleSheet, SafeAreaView, FlatList, View } from 'react-native'; import API from "../API"; import CourseCard from "../components/CourseCard"; import { useSnapshot } from 'valtio'; @@ -134,8 +133,8 @@ const Courses = () => { { watching.length ? - <> - {i18n.t("message.continueWatching")}: + + {i18n.t("message.continueWatching")}: { keyExtractor={item => item.profile._id} initialNumToRender={2} /> - : <> + : <> } { groups.length ? <> - {i18n.t("message.recentlyAdded")}: + {i18n.t("message.recentlyAdded")}: { { popular.length ? <> - {i18n.t("message.popularCourses")}: + {i18n.t("message.popularCourses")}: { let vimeoTag = content.match(/@vimeo:[0-9]+/); @@ -89,7 +90,10 @@ let Media = (props) => { const video2 = hlsUrl ? ( loaded ? : - setLoaded(true)}> + { + //setLoaded(true) + GlobalState.currentMedia = hlsUrl; + }}> {poster ? :