Skip to content
This repository has been archived by the owner on Aug 15, 2021. It is now read-only.

Commit

Permalink
Minor edits to pass the build tests
Browse files Browse the repository at this point in the history
Note that the props for Icons are supposed to be of type any, according
to ui kitten's website
  • Loading branch information
Zacchua committed Jun 5, 2021
1 parent 0a32133 commit cfd0169
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
9 changes: 5 additions & 4 deletions app/components/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,22 @@ import {
TopNavigationAction
} from '@ui-kitten/components';

const AddIcon = (props) => <Icon {...props} name="plus" />;
const AddIcon = (props: any) => <Icon {...props} name="plus" />;

const MenuIcon = (props) => <Icon {...props} name="menu-outline" />;
const MenuIcon = (props: any) => <Icon {...props} name="menu-outline" />;

// didnt delete these two because could be used for the menu
// const InfoIcon = (props) => <Icon {...props} name="info" />;

// const LogoutIcon = (props) => <Icon {...props} name="log-out" />;

type NavbarProps = {
menuVisible: Boolean,
toggleMenu: Function,
toggleShowForm: Function,
}

const NavBar = ({ toggleMenu, toggleShowForm }: NavbarProps) => {
const NavBar = ({ menuVisible, toggleMenu, toggleShowForm }: NavbarProps) => {
const renderRightActions = () => (
<React.Fragment>
<TopNavigationAction icon={AddIcon}
Expand All @@ -32,7 +33,7 @@ const NavBar = ({ toggleMenu, toggleShowForm }: NavbarProps) => {
const renderMenuAction = () => (
<TopNavigationAction
icon={MenuIcon}
onPress={toggleMenu}
onPress={() => toggleMenu(!menuVisible)}
/>
);

Expand Down
4 changes: 2 additions & 2 deletions app/components/SideMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import {
} from '@ui-kitten/components';
import styles from '../styles/SideMenu.Styles';

const CalendarIcon = (props) => <Icon {...props} name="calendar-outline" />;
const CalendarIcon = (props: any) => <Icon {...props} name="calendar-outline" />;

const HomeIcon = (props) => <Icon {...props} name="home-outline" />;
const HomeIcon = (props: any) => <Icon {...props} name="home-outline" />;

const SideMenu = () => {
const [selectedIndex, setSelectedIndex] = React.useState(new IndexPath(0));
Expand Down
6 changes: 1 addition & 5 deletions app/screens/main/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ const homePage = () => {
}
]);

const toggleMenu = () => {
setMenuVisible(!menuVisible);
};

let menu;
if (menuVisible) {
menu = <SideMenu />;
Expand Down Expand Up @@ -110,7 +106,7 @@ const homePage = () => {
<SafeAreaView style={styles.view}>
{menu}
<View style={styles.container}>
<NavBar toggleMenu={toggleMenu} toggleShowForm={toggleShowForm}/>
<NavBar menuVisible={menuVisible} toggleMenu={setMenuVisible} toggleShowForm={toggleShowForm}/>
<Divider />
{/* Modal is the form that is shown for adding new tasks */}
<Modal
Expand Down

0 comments on commit cfd0169

Please sign in to comment.