blob: c6f710a92a9c0aa4d461b7b52289df65ee5cd85a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
import React, {Dispatch, SetStateAction} from 'react';
import {Text, TouchableOpacity} from 'react-native';
import {CameraType} from 'react-native-camera';
import FlipIcon from '../../assets/icons/camera/flip.svg';
import {styles} from './styles';
interface FlipButtonProps {
setCameraType: Dispatch<SetStateAction<keyof CameraType>>;
cameraType: keyof CameraType;
}
/*
* Toggles between back camera and front camera
* Appears only when user has not taken a picture yet
* Once user takes a picture, this button disappears to reveal the save button
*/
export const FlipButton: React.FC<FlipButtonProps> = ({
setCameraType,
cameraType,
}) => (
<TouchableOpacity
onPress={() => setCameraType(cameraType === 'front' ? 'back' : 'front')}
style={styles.saveButton}>
<FlipIcon width={40} height={40} />
<Text style={styles.saveButtonLabel}>Flip</Text>
</TouchableOpacity>
);
export default FlipButton;
|