diff options
| author | Ashm Walia <40498934+ashmgarv@users.noreply.github.com> | 2020-12-04 08:50:24 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-04 11:50:24 -0500 |
| commit | 0fd892ad288f2e1eaaa4fdf5e1fd6f15dbd45860 (patch) | |
| tree | d7d53d94c6c4026ac9b325508ebce4706d412ac4 /src/components/moments | |
| parent | f620102190629e0b6f180d3ce056d850b1db5aaa (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/components/moments')
| -rw-r--r-- | src/components/moments/Moment.tsx | 20 | ||||
| -rw-r--r-- | src/components/moments/MomentTile.tsx | 23 |
2 files changed, 27 insertions, 16 deletions
diff --git a/src/components/moments/Moment.tsx b/src/components/moments/Moment.tsx index 9e138ef3..0c8febcf 100644 --- a/src/components/moments/Moment.tsx +++ b/src/components/moments/Moment.tsx @@ -10,15 +10,21 @@ import {TAGG_TEXT_LIGHT_BLUE} from '../../constants'; import {SCREEN_WIDTH} from '../../utils'; import ImagePicker from 'react-native-image-crop-picker'; import MomentTile from './MomentTile'; -import {MomentType} from 'src/types'; +import {MomentType, ScreenType} from 'src/types'; interface MomentProps { title: string; images: MomentType[] | undefined; - isProfileView: boolean; + userXId: string; + screenType: ScreenType; } -const Moment: React.FC<MomentProps> = ({title, images, isProfileView}) => { +const Moment: React.FC<MomentProps> = ({ + title, + images, + userXId, + screenType, +}) => { const navigation = useNavigation(); const navigateToImagePicker = () => { @@ -32,6 +38,7 @@ const Moment: React.FC<MomentProps> = ({title, images, isProfileView}) => { .then((picture) => { if ('path' in picture) { navigation.navigate('CaptionScreen', { + screenType, title: title, image: picture, }); @@ -45,7 +52,7 @@ const Moment: React.FC<MomentProps> = ({title, images, isProfileView}) => { <View style={styles.container}> <View style={styles.header}> <Text style={styles.titleText}>{title}</Text> - {!isProfileView ? ( + {!userXId ? ( <PlusIcon width={21} height={21} @@ -64,10 +71,11 @@ const Moment: React.FC<MomentProps> = ({title, images, isProfileView}) => { <MomentTile key={imageObj.moment_id} moment={imageObj} - isProfileView={isProfileView} + userXId={userXId} + screenType={screenType} /> ))} - {(images === undefined || images.length === 0) && !isProfileView && ( + {(images === undefined || images.length === 0) && !userXId && ( <TouchableOpacity onPress={() => navigateToImagePicker()}> <LinearGradient colors={['rgba(105, 141, 211, 1)', 'rgba(105, 141, 211, 0.3)']}> diff --git a/src/components/moments/MomentTile.tsx b/src/components/moments/MomentTile.tsx index 787957e0..cc24c531 100644 --- a/src/components/moments/MomentTile.tsx +++ b/src/components/moments/MomentTile.tsx @@ -1,26 +1,29 @@ import {useNavigation} from '@react-navigation/native'; import React from 'react'; import {StyleSheet, View, Image, TouchableOpacity} from 'react-native'; -import {MomentType} from 'src/types'; -import {ProfileContext} from '../../routes'; +import {MomentType, ScreenType} from 'src/types'; interface MomentTileProps { moment: MomentType; - isProfileView: boolean; + userXId: string; + screenType: ScreenType; } -const MomentTile: React.FC<MomentTileProps> = ({moment, isProfileView}) => { +const MomentTile: React.FC<MomentTileProps> = ({ + moment, + userXId, + screenType, +}) => { const navigation = useNavigation(); - //Username is needed by the IndividualMoment screen - const { - user: {username}, - } = React.useContext(ProfileContext); - const {path_hash} = moment; return ( <TouchableOpacity onPress={() => { - navigation.push('IndividualMoment', {moment, isProfileView, username}); + navigation.push('IndividualMoment', { + moment, + screenType, + userXId, + }); }}> <View style={styles.image}> <Image style={styles.image} source={{uri: path_hash}} /> |
