import React from "react"; import { StyleSheet, TouchableOpacity, Linking } from "react-native"; import { Block, Text, theme } from "galio-framework"; import Icon from "./Icon"; import argonTheme from "../constants/Theme"; class DrawerItem extends React.Component { renderIcon = () => { const { title, focused } = this.props; switch (title) { case "Home": return ( ); case "Elements": return ( ); case "Articles": return ( ); case "Profile": return ( ); case "Account": return ( ); case "Getting Started": return (); case "Log out": return ; default: return null; } }; render() { const { focused, title, navigation } = this.props; const containerStyles = [ styles.defaultStyle, focused ? [styles.activeStyle, styles.shadow] : null ]; return ( title == "Getting Started" ? Linking.openURL( "https://demos.creative-tim.com/argon-pro-react-native/docs/" ).catch(err => console.error("An error occurred", err)) : navigation.navigate(title) } > {this.renderIcon()} {title} ); } } const styles = StyleSheet.create({ defaultStyle: { paddingVertical: 16, paddingHorizontal: 16 }, activeStyle: { backgroundColor: argonTheme.COLORS.ACTIVE, borderRadius: 4 }, shadow: { shadowColor: theme.COLORS.BLACK, shadowOffset: { width: 0, height: 2 }, shadowRadius: 8, shadowOpacity: 0.1 } }); export default DrawerItem;