Profile Cache and Profile Header Started

This commit is contained in:
aeroreyna
2022-03-16 21:47:56 -07:00
parent 521ffb19ee
commit dc3079328e
7 changed files with 149 additions and 40 deletions

View File

@@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react';
import { Text, View, ScrollView, Image, StyleSheet } from 'react-native';
import API from './../API.js';
import VideoPlayer from './VideoPlayer.js';
import VimeoPlayer from './VimeoPlayer.js';
const videoIdF = (content) => {
let vimeoTag = content.match(/@vimeo:[0-9]+/);
@@ -39,13 +40,13 @@ let Media = (props) => {
const imageStyle = imagesTag.length == 1 ? styles.image : styles.multipleImage;
const videosId = videoIdF(props.content);
let [videosFiles, setVideosFiles] = useState([]);
useEffect(async ()=>{
if(!videosId[1]) return 0;
useEffect(async () => {
if (!videosId[1]) return 0;
let videoObj = await API.getVideo(videosId[1]);
setVideosFiles(videoObj.files);
setVideosFiles(videoObj.files || []);
}, [props.content])
//const vimeo = videosId.length ? <VimeoPlayer videoId={videosId[1]} /> : undefined;
const vimeo = videosFiles.length ? <VideoPlayer videosFiles={videosFiles} /> : null;
const vimeo = videosFiles.length ? <VideoPlayer videosFiles={videosFiles} /> :
(videosId.length ? <VimeoPlayer videoId={videosId[1]} /> : <></>);
return (
<View>
<View style={{ flexDirection: "row" }}>