From ed91266981e1662b512baa1856d8c921a8718e68 Mon Sep 17 00:00:00 2001 From: Ashm Walia Date: Fri, 15 Jan 2021 16:20:29 -0800 Subject: fixes --- src/components/common/AcceptDeclineButtons.tsx | 96 ++++++++++++++------------ src/components/notifications/Notification.tsx | 46 +++++------- src/components/profile/Content.tsx | 8 ++- src/components/profile/ProfileBody.tsx | 45 ++++++++++-- src/routes/Routes.tsx | 2 +- src/services/UserFriendsServices.ts | 2 +- src/store/actions/userFriends.ts | 1 - src/store/actions/userX.ts | 32 ++++++++- src/store/reducers/userXReducer.ts | 2 + src/utils/users.ts | 7 +- 10 files changed, 158 insertions(+), 83 deletions(-) (limited to 'src') diff --git a/src/components/common/AcceptDeclineButtons.tsx b/src/components/common/AcceptDeclineButtons.tsx index 2ebae029..164ce6e7 100644 --- a/src/components/common/AcceptDeclineButtons.tsx +++ b/src/components/common/AcceptDeclineButtons.tsx @@ -1,5 +1,12 @@ import React from 'react'; -import {StyleSheet, View} from 'react-native'; +import { + StyleProp, + StyleSheet, + Text, + View, + ViewProps, + ViewStyle, +} from 'react-native'; import {Button} from 'react-native-elements'; import {useDispatch, useStore} from 'react-redux'; import { @@ -12,73 +19,72 @@ import {acceptFriendRequest} from '../../store/actions'; import {RootState} from '../../store/rootReducer'; import {ProfilePreviewType} from '../../types'; import {SCREEN_WIDTH} from '../../utils'; +import {TouchableOpacity} from 'react-native-gesture-handler'; interface AcceptDeclineButtonsProps { requester: ProfilePreviewType; + onAccept: () => void; + onReject: () => void; + externalStyles?: Record>; } -const AcceptDeclineButtons: React.FC = (props) => { - const {requester} = props; - const state: RootState = useStore().getState(); - const dispatch = useDispatch(); - - const handleAcceptRequest = async () => { - dispatch(acceptFriendRequest(requester)); - dispatch(updateUserXFriends(requester.id, state)); - dispatch(loadUserNotifications()); - }; - - const handleDeclineFriendRequest = async () => { - dispatch(declineFriendRequest(requester.id)); - }; +const AcceptDeclineButtons: React.FC = ({ + requester, + onAccept, + onReject, + externalStyles, +}) => { return ( - <> -