diff options
Diffstat (limited to 'src/components/common')
| -rw-r--r-- | src/components/common/NavigationIcon.tsx | 69 | ||||
| -rw-r--r-- | src/components/common/index.ts | 1 |
2 files changed, 70 insertions, 0 deletions
diff --git a/src/components/common/NavigationIcon.tsx b/src/components/common/NavigationIcon.tsx new file mode 100644 index 00000000..9497566b --- /dev/null +++ b/src/components/common/NavigationIcon.tsx @@ -0,0 +1,69 @@ +import React from 'react'; +import { + View, + Image, + StyleSheet, + TouchableOpacity, + TouchableOpacityProps, +} from 'react-native'; + +interface NavigationIconProps extends TouchableOpacityProps { + tab: 'Home' | 'Search' | 'Upload' | 'Notifications' | 'Profile'; + disabled?: boolean; +} + +const NavigationIcon = (props: NavigationIconProps) => { + let imgSrc; + switch (props.tab) { + case 'Home': + imgSrc = props.disabled + ? require('../../assets/navigationIcons/home.png') + : require('../../assets/navigationIcons/home-clicked.png'); + break; + case 'Search': + imgSrc = props.disabled + ? require('../../assets/navigationIcons/search.png') + : require('../../assets/navigationIcons/search-clicked.png'); + break; + case 'Upload': + imgSrc = props.disabled + ? require('../../assets/navigationIcons/upload.png') + : require('../../assets/navigationIcons/upload.png'); + break; + case 'Notifications': + imgSrc = props.disabled + ? require('../../assets/navigationIcons/notifications.png') + : require('../../assets/navigationIcons/notifications-clicked.png'); + break; + case 'Profile': + imgSrc = props.disabled + ? require('../../assets/navigationIcons/profile.png') + : require('../../assets/navigationIcons/profile-clicked.png'); + break; + default: + imgSrc = null; + } + return ( + <View style={styles.icon}> + <TouchableOpacity {...props}> + <Image source={imgSrc} /> + </TouchableOpacity> + </View> + ); +}; + +const styles = StyleSheet.create({ + icon: { + flex: 1, + justifyContent: 'center', + shadowColor: '#000000', + shadowOffset: { + width: 0, + height: 2, + }, + shadowRadius: 2, + shadowOpacity: 0.4, + }, +}); + +export default NavigationIcon; diff --git a/src/components/common/index.ts b/src/components/common/index.ts index b7041b6d..d7778f95 100644 --- a/src/components/common/index.ts +++ b/src/components/common/index.ts @@ -2,3 +2,4 @@ export {default as CenteredView} from './CenteredView'; export {default as OverlayView} from './OverlayView'; export {default as RadioCheckbox} from './RadioCheckbox'; export {default as TaggInput} from './TaggInput'; +export {default as NavigationIcon} from './NavigationIcon'; |
