Skip to content

Commit

Permalink
remove button at first and last module
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyGarciaa committed Dec 7, 2024
1 parent 82b6148 commit c61daf9
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 7 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 33 additions & 4 deletions src/screens/LegalRights/VideoPage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useEffect, useRef, useState } from 'react';
import React, { useEffect, useRef, useState } from 'react';
import { Image, Pressable, Text, View } from 'react-native';
import { useVideoPlayer, VideoView } from 'expo-video';
import { useFocusEffect } from '@react-navigation/native';
import leftArrow from '@/assets/images/left-arrow.png';
import rightArrow from '@/assets/images/right-arrow.png';
import { LegalScreenProps } from '@/navigation/types';
Expand Down Expand Up @@ -65,11 +66,32 @@ export default function VideoPage({
} catch {
setTitle('Title');
}
}, [index]); // run useEffect every time value of index changes
}, [index]);

// useFocusEffect(
// React.useCallback(() => {
// if (playerRef.current) {
// playerRef.current.play();
// }

// return () => {
// if (playerRef.current) {
// playerRef.current.pause?.(); // Safe check for pause
// }
// };
// }, []),
// );

return (
<View style={styles.container}>
<Pressable style={[styles.captionButtons]} onPress={prevPage}>
<Pressable
style={
index != 0
? [styles.captionButtons]
: [styles.captionButtons, styles.noButton]
}
onPress={prevPage}
>
<Image style={[styles.arrows]} source={leftArrow} />
<Text style={styles.buttonText}>Back</Text>
</Pressable>
Expand All @@ -87,7 +109,14 @@ export default function VideoPage({
/>
</View>

<Pressable style={[styles.captionButtons]} onPress={nextPage}>
<Pressable
style={
index != preaData.length - 1
? [styles.captionButtons]
: [styles.captionButtons, styles.noButton]
}
onPress={nextPage}
>
<Text style={styles.buttonText}>Next</Text>
<Image style={[styles.arrows]} source={rightArrow} />
</Pressable>
Expand Down
3 changes: 3 additions & 0 deletions src/screens/LegalRights/VideoPage/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ export const styles = StyleSheet.create({
alignItems: 'center',
boxShadow: '0px 2px 10px 1px rgba(0, 0, 0, 0.10)',
},
noButton: {
opacity: 0,
},
buttonText: {
fontSize: 16,
fontWeight: '500',
Expand Down

0 comments on commit c61daf9

Please sign in to comment.