diff options
author | Ivan Chen <ivan@tagg.id> | 2021-07-01 16:52:19 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-01 16:52:19 -0400 |
commit | 202c94b6a5f96db228965a64a33e444511eea1cf (patch) | |
tree | 1d1ddbb28dd0276c7e4e0c7e6cb1de13245b2220 /src/components/camera/FlipButton.tsx | |
parent | de390ea6b0f3bfd851029cf038aacd11f269a823 (diff) | |
parent | c08a67f5cc1d622e91828d0557c6716a40ee5bad (diff) |
Merge pull request #482 from IvanIFChen/tma953-camera-screen-merged-with-master
[TMA-953] Camera Screen from Master to PoC Video Branch
Diffstat (limited to 'src/components/camera/FlipButton.tsx')
-rw-r--r-- | src/components/camera/FlipButton.tsx | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/components/camera/FlipButton.tsx b/src/components/camera/FlipButton.tsx new file mode 100644 index 00000000..c6f710a9 --- /dev/null +++ b/src/components/camera/FlipButton.tsx @@ -0,0 +1,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; |