diff options
author | Shravya Ramesh <shravs1208@gmail.com> | 2021-08-05 12:03:57 -0700 |
---|---|---|
committer | Shravya Ramesh <shravs1208@gmail.com> | 2021-08-05 12:03:57 -0700 |
commit | 58f3946125df54b1c630a7a06f705eaa9b31c4da (patch) | |
tree | ddb932cd9b4f593e7b89bb4a8d33c7a63c09c8f1 /src/components/camera/FlashButton.tsx | |
parent | b0804b9159f269fc3b0ccb4198455cbddd96cba1 (diff) |
Address issues
Diffstat (limited to 'src/components/camera/FlashButton.tsx')
-rw-r--r-- | src/components/camera/FlashButton.tsx | 73 |
1 files changed, 27 insertions, 46 deletions
diff --git a/src/components/camera/FlashButton.tsx b/src/components/camera/FlashButton.tsx index f7791d5b..65c773d9 100644 --- a/src/components/camera/FlashButton.tsx +++ b/src/components/camera/FlashButton.tsx @@ -1,10 +1,9 @@ import {BlurView} from '@react-native-community/blur'; -import React, {Dispatch, SetStateAction, useMemo} from 'react'; +import React, {Dispatch, SetStateAction} from 'react'; import {Text, TouchableOpacity, View} from 'react-native'; import {FlashMode} from 'react-native-camera'; -import {normalize} from 'react-native-elements'; -import FlashOnIcon from '../../assets/icons/camera/flash-off.svg'; -import FlashOffIcon from '../../assets/icons/camera/flash-on.svg'; +import FlashOnIcon from '../../assets/icons/camera/flash-on.svg'; +import FlashOffIcon from '../../assets/icons/camera/flash-off.svg'; import {styles} from './styles'; interface FlashButtonProps { @@ -19,49 +18,31 @@ export const FlashButton: React.FC<FlashButtonProps> = ({ flashMode, setFlashMode, }) => { - return useMemo( - () => ( - <> - <BlurView - blurType={'ultraThinMaterialDark'} - blurAmount={1} + return ( + <> + <BlurView + blurType={'ultraThinMaterialDark'} + blurAmount={1} + style={styles.blurView} + /> + <TouchableOpacity + onPress={() => setFlashMode(flashMode === 'on' ? 'off' : 'on')} + style={styles.flashButtonContainerBackground}> + <View style={[ - { - position: 'absolute', - zIndex: 1, - top: normalize(44), - right: 0, - marginRight: normalize(16), - height: 86, - width: 49, - flexDirection: 'column', - justifyContent: 'center', - alignItems: 'center', - borderRadius: 24.5, - }, - ]} - /> - <TouchableOpacity - onPress={() => setFlashMode(flashMode === 'on' ? 'off' : 'on')} - style={[styles.flashButtonContainerBackground]}> - <View - style={[ - styles.flashButtonContainer, - { - opacity: flashMode === 'off' ? 0.5 : 1, - }, - ]}> - {flashMode === 'off' ? ( - <FlashOffIcon height={30} width={20} color={'white'} /> - ) : ( - <FlashOnIcon height={30} width={20} color={'white'} /> - )} - <Text style={styles.saveButtonLabel}>Flash</Text> - </View> - </TouchableOpacity> - </> - ), - [flashMode], + styles.flashButtonContainer, + // eslint-disable-next-line react-native/no-inline-styles + {opacity: flashMode === 'off' ? 0.5 : 1}, + ]}> + {flashMode === 'off' ? ( + <FlashOffIcon height={30} width={20} color={'white'} /> + ) : ( + <FlashOnIcon height={30} width={20} color={'white'} /> + )} + <Text style={styles.saveButtonLabel}>Flash</Text> + </View> + </TouchableOpacity> + </> ); }; |