aboutsummaryrefslogtreecommitdiff
path: root/src/screens/profile/MomentCommentsScreen.tsx
diff options
context:
space:
mode:
authorAshm Walia <40498934+ashmgarv@users.noreply.github.com>2020-12-04 08:50:24 -0800
committerGitHub <noreply@github.com>2020-12-04 11:50:24 -0500
commit0fd892ad288f2e1eaaa4fdf5e1fd6f15dbd45860 (patch)
treed7d53d94c6c4026ac9b325508ebce4706d412ac4 /src/screens/profile/MomentCommentsScreen.tsx
parentf620102190629e0b6f180d3ce056d850b1db5aaa (diff)
[TMA - 398 AND TMA-430] Replace Providers with Redux Store (#125)
* First * WIP * Thunk * Some more comments * sc * recent searches and follounfollow * Edit profile dummy * Block / unblock and some cleanup * Replace auth provider * Sc * Delete AP after rebase * Discover users * Cleanup * More cleanup * Replace profile provider * Fixed build failure * Fixed a bug reported * Prevent app crash when backend server is down
Diffstat (limited to 'src/screens/profile/MomentCommentsScreen.tsx')
-rw-r--r--src/screens/profile/MomentCommentsScreen.tsx15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/screens/profile/MomentCommentsScreen.tsx b/src/screens/profile/MomentCommentsScreen.tsx
index 7a0bfa66..34f85c28 100644
--- a/src/screens/profile/MomentCommentsScreen.tsx
+++ b/src/screens/profile/MomentCommentsScreen.tsx
@@ -9,8 +9,9 @@ import {Button} from 'react-native-elements';
import {AddComment} from '../../components/';
import {useEffect} from 'react';
import AsyncStorage from '@react-native-community/async-storage';
-import {AuthContext} from '../../routes/authentication';
import {getMomentComments} from '../..//services';
+import {useDispatch} from 'react-redux';
+import {logout} from '../../store/actions';
/**
* Comments Screen for an image uploaded
@@ -29,16 +30,16 @@ interface MomentCommentsScreenProps {
const MomentCommentsScreen: React.FC<MomentCommentsScreenProps> = ({route}) => {
const navigation = useNavigation();
- const {isProfileView, moment_id} = route.params;
+ const {moment_id, screenType} = route.params;
const [commentsList, setCommentsList] = React.useState([]);
const [newCommentsAvailable, setNewCommentsAvailable] = React.useState(true);
- const {logout} = React.useContext(AuthContext);
+ const dispatch = useDispatch();
useEffect(() => {
const loadComments = async () => {
const token = await AsyncStorage.getItem('token');
if (!token) {
- logout();
+ dispatch(logout());
return;
}
getMomentComments(moment_id, setCommentsList, token);
@@ -70,7 +71,11 @@ const MomentCommentsScreen: React.FC<MomentCommentsScreenProps> = ({route}) => {
contentContainerStyle={styles.modalScrollViewContent}>
{commentsList &&
commentsList.map((comment: CommentType) => (
- <CommentTile key={comment.comment_id} comment_object={comment} />
+ <CommentTile
+ key={comment.comment_id}
+ comment_object={comment}
+ screenType={screenType}
+ />
))}
</ScrollView>
<AddComment