From f404ad6b192b1e2f0466061c951ef3d131737a4c Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Fri, 16 Jul 2021 18:17:05 -0400 Subject: Add logic to show/hide trimmer --- src/components/moments/TrimmerPlayer.tsx | 56 +++++++++++++++++++------------- 1 file changed, 34 insertions(+), 22 deletions(-) (limited to 'src/components') diff --git a/src/components/moments/TrimmerPlayer.tsx b/src/components/moments/TrimmerPlayer.tsx index 4d6a8985..ef829637 100644 --- a/src/components/moments/TrimmerPlayer.tsx +++ b/src/components/moments/TrimmerPlayer.tsx @@ -1,7 +1,8 @@ import React, {useEffect, useRef, useState} from 'react'; +import {StyleSheet, View} from 'react-native'; import Video from 'react-native-video'; import {Trimmer} from 'react-native-video-processing'; -import {SCREEN_WIDTH} from '../../utils'; +import {SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils'; interface TrimmerPlayerProps { source: string; @@ -79,29 +80,40 @@ const TrimmerPlayer: React.FC = ({ setPaused((state) => !state); }} /> - - // https://github.com/shahen94/react-native-video-processing - source={source} - height={hideTrimmer ? 0 : 75} - width={hideTrimmer ? 0 : SCREEN_WIDTH} - borderWidth={hideTrimmer ? 0 : 100} - onTrackerMove={(e: {currentTime: number}) => { - setPaused(true); - setSeekTime(e.currentTime); - }} - currentTime={trackerTime} - themeColor={'white'} - thumbWidth={10} - trackerColor={'white'} - onChange={(e: {endTime: number; startTime: number}) => { - setPaused(true); - setEnd(e.endTime); - setStart(e.startTime); - }} - /> + + + // https://github.com/shahen94/react-native-video-processing + source={source} + height={hideTrimmer ? 0 : 75} + width={hideTrimmer ? 0 : SCREEN_WIDTH} + onTrackerMove={(e: {currentTime: number}) => { + setPaused(true); + setSeekTime(e.currentTime); + }} + currentTime={trackerTime} + themeColor={'white'} + thumbWidth={10} + trackerColor={'white'} + onChange={(e: {endTime: number; startTime: number}) => { + setPaused(true); + setEnd(e.endTime); + setStart(e.startTime); + }} + /> + ); }; +const styles = StyleSheet.create({ + trimmerContainer: { + position: 'absolute', + bottom: SCREEN_HEIGHT * 0.1, + alignItems: 'center', + borderWidth: 1, + borderColor: 'red', + }, +}); + export default TrimmerPlayer; -- cgit v1.2.3-70-g09d2