Skip to content

Commit

Permalink
Merge pull request #364 from wyne/menu-fixes
Browse files Browse the repository at this point in the history
Popover Menu Cleanup
  • Loading branch information
wyne authored Dec 25, 2023
2 parents 6eb3c02 + ea49906 commit 1365819
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
8 changes: 5 additions & 3 deletions src/components/GameListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ParamListBase } from '@react-navigation/native';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { AnyAction, ThunkDispatch } from '@reduxjs/toolkit';
import Moment from 'react-moment';
import { StyleSheet, Text } from 'react-native';
import { Platform, StyleSheet, Text } from 'react-native';
import { Icon, ListItem } from 'react-native-elements';
import Animated, { FadeInUp, SlideOutLeft } from 'react-native-reanimated';

Expand Down Expand Up @@ -65,8 +65,10 @@ const GameListItem: React.FunctionComponent<Props> = ({ navigation, gameId, inde
navigation={navigation}
index={index}
>
{/* <ListItem key={gameId} bottomDivider onPress={chooseGameHandler}> */}
<ListItem key={gameId} bottomDivider>
<ListItem key={gameId} bottomDivider onPress={
// Only select game if iOS because Android is handled by PopupMenu
Platform.OS == 'ios' ? chooseGameHandler : undefined
}>
<ListItem.Content>
<ListItem.Title style={{ alignItems: 'center' }}>
{gameTitle}
Expand Down
4 changes: 1 addition & 3 deletions src/components/PopupMenu/AndroidPopupMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ interface Props {

const AndroidPopupMenu: React.FC<Props> = (props) => {
return (
<Menu
renderer={renderers.Popover}
>
<Menu renderer={renderers.Popover} rendererProps={{ preferredPlacement: 'bottom' }}>
<MenuTrigger
triggerOnLongPress={true}
onAlternativeAction={props.chooseGameHandler}
Expand Down
4 changes: 0 additions & 4 deletions src/components/PopupMenu/IOSPopupMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { MenuAction, MenuView, NativeActionEvent } from '@react-native-menu/menu
import { Platform } from 'react-native';

interface Props {
// Define your component's props here
children: React.ReactNode;
gameTitle: string | undefined;
editGameHandler: () => void;
Expand All @@ -19,8 +18,6 @@ const IOSPopupMenu: React.FC<Props> = ({
shareGameHandler,
deleteGameHandler
}) => {
// Implement your component logic here

type MenuActionHandler = (NativeEvent: NativeActionEvent) => void;

/**
Expand Down Expand Up @@ -76,7 +73,6 @@ const IOSPopupMenu: React.FC<Props> = ({
};

return (
// JSX markup goes here
<MenuView
title={gameTitle}
shouldOpenOnLongPress={true}
Expand Down

0 comments on commit 1365819

Please sign in to comment.