aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-08-05 18:49:56 -0400
committerGitHub <noreply@github.com>2021-08-05 18:49:56 -0400
commita304be1adfdf9ae191549477ac4b66ee03dfa15e (patch)
treefc4970be9191db3089c353288f5d82eb202a7e3f /src
parent1cdd092bb4729ccc7b414330492b1af17f48692e (diff)
parent58f3946125df54b1c630a7a06f705eaa9b31c4da (diff)
Merge pull request #545 from shravyaramesh/tma1037-swap-flash-icons
[TMA-1037] Swap flash icons
Diffstat (limited to 'src')
-rw-r--r--src/assets/icons/camera/flash-off.svg2
-rw-r--r--src/assets/icons/camera/flash-on.svg2
-rw-r--r--src/components/camera/FlashButton.tsx53
-rw-r--r--src/components/camera/styles.tsx27
4 files changed, 54 insertions, 30 deletions
diff --git a/src/assets/icons/camera/flash-off.svg b/src/assets/icons/camera/flash-off.svg
index fb04efd2..b4608b75 100644
--- a/src/assets/icons/camera/flash-off.svg
+++ b/src/assets/icons/camera/flash-off.svg
@@ -1 +1 @@
-<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 720 720"><defs><style>.cls-1{fill:#fff;}</style></defs><path class="cls-1" d="M361.84,13.57,128.3,360c-3.94,2.81-6.8,11.94-7.74,16.16-4.5,29.23,19.23,41.69,31.66,44.27H289.39l-26,253c-2.11,10.3-1.13,33.3,19.69,42.86s38.69-1.18,45-7.73l260.27-373.1,9.85-16.16c8.44-32.61-14.78-46.38-27.44-49.19H400.53L427.26,38.16c1.13-17.42-11.26-29.28-17.59-33C386.6-7.23,368.17,5.61,361.84,13.57Z"/></svg> \ No newline at end of file
+<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 720 720"><defs><style>.cls-1{fill:#fff;}</style></defs><path class="cls-1" d="M413.14,36.09,387.86,255.37h5.7L251.35,397.57H153c-11.76-2.43-34.2-14.21-29.95-41.86.89-4,3.6-12.62,7.32-15.28L351.28,12.83c6-7.53,23.41-19.67,45.23-8C402.5,8.4,414.2,19.61,413.14,36.09Z"/><path class="cls-1" d="M594.91,341l-9.32,15.28L339.45,709.1c-6,6.2-22.89,16.35-42.58,7.31s-20.62-30.78-18.63-40.53L297,493.2,495.79,294.46H569C580.94,297.12,602.89,310.14,594.91,341Z"/><path class="cls-1" d="M634.48,114.82a29,29,0,0,1-8.5,20.53L486.15,275.18,287.4,473.92,135.09,626.24A29,29,0,1,1,94,585.18l167.8-167.8L404,275.18,584.92,94.29a29,29,0,0,1,49.56,20.53Z"/></svg> \ No newline at end of file
diff --git a/src/assets/icons/camera/flash-on.svg b/src/assets/icons/camera/flash-on.svg
index b4608b75..fb04efd2 100644
--- a/src/assets/icons/camera/flash-on.svg
+++ b/src/assets/icons/camera/flash-on.svg
@@ -1 +1 @@
-<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 720 720"><defs><style>.cls-1{fill:#fff;}</style></defs><path class="cls-1" d="M413.14,36.09,387.86,255.37h5.7L251.35,397.57H153c-11.76-2.43-34.2-14.21-29.95-41.86.89-4,3.6-12.62,7.32-15.28L351.28,12.83c6-7.53,23.41-19.67,45.23-8C402.5,8.4,414.2,19.61,413.14,36.09Z"/><path class="cls-1" d="M594.91,341l-9.32,15.28L339.45,709.1c-6,6.2-22.89,16.35-42.58,7.31s-20.62-30.78-18.63-40.53L297,493.2,495.79,294.46H569C580.94,297.12,602.89,310.14,594.91,341Z"/><path class="cls-1" d="M634.48,114.82a29,29,0,0,1-8.5,20.53L486.15,275.18,287.4,473.92,135.09,626.24A29,29,0,1,1,94,585.18l167.8-167.8L404,275.18,584.92,94.29a29,29,0,0,1,49.56,20.53Z"/></svg> \ No newline at end of file
+<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 720 720"><defs><style>.cls-1{fill:#fff;}</style></defs><path class="cls-1" d="M361.84,13.57,128.3,360c-3.94,2.81-6.8,11.94-7.74,16.16-4.5,29.23,19.23,41.69,31.66,44.27H289.39l-26,253c-2.11,10.3-1.13,33.3,19.69,42.86s38.69-1.18,45-7.73l260.27-373.1,9.85-16.16c8.44-32.61-14.78-46.38-27.44-49.19H400.53L427.26,38.16c1.13-17.42-11.26-29.28-17.59-33C386.6-7.23,368.17,5.61,361.84,13.57Z"/></svg> \ No newline at end of file
diff --git a/src/components/camera/FlashButton.tsx b/src/components/camera/FlashButton.tsx
index 06a4e44e..65c773d9 100644
--- a/src/components/camera/FlashButton.tsx
+++ b/src/components/camera/FlashButton.tsx
@@ -1,8 +1,9 @@
+import {BlurView} from '@react-native-community/blur';
import React, {Dispatch, SetStateAction} from 'react';
-import {Text, TouchableOpacity} from 'react-native';
+import {Text, TouchableOpacity, View} from 'react-native';
import {FlashMode} from 'react-native-camera';
-import FlashOffIcon from '../../assets/icons/camera/flash-off.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 {
@@ -16,27 +17,33 @@ interface FlashButtonProps {
export const FlashButton: React.FC<FlashButtonProps> = ({
flashMode,
setFlashMode,
-}) => (
- <TouchableOpacity
- onPress={() => setFlashMode(flashMode === 'on' ? 'off' : 'on')}
- style={styles.flashButtonContainer}>
- {flashMode === 'on' ? (
- <FlashOnIcon
- height={30}
- width={20}
- color={'white'}
- style={styles.flashIcon}
- />
- ) : (
- <FlashOffIcon
- height={30}
- width={20}
- color={'white'}
- style={styles.flashIcon}
+}) => {
+ return (
+ <>
+ <BlurView
+ blurType={'ultraThinMaterialDark'}
+ blurAmount={1}
+ style={styles.blurView}
/>
- )}
- <Text style={styles.saveButtonLabel}>Flash</Text>
- </TouchableOpacity>
-);
+ <TouchableOpacity
+ onPress={() => setFlashMode(flashMode === 'on' ? 'off' : 'on')}
+ style={styles.flashButtonContainerBackground}>
+ <View
+ style={[
+ 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>
+ </>
+ );
+};
export default FlashButton;
diff --git a/src/components/camera/styles.tsx b/src/components/camera/styles.tsx
index 33b47cc4..dbe1500b 100644
--- a/src/components/camera/styles.tsx
+++ b/src/components/camera/styles.tsx
@@ -18,9 +18,16 @@ export const styles = StyleSheet.create({
zIndex: 999,
},
flashButtonContainer: {
+ zIndex: 3,
+ height: 86,
+ width: 49,
+ flexDirection: 'column',
+ justifyContent: 'center',
+ alignItems: 'center',
+ borderRadius: 30,
+ },
+ flashButtonContainerBackground: {
position: 'absolute',
- backgroundColor: '#808080',
- opacity: 0.25,
zIndex: 1,
top: normalize(50),
right: 0,
@@ -30,7 +37,7 @@ export const styles = StyleSheet.create({
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
- borderRadius: 30,
+ borderRadius: 50,
},
galleryIcon: {
borderWidth: 2,
@@ -47,7 +54,17 @@ export const styles = StyleSheet.create({
height: 40,
backgroundColor: 'grey',
},
- flashIcon: {
- zIndex: 2,
+ blurView: {
+ position: 'absolute',
+ zIndex: 1,
+ top: normalize(50),
+ right: 0,
+ marginRight: normalize(18),
+ height: 86,
+ width: 49,
+ flexDirection: 'column',
+ justifyContent: 'center',
+ alignItems: 'center',
+ borderRadius: 24.5,
},
});