mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-18 19:01:38 +03:00
Merge pull request #1956 from ecency/nt/profile-nav
navigation to profile tab or screen based on pageType
This commit is contained in:
commit
a06dd94442
@ -29,6 +29,7 @@ const PostCardContainer = ({
|
||||
nsfw,
|
||||
imageHeight,
|
||||
setImageHeight,
|
||||
pageType,
|
||||
}) => {
|
||||
const [_content, setContent] = useState(content);
|
||||
const [reblogs, setReblogs] = useState([]);
|
||||
@ -77,14 +78,21 @@ const PostCardContainer = ({
|
||||
|
||||
const _handleOnUserPress = () => {
|
||||
if (_content) {
|
||||
navigation.navigate({
|
||||
routeName: ROUTES.SCREENS.PROFILE,
|
||||
params: {
|
||||
username: get(_content, 'author'),
|
||||
reputation: get(_content, 'author_reputation'),
|
||||
},
|
||||
key: get(_content, 'author'),
|
||||
});
|
||||
if (
|
||||
get(currentAccount, 'name') === get(_content, 'author') &&
|
||||
(pageType === 'main' || pageType === 'ownProfile')
|
||||
) {
|
||||
navigation.navigate(ROUTES.TABBAR.PROFILE);
|
||||
} else {
|
||||
navigation.navigate({
|
||||
routeName: ROUTES.SCREENS.PROFILE,
|
||||
params: {
|
||||
username: get(_content, 'author'),
|
||||
reputation: get(_content, 'author_reputation'),
|
||||
},
|
||||
key: get(_content, 'author'),
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -16,6 +16,7 @@ interface postsListContainerProps extends FlatListProps<any> {
|
||||
onLoadPosts?:(shouldReset:boolean)=>void;
|
||||
isLoading:boolean;
|
||||
isRefreshing:boolean;
|
||||
pageType:'main'|'profile'|'ownProfile'|'community';
|
||||
}
|
||||
|
||||
let _onEndReachedCalledDuringMomentum = true;
|
||||
@ -26,6 +27,7 @@ const postsListContainer = ({
|
||||
onLoadPosts,
|
||||
isRefreshing,
|
||||
isLoading,
|
||||
pageType,
|
||||
...props
|
||||
}:postsListContainerProps, ref) => {
|
||||
|
||||
@ -121,6 +123,7 @@ const postsListContainer = ({
|
||||
isHideImage={isHideImages}
|
||||
imageHeight={imgHeight}
|
||||
setImageHeight = {_setImageHeightInMap}
|
||||
pageType={pageType}
|
||||
/>,
|
||||
);
|
||||
}
|
||||
@ -138,6 +141,7 @@ const postsListContainer = ({
|
||||
isHideImage={isHideImages}
|
||||
imageHeight={imgHeight}
|
||||
setImageHeight = {_setImageHeightInMap}
|
||||
pageType={pageType}
|
||||
/>,
|
||||
);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ export interface TabMeta {
|
||||
isFeedScreen:boolean,
|
||||
isInitialTab:boolean,
|
||||
getFor:string,
|
||||
pageType:string,
|
||||
pageType:'main'|'profile'|'ownProfile'|'community',
|
||||
feedUsername:string,
|
||||
tag:string,
|
||||
forceLoadPosts:boolean,
|
||||
|
@ -281,6 +281,7 @@ const TabContent = ({
|
||||
isRefreshing={tabMeta.isRefreshing}
|
||||
isLoading={tabMeta.isLoading}
|
||||
ListEmptyComponent={_renderEmptyContent}
|
||||
pageType={pageType}
|
||||
/>
|
||||
<NewPostsPopup
|
||||
popupAvatars={latestPosts.map(post=>post.avatar || '')}
|
||||
|
Loading…
Reference in New Issue
Block a user