diff options
author | Ivan Chen <ivan@tagg.id> | 2021-07-29 14:31:28 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-29 14:31:28 -0400 |
commit | 403314805c9192aa7f7adca9605a0d0a52997c9c (patch) | |
tree | 12b43c7d2775b75ea115600d9df92fcd1f6e7ef3 /src/screens/moments/CameraScreen.tsx | |
parent | 64c0bcbf9b59c42f615000e1c1cfa7e126a4edde (diff) | |
parent | 901a70f5b61a409e96b741505af44b6f7e6fcd7d (diff) |
Merge pull request #530 from shravyaramesh/tma991-video-front-flash
[TMA-991] Front flash for videos
Diffstat (limited to 'src/screens/moments/CameraScreen.tsx')
-rw-r--r-- | src/screens/moments/CameraScreen.tsx | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/screens/moments/CameraScreen.tsx b/src/screens/moments/CameraScreen.tsx index 27412486..40db1191 100644 --- a/src/screens/moments/CameraScreen.tsx +++ b/src/screens/moments/CameraScreen.tsx @@ -4,14 +4,14 @@ import {RouteProp} from '@react-navigation/core'; import {useFocusEffect} from '@react-navigation/native'; import {StackNavigationProp} from '@react-navigation/stack'; import React, {createRef, useCallback, useEffect, useState} from 'react'; -import {StyleSheet, TouchableOpacity, View} from 'react-native'; +import {Modal, StyleSheet, TouchableOpacity, View} from 'react-native'; import {CameraType, FlashMode, RNCamera} from 'react-native-camera'; import {AnimatedCircularProgress} from 'react-native-circular-progress'; import CloseIcon from '../../assets/ionicons/close-outline.svg'; import {FlashButton, FlipButton, GalleryIcon} from '../../components'; import {TAGG_PURPLE} from '../../constants'; import {MainStackParams} from '../../routes'; -import {HeaderHeight, SCREEN_WIDTH} from '../../utils'; +import {HeaderHeight, SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils'; import {showGIFFailureAlert, takePicture, takeVideo} from '../../utils/camera'; type CameraScreenRouteProps = RouteProp<MainStackParams, 'CameraScreen'>; @@ -84,6 +84,11 @@ const CameraScreen: React.FC<CameraScreenProps> = ({route, navigation}) => { return ( <View style={styles.container}> + <Modal + transparent={true} + visible={isRecording && cameraType === 'front' && flashMode === 'on'}> + <View style={styles.flashView} /> + </Modal> <TouchableOpacity style={styles.closeButton} onPress={handleClose}> <CloseIcon height={25} width={25} color={'white'} /> </TouchableOpacity> @@ -92,7 +97,11 @@ const CameraScreen: React.FC<CameraScreenProps> = ({route, navigation}) => { ref={cameraRef} style={styles.camera} type={cameraType} - flashMode={flashMode} + flashMode={ + flashMode === 'on' && isRecording && cameraType === 'back' + ? 'torch' + : flashMode + } onDoubleTap={() => { setCameraType(cameraType === 'front' ? 'back' : 'front'); }} @@ -164,6 +173,12 @@ const styles = StyleSheet.create({ flexDirection: 'column', backgroundColor: 'black', }, + flashView: { + width: SCREEN_WIDTH, + height: SCREEN_HEIGHT, + backgroundColor: '#fff', + opacity: 0.5, + }, captureButtonVideoContainer: { alignSelf: 'center', backgroundColor: 'transparent', |